/* App-specific styles layered on top of the AdminLTE v4 theme. */

:root {
  --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
  --card-hover-shadow: 0 8px 15px rgba(0, 0, 0, 0.12);
  --transition-speed: 0.3s;
}

/* Sidebar: native scroll fallback when OverlayScrollbars JS isn't loaded */
.app-sidebar .sidebar-wrapper {
  overflow-y: auto;
}

.brand-image.bi {
  font-size: 1.5rem;
  vertical-align: middle;
}

/* Page headers */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid var(--bs-primary);
}

.page-title {
  font-weight: 700;
  color: var(--bs-primary);
  margin-bottom: 0.5rem;
}

/* Course/Video grid cards */
.course-grid,
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.course-card,
.video-card {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-speed), transform var(--transition-speed);
}

.course-card:hover,
.video-card:hover {
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-4px);
}

.course-card .card-body,
.video-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-card .card-actions,
.video-card .card-actions {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color);
}

.card-img-top {
  height: 200px;
  object-fit: cover;
  transition: transform var(--transition-speed);
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Video thumbnail */
.video-thumbnail {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumbnail .play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.video-thumbnail .play-overlay::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 20px solid var(--bs-primary);
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  margin-left: 5px;
}

.video-card:hover .play-overlay {
  transform: translate(-50%, -50%) scale(1.1);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pending {
  background: #fff3cd;
  color: #856404;
}

.status-processing {
  background: #cfe2ff;
  color: #084298;
}

.status-completed {
  background: #d1e7dd;
  color: #0f5132;
}

.status-failed {
  background: #f8d7da;
  color: #842029;
}

/* File upload area */
.file-upload-area {
  border: 2px dashed var(--bs-border-color);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  background: var(--bs-tertiary-bg);
  transition: all var(--transition-speed);
  cursor: pointer;
}

.file-upload-area:hover {
  border-color: var(--bs-primary);
  background: rgba(13, 110, 253, 0.05);
}

.file-upload-area input[type="file"] {
  display: none;
}

/* Progress bar */
.progress {
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  transition: width 0.6s ease;
}

/* Video player container */
.video-player-container {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  margin-bottom: 2rem;
}

/* Price tag */
.price-tag {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bs-success);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.price-tag::before {
  content: '$';
  font-size: 1rem;
  opacity: 0.7;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--bs-secondary-color);
}

.empty-state-icon {
  font-size: 4rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .course-grid,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start !important;
  }

  .page-header .btn {
    margin-top: 1rem;
    width: 100%;
  }
}

/* Accordion chevron */
.accordion .card-header button[aria-expanded="true"] .bi-chevron-down {
  transform: rotate(180deg);
}

.accordion .card-header button .bi-chevron-down {
  transition: transform var(--transition-speed);
  display: inline-block;
}

/* Select2 tweaks */
.select2-container--bootstrap-5 .select2-selection {
  min-height: 38px;
  border-radius: 0.375rem;
}

.select2-container--bootstrap-5 .select2-selection--single {
  padding: 0.375rem 0.75rem;
}

.select2-container--bootstrap-5 .select2-dropdown {
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background-color: var(--bs-primary);
  color: white;
}

/* Course thumbnails */
.course-thumbnail {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
}

.course-thumbnail-placeholder {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  border-radius: 8px;
  color: #6c757d;
  font-size: 4rem;
  transition: all var(--transition-speed);
}

.thumbnail-preview {
  max-width: 300px;
  margin-top: 1rem;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
}

.thumbnail-preview img {
  border-radius: 8px;
  width: 100%;
  height: auto;
}

.course-show-thumbnail {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  border-radius: 8px;
}

/* Loading skeleton */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

.skeleton {
  animation: shimmer 2s infinite;
  background: linear-gradient(to right, #f0f0f0 8%, #e0e0e0 18%, #f0f0f0 33%);
  background-size: 1000px 100%;
}

/* Drag and drop (video reordering) */
.drag-handle {
  cursor: move;
  touch-action: none;
  user-select: none;
  transition: color 0.2s;
}

.drag-handle:hover {
  color: var(--bs-primary) !important;
}

.sortable-ghost {
  opacity: 0.4;
  background: var(--bs-tertiary-bg);
}

.sortable-drag {
  opacity: 1;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  transform: rotate(2deg);
}
