/* ==========================================================================
   Mobile-First Clean Medical Course Theme
   ========================================================================== */

:root {
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;

  --primary: #0f766e;
  --primary-dark: #115e59;
  --primary-soft: #ccfbf1;

  --whatsapp: #16a34a;
  --whatsapp-dark: #15803d;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 25px rgba(15, 23, 42, 0.07);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 5px;
}

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 18px;
}

.container.narrow {
  max-width: 760px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
  text-align: center;
}

.btn:active {
  transform: translateY(1px);
}

.btn-sm {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 0.9rem;
}

.btn-lg {
  min-height: 50px;
  padding: 13px 22px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25);
}

.btn-whatsapp:hover {
  background: var(--whatsapp-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: #cbd5e1;
}

.btn-secondary:hover {
  background: var(--bg-alt);
  border-color: #94a3b8;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: #f0fdfa;
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Hero */
.hero {
  padding: 36px 0 44px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
}

.instructor-pill {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.85rem, 4.5vw, 2.75rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.hero-promise {
  margin: 0 0 18px;
  font-size: 1.08rem;
  color: var(--text-muted);
  max-width: 56ch;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 22px;
  font-size: 0.96rem;
  color: var(--text-muted);
}

.price-tag {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 4px 10px;
  border-radius: 6px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.payment-note {
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Hero Instructor Card */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-md);
  max-width: 340px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.photo-frame {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.instructor-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-card-caption {
  padding-top: 14px;
}

.instructor-name {
  margin: 0;
  font-weight: 700;
  font-size: 1.1rem;
}

.instructor-role {
  margin: 2px 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* Sections */
.section {
  padding: 44px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

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

.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 6px;
}

.section h2 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 3.2vw, 1.9rem);
  line-height: 1.25;
}

.section-desc {
  margin: 0;
  color: var(--text-muted);
}

/* About Me */
.about-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.about-avatar {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-soft);
  flex-shrink: 0;
}

.about-card h3 {
  margin: 0 0 2px;
  font-size: 1.15rem;
}

.about-subtitle {
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.92rem;
}

.about-card p:last-child {
  margin: 0;
  color: var(--text-muted);
}

/* Learn Grid */
.learn-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.info-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.info-card h3 {
  margin: 0 0 6px;
  font-size: 1.06rem;
}

.info-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Lesson List */
.chapters-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chapter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chapter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.chapter-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chapter-header h3 {
  margin: 2px 0 0;
  font-size: 1.1rem;
}

.chapter-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.lesson-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.lesson-item:first-child {
  border-top: none;
}

.lesson-title {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.lesson-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.lesson-lock {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Pricing Box */
.pricing-box {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  box-shadow: var(--shadow-md);
}

.pricing-top {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.big-price {
  margin: 12px 0 6px;
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.big-price .currency {
  font-size: 1.6rem;
  vertical-align: top;
  margin-right: 2px;
}

.big-price .price-unit {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
}

.pricing-sub {
  margin: 0;
  color: var(--text-muted);
}

.enroll-steps {
  margin: 20px 0 24px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--text-muted);
}

.enroll-steps strong {
  color: var(--text);
}

.pricing-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 18px;
  box-shadow: var(--shadow-sm);
}

.faq-item summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  font-size: 1.02rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--primary);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.96rem;
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 26px 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-brand {
  margin: 0;
  font-weight: 700;
}

.footer-sub {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-weight: 600;
  color: var(--primary);
  font-size: 0.95rem;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* Modal */
.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  max-width: 420px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.modal-card p {
  margin: 0 0 18px;
  color: var(--text-muted);
}

/* Tablet & Desktop Enhancements */
@media (min-width: 640px) {
  .hero-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .about-card {
    flex-direction: row;
    align-items: flex-start;
  }

  .learn-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pricing-box {
    padding: 32px;
  }

  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 820px) {
  .hero {
    padding: 58px 0 64px;
  }

  .hero-grid {
    grid-template-columns: 1.35fr 0.9fr;
    gap: 44px;
  }
}

/* Ensure HTML hidden attribute always hides elements cleanly */
[hidden] {
  display: none !important;
}

/* ==========================================================================
   Auth Pages (Login & Password Reset)
   ========================================================================== */

.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 32px 0 48px;
}

.auth-container {
  max-width: 460px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 20px;
  box-shadow: var(--shadow-md);
}

.auth-head {
  margin-bottom: 20px;
}

.auth-head h1 {
  margin: 0 0 6px;
  font-size: 1.65rem;
  line-height: 1.25;
}

.auth-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
}

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

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

.form-group label {
  font-weight: 600;
  font-size: 0.93rem;
}

.form-group input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 68px;
}

.toggle-pw-btn {
  position: absolute;
  right: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-pw-btn:hover {
  color: var(--text);
}

.auth-links {
  margin-top: 14px;
  text-align: center;
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  padding: 6px 8px;
}

.text-link-btn:hover {
  text-decoration: underline;
}

.auth-footer-note {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.auth-footer-note p {
  margin: 0;
}

.auth-footer-note a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

/* Alerts */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

/* ==========================================================================
   Classroom Page (Stage 2)
   ========================================================================== */

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.classroom-main {
  flex: 1;
  padding: 32px 0 56px;
}

.classroom-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
}

.locked-card h1 {
  margin: 10px 0 8px;
  font-size: 1.55rem;
}

.locked-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.classroom-muted {
  color: var(--text-muted);
  margin: 4px 0 0;
}

.classroom-welcome {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.classroom-welcome h1 {
  margin: 8px 0 2px;
  font-size: 1.55rem;
  line-height: 1.25;
}

.status-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
}

.badge-enrolled {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-admin {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.badge-locked {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.progress-summary {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
  align-self: flex-start;
}

.progress-count {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.progress-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stage-notice {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  color: #134e4a;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.93rem;
  margin-bottom: 20px;
}

.classroom-lesson-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.lesson-info {
  width: 100%;
}

.lesson-video-note {
  margin: 4px 0 0 40px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.complete-btn.is-completed {
  background: #ecfdf5;
  color: #065f46;
  border-color: #6ee7b7;
}

@media (min-width: 640px) {
  .auth-card {
    padding: 32px 28px;
  }

  .classroom-welcome {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .classroom-lesson-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ==========================================================================
   Stage 3: Classroom Video Player, Progress Bar & Lesson Selector
   ========================================================================== */

.course-progress-box {
  width: 100%;
  max-width: 340px;
}

.course-progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  flex-wrap: wrap;
}

.progress-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.progress-track {
  width: 100%;
  height: 11px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #14b8a6);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.classroom-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.player-head {
  margin-bottom: 14px;
}

.player-head h2 {
  margin: 4px 0 4px;
  font-size: 1.3rem;
  line-height: 1.3;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #e2e8f0;
  font-size: 0.98rem;
}

.video-placeholder p {
  margin: 0;
  max-width: 44ch;
  line-height: 1.5;
}

.player-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.lesson-nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.video-security-note {
  margin: 12px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.curriculum-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.curriculum-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.lesson-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.lesson-select-btn:first-child {
  border-top: none;
}

.lesson-select-btn:hover {
  background: #f8fafc;
}

.lesson-select-btn.is-active {
  background: #f0fdfa;
  box-shadow: inset 3px 0 0 var(--primary);
}

.lesson-select-name {
  font-weight: 500;
}

.lesson-select-btn.is-active .lesson-select-name {
  font-weight: 700;
  color: var(--primary-dark);
}

.lesson-num.is-done {
  background: #dcfce7;
  color: #166534;
}

.lesson-playing-pill {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .player-card {
    padding: 22px;
  }

  .player-toolbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 900px) {
  .classroom-layout {
    grid-template-columns: 1.45fr 0.95fr;
    gap: 24px;
  }
}

/* ==========================================================================
   Stage 4: Admin Panel (Mobile-First)
   ========================================================================== */

.btn-xs {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.82rem;
}

.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.admin-tabs {
  display: inline-flex;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  align-self: flex-start;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

.tab-btn.is-active {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.admin-panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.admin-panel-card h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.admin-form {
  margin-top: 16px;
}

.panel-header-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-family: inherit;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.student-top-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.student-meta {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  word-break: break-word;
}

.student-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.add-chapter-card {
  margin-bottom: 20px;
}

.inline-add-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
  align-items: end;
}

.admin-chapter-header {
  flex-wrap: wrap;
}

.admin-row-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-lesson-wrap {
  border-top: 1px solid var(--border);
}

.admin-lesson-wrap:first-child {
  border-top: none;
}

.admin-lesson-row {
  border-top: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.video-ok {
  color: #065f46;
}

.inline-edit-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

.inline-edit-box input[type="text"],
.chapter-select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-family: inherit;
  background: var(--surface);
}

.mini-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: -4px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  cursor: pointer;
}

.inline-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (min-width: 640px) {
  .panel-header-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .search-input {
    max-width: 240px;
  }

  .student-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .admin-lesson-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .inline-add-form {
    grid-template-columns: 1fr 1fr auto;
  }
}

@media (min-width: 900px) {
  .admin-grid {
    grid-template-columns: 0.95fr 1.25fr;
    gap: 24px;
  }
}
