/* ==============================================
   Modern Dark Theme Stylesheet
   Inspired by newwhitehub.com
   ============================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Dark theme colors */
  --bg: #000000;
  --panel: #0a0a0a;
  --card-bg: #111111;
  --muted: #9ca3af;
  --text: #ededed;
  --text-bright: #ffffff;
  --line: rgba(255, 255, 255, 0.1);
  --line-hover: rgba(255, 255, 255, 0.2);
  
  /* Accent colors - refined palette */
  --accent: #ef4444;
  --accent-2: #f97316;
  --accent-soft: rgba(239, 68, 68, 0.12);
  --accent-border: rgba(239, 68, 68, 0.35);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.22, 1, 0.36, 1);
}

html, body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ==============================================
   Header & Navigation
   ============================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: var(--transition-base);
}

.site-header.scrolled {
  background: rgba(0, 0, 0, 0.95);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.brand {
  font-size: 20px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  transition: var(--transition-fast);
}

.brand:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 40px;
}

.nav a {
  position: relative;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 0;
  transition: color var(--transition-fast);
}

.nav a:hover {
  color: var(--text-bright);
}

.nav a.active {
  color: var(--text-bright);
}

.nav a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: scaleX(0);
    opacity: 0;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

.nav .user {
  color: var(--muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.role-badge.teacher {
  background: rgba(249, 115, 22, 0.15);
  border-color: rgba(249, 115, 22, 0.4);
  color: #fb923c;
}

.role-badge.student {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-hover);
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-bright);
  margin: 0 auto;
  border-radius: 2px;
  transition: var(--transition-base);
}

.nav-toggle span + span {
  margin-top: 5px;
}

.site-header.open .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-header.open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.site-header.open .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ==============================================
   Container & Layout
   ============================================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.page {
  min-height: calc(100vh - 140px);
  padding: 40px 0;
}

.section {
  padding: 48px 0;
}

.section:first-child {
  padding-top: 32px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  gap: 20px;
}

.section-head h1,
.section-head h2 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
  margin: 0;
}

.section-head h2 {
  font-size: 28px;
}

.link {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition-fast);
}

.link:hover {
  color: var(--text-bright);
}

/* ==============================================
   Hero Section
   ============================================== */

.hero {
  padding: 80px 0;
  text-align: center;
  background: 
    radial-gradient(ellipse 800px 400px at 50% 0%, rgba(239, 68, 68, 0.08), transparent),
    radial-gradient(ellipse 600px 300px at 20% 50%, rgba(249, 115, 22, 0.05), transparent);
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 50%, transparent);
}

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  color: var(--text-bright);
  margin: 0 0 16px 0;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero .muted {
  font-size: 18px;
  color: var(--muted);
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ==============================================
   Buttons
   ============================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-bright);
  cursor: pointer;
  transition: var(--transition-base);
  white-space: nowrap;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--line-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.sm {
  padding: 7px 14px;
  font-size: 14px;
  border-radius: 8px;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn.primary:hover {
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
  filter: brightness(1.1);
}

.btn:disabled,
.btn.loading {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==============================================
   Cards & Grid
   ============================================== */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  transition: var(--transition-smooth);
  position: relative;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-hover);
  box-shadow: var(--shadow-lg);
}

.card .media {
  position: relative;
  width: 100%;
  height: 200px;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card .media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.card .media video,
.card .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-smooth);
}

.card:hover .media video,
.card:hover .media img {
  transform: scale(1.05);
}

.card .content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card .title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
  line-height: 1.4;
}

.card .title a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition-fast);
}

.card .title a:hover {
  color: var(--accent);
}

.card .meta {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.card .muted {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  flex-grow: 1;
}

/* Course cover for detail page */
.course-cover {
  margin: 24px 0;
  border-radius: 16px;
  overflow: hidden;
  background: #0a0a0a;
  height: 320px;
  border: 1px solid var(--line);
}

.course-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ==============================================
   Video Player & Playlist
   ============================================== */

.video-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  margin-top: 32px;
}

.player-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.player {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.player video {
  width: 100%;
  height: 520px;
  object-fit: contain;
  background: #000;
  display: block;
}

.video-info {
  padding: 0 4px;
}

.video-info .title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-bright);
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.video-info .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

/* Plyr.js Custom Styling */
.plyr {
  --plyr-color-main: #ef4444;
  --plyr-video-background: #000000;
  --plyr-menu-background: rgba(17, 17, 17, 0.95);
  --plyr-menu-color: #ededed;
  border-radius: 16px;
  overflow: hidden;
}

.plyr__control--overlaid {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  padding: 18px;
}

.plyr__control--overlaid:hover {
  background: linear-gradient(135deg, #dc2626, #ea580c);
}

.plyr__control--overlaid svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.plyr__menu__container {
  background: rgba(17, 17, 17, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.plyr__menu__container .plyr__control {
  color: var(--text);
}

.plyr__menu__container .plyr__control:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-bright);
}

.plyr__menu__container [role='menuitemradio'][aria-checked='true']::before {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.plyr__controls {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  padding: 20px;
}

.plyr__controls button,
.plyr__controls input[type='range'] {
  color: var(--text-bright);
}

.plyr__controls button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.plyr__progress__buffer {
  background: rgba(255, 255, 255, 0.2);
}

.plyr--video .plyr__control.plyr__tab-focus,
.plyr--video .plyr__control:hover,
.plyr--video .plyr__control[aria-expanded='true'] {
  background: rgba(239, 68, 68, 0.2);
  color: var(--text-bright);
}

.plyr__tooltip {
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-bright);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.plyr__time {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.plyr__volume {
  max-width: 90px;
}

/* Plyr Loading Spinner */
.plyr--loading .plyr__poster {
  background-color: #000;
}

.plyr__poster {
  background-size: cover;
  background-position: center;
}

.playlist {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  max-height: 600px;
  overflow-y: auto;
}

.playlist h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 16px 0;
}

.playlist ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.playlist li {
  border-bottom: 1px solid var(--line);
}

.playlist li:last-child {
  border-bottom: none;
}

.playlist li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  text-decoration: none;
  color: var(--text);
  border-radius: 8px;
  transition: var(--transition-fast);
  font-size: 14px;
}

.playlist li a:hover,
.playlist li.current a {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-bright);
}

.playlist li.current a {
  font-weight: 600;
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.playlist li.current a .playlist-title {
  color: var(--accent);
}

.playlist-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.playlist li.current .playlist-number {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

.playlist-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Custom scrollbar */
.playlist::-webkit-scrollbar {
  width: 8px;
}

.playlist::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.playlist::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.playlist::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==============================================
   Search Bar
   ============================================== */

.searchbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: var(--transition-base);
  min-width: 320px;
}

.searchbar:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.searchbar .search-icon {
  color: var(--muted);
  display: flex;
  align-items: center;
}

.searchbar .search-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.searchbar .search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-bright);
  font-size: 15px;
  padding: 4px 8px;
}

.searchbar .search-input::placeholder {
  color: var(--muted);
}

.searchbar .clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.searchbar .clear-btn.show {
  display: flex;
}

.searchbar .clear-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-bright);
}

.searchbar .clear-btn svg {
  width: 16px;
  height: 16px;
}

/* ==============================================
   Forms & Inputs
   ============================================== */

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.field input,
.field select,
.field textarea {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-bright);
  font-size: 15px;
  transition: var(--transition-base);
  font-family: inherit;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

fieldset.fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  background: rgba(255, 255, 255, 0.02);
}

fieldset.fieldset legend {
  padding: 0 12px;
  color: var(--text-bright);
  font-weight: 600;
  font-size: 16px;
}

.new-box {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  margin-top: 12px;
}

/* Upload form specific */
.upload-form {
  max-width: 960px;
  margin: 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 860px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.card-panel {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-head h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}

.card-head .icon {
  font-size: 24px;
}

.dropzone {
  position: relative;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition-base);
  cursor: pointer;
}

.dropzone:hover {
  border-color: var(--accent);
  background: rgba(239, 68, 68, 0.05);
}

.dropzone .file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone .drop-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
}

.dropzone .drop-label svg {
  width: 28px;
  height: 28px;
}

.dropzone .file-info {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

/* Stepper */
.stepper {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 24px 0 32px;
  flex-wrap: wrap;
}

.stepper .step {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-base);
}

.stepper .step .num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
}

.stepper .step.active {
  color: var(--text-bright);
  border-color: var(--line-hover);
  background: rgba(255, 255, 255, 0.05);
}

.stepper .step.active .num {
  border-color: var(--accent);
  color: var(--accent);
}

.stepper .step.done {
  color: var(--text-bright);
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--accent-border);
}

.stepper .step.done .num {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-color: transparent;
}

.page-head {
  margin-bottom: 24px;
}

.page-head h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-bright);
  margin: 0 0 8px 0;
}

.page-head .subtitle {
  color: var(--muted);
  font-size: 16px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.help {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ==============================================
   Documents List
   ============================================== */

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  transition: var(--transition-base);
}

.doc-link:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-hover);
  transform: translateX(4px);
}

.doc-icon {
  font-size: 24px;
  line-height: 1;
}

.doc-title {
  flex: 1;
  font-weight: 500;
  color: var(--text-bright);
}

.doc-meta {
  font-size: 13px;
  color: var(--muted);
}

.doc-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #0a0a0a;
}

/* ==============================================
   Modals
   ============================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.show,
.modal-backdrop[aria-hidden="false"] {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  width: min(480px, 92vw);
  max-width: 92vw;
  padding: 32px;
  position: relative;
  animation: modalSlideIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.modal .modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 20px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal .modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-bright);
  border-color: var(--line-hover);
}

.modal .modal-close:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.auth-modal .form-error {
  min-height: 24px;
  color: var(--accent);
  font-size: 14px;
  padding: 8px 0;
}

.auth-modal .muted {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  margin-top: 16px;
}

.auth-modal .muted .link {
  color: #3b82f6;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.auth-modal .muted .link:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ==============================================
   Admin Dashboard
   ============================================== */

.admin-tabs {
  display: flex;
  gap: 12px;
  margin: 20px 0 28px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}

.admin-tabs .tab {
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.admin-tabs .tab:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.05);
}

.admin-tabs .tab.active {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.05);
}

.admin-tabs .tab.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.admin-pane {
  animation: fadeIn 0.3s ease;
}

.admin-pane.hide {
  display: none;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
}

.table th,
.table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.table th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  color: var(--text-bright);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.table td .btn {
  margin-right: 8px;
  margin-bottom: 4px;
}

.table .role-select {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-bright);
  font-size: 14px;
}

.course-actions {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

#lessonsPanel {
  margin-top: 32px;
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* ==============================================
   Footer
   ============================================== */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0;
  background: var(--bg);
  margin-top: 60px;
}

.site-footer .cols {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.site-footer h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0;
}

.site-footer .muted {
  font-size: 14px;
  color: var(--muted);
}

.copy {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

/* ==============================================
   Utilities
   ============================================== */

.muted {
  color: var(--muted);
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
}

.hide {
  display: none !important;
}

/* ==============================================
   Responsive Design
   ============================================== */

/* Course content specific styles */
.course-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.content-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.video-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 16px 0 8px 0;
}

.content-block {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.content-block h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 16px 0;
}

.lesson-title {
  flex: 1;
}

.lesson-order {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
}

@media (max-width: 960px) {
  .video-layout {
    grid-template-columns: 1fr;
  }
  
  .playlist {
    max-height: 400px;
  }

  .player video {
    height: 360px;
  }
}

@media (max-width: 768px) {
  .header-inner {
    height: 60px;
    padding: 0 16px;
  }
  
  .nav-toggle {
    display: inline-flex;
  }
  
  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    padding: 20px;
    box-shadow: var(--shadow-lg);
  }
  
  .site-header.open .nav {
    display: flex;
    animation: slideDown 0.3s ease;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .nav a {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    width: 100%;
  }
  
  .nav a:last-child {
    border-bottom: none;
  }
  
  .nav a.active::after {
    display: none;
  }
  
  .container {
    padding: 0 16px;
  }
  
  .page {
    padding: 24px 0;
  }
  
  .section {
    padding: 32px 0;
  }
  
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .section-head h1,
  .section-head h2 {
    font-size: 28px;
  }
  
  .searchbar {
    width: 100%;
    min-width: 0;
  }
  
  .hero {
    padding: 60px 0;
  }
  
  .hero h1 {
    font-size: 36px;
  }
  
  .hero .muted {
    font-size: 16px;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .two-cols {
    grid-template-columns: 1fr;
  }
  
  .hero-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }
  
  .modal {
    padding: 24px;
  }
  
  .table-wrap {
    font-size: 14px;
  }
  
  .table th,
  .table td {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 28px;
  }
  
  .section-head h1,
  .section-head h2 {
    font-size: 24px;
  }
  
  .card .media {
    height: 180px;
  }
  
  .player video {
    height: 240px;
  }
}

/* ==============================================
   Smooth Scrollbars (Webkit)
   ============================================== */

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ==============================================
   Animations & Transitions
   ============================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Loading states */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

/* Focus states for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
