/* udemy-player.css - Premium Course Player Styles */
:root {
  --player-bg: #1c1d1f;
  --player-header-bg: #1c1d1f;
  --player-sidebar-bg: #f7f9fa;
  --player-border: #d1d7dc;
  --player-text: #1c1d1f;
  --player-text-light: #6a6f73;
  --player-accent: #2e7d31; /* ATM themed green */
  --player-accent-hover: #1b5e20;
  --player-accent-light: #e8f5e9;
  --player-white: #ffffff;
}

/* Reset for player */
.course-player-body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--player-white);
  color: var(--player-text);
  overflow-x: hidden;
}

/* Header */
.player-header {
  height: 56px;
  background-color: var(--player-header-bg);
  color: var(--player-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.player-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.brand-link {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-link i {
  color: #4caf50;
}

.divider {
  width: 1px;
  height: 24px;
  background-color: rgba(255,255,255,0.2);
}

.course-title-header {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-text {
  font-size: 13px;
  color: #d1d7dc;
}

.progress-bar-bg {
  width: 120px;
  height: 8px;
  background-color: rgba(255,255,255,0.2);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: #4caf50;
  width: 0%;
  transition: width 0.3s ease;
}

.btn-outline-light {
  color: #fff;
  border: 1px solid #fff;
  background: transparent;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-outline-light:hover {
  background: rgba(255,255,255,0.1);
}

/* Layout */
.player-layout {
  position: relative;
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* Paywall Overlay */
#paywall-overlay {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: none; /* JS controls visibility based on auth state */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(28, 29, 31, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  text-align: center;
  padding: 2rem;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.paywall-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  color: #ffd700;
}

.paywall-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.paywall-text {
  font-size: 1.1rem;
  max-width: 500px;
  margin-bottom: 2rem;
  line-height: 1.6;
  color: #d1d7dc;
}

.paywall-btn {
  background-color: var(--player-accent);
  color: white;
  border: none;
  padding: 12px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s;
  display: inline-block;
}

.paywall-btn i {
  margin-right: 8px;
}

.paywall-btn:hover {
  background-color: var(--player-accent-hover);
}

.player-main {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.player-sidebar {
  width: 380px;
  background-color: var(--player-white);
  border-left: 1px solid var(--player-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

/* Video Player */
.video-container {
  background-color: #000;
  width: 100%;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container video {
  width: 100%;
  height: 100%;
  max-height: 70vh;
}

/* Tabs */
.player-tabs-wrapper {
  border-bottom: 1px solid var(--player-border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
  padding: 0 24px;
}

.player-tabs {
  display: flex;
  gap: 32px;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 16px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--player-text-light);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--player-text);
}

.tab-btn.active {
  color: var(--player-text);
  border-bottom-color: var(--player-text);
}

/* Tab Content */
.tab-content-container {
  padding: 32px 24px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Overview Content */
.course-main-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.course-subtitle {
  font-size: 16px;
  color: var(--player-text-light);
  margin: 0 0 16px 0;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--player-text-light);
  margin-bottom: 32px;
}

.course-meta .rating {
  color: #b4690e;
  font-weight: 700;
}

.content-section {
  margin-bottom: 40px;
}

.content-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 16px 0;
  border-bottom: 1px solid var(--player-border);
  padding-bottom: 8px;
}

.content-section p, .content-section li {
  line-height: 1.6;
  font-size: 15px;
  margin-bottom: 12px;
  color: #333;
}

/* Objectives Grid */
.objectives-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--player-accent-light);
  padding: 24px;
  border-radius: 8px;
  border: 1px solid #c8e6c9;
}

.objective-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.objective-item i {
  color: var(--player-accent);
  margin-top: 3px;
}

/* Material Tab */
.material-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.pdf-container {
  width: 100%;
  height: 800px;
  border: 1px solid var(--player-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.pdf-viewer {
  width: 100%;
  height: 100%;
  border: none;
}

/* Sidebar */
.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--player-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.mobile-only {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

.accordion {
  overflow-y: auto;
  flex: 1;
}

.accordion-item {
  border-bottom: 1px solid var(--player-border);
}

.accordion-header {
  width: 100%;
  padding: 16px;
  background-color: var(--player-sidebar-bg);
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s;
}

.accordion-header:hover {
  background-color: #ebedf0;
}

.acc-title h4 {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--player-text);
}

.section-meta {
  font-size: 13px;
  color: var(--player-text-light);
}

.acc-icon {
  font-size: 12px;
  color: var(--player-text-light);
  transition: transform 0.3s;
}

.accordion-item.active .acc-icon {
  transform: rotate(-180deg);
}

.accordion-body {
  display: none;
  background: #fff;
}

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

.lesson-item {
  display: flex;
  padding: 12px 16px;
  gap: 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid #f0f0f0;
}

.lesson-item:last-child {
  border-bottom: none;
}

.lesson-item:hover {
  background-color: var(--player-sidebar-bg);
}

.lesson-item.playing {
  background-color: var(--player-accent-light);
}

.lesson-item.playing .lesson-title {
  font-weight: 600;
}

.lesson-check input {
  margin-top: 4px;
  cursor: pointer;
  accent-color: var(--player-accent);
}

.lesson-details {
  flex: 1;
}

.lesson-title {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--player-text);
  line-height: 1.4;
}

.lesson-meta {
  font-size: 12px;
  color: var(--player-text-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.quiz-item {
  background-color: #fafafa;
}

/* QA & Notes Tabs */
.qa-container, .notes-container {
  max-width: 600px;
}
.qa-header { margin-bottom: 24px; }
.qa-search {
  display: flex;
  border: 1px solid var(--player-border);
  border-radius: 4px;
  overflow: hidden;
}
.qa-search input {
  flex: 1;
  padding: 12px;
  border: none;
  outline: none;
}
.qa-search button {
  background: #2d2f31;
  color: white;
  border: none;
  padding: 0 16px;
  cursor: pointer;
}
.qa-empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed var(--player-border);
  border-radius: 8px;
}
.qa-empty-state i {
  font-size: 32px;
  color: var(--player-text-light);
  margin-bottom: 16px;
}

.create-note textarea {
  width: 100%;
  height: 120px;
  padding: 12px;
  border: 1px solid var(--player-border);
  border-radius: 4px;
  margin-bottom: 16px;
  font-family: inherit;
  resize: vertical;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE — TABLET (max 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .player-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .player-main {
    overflow-y: visible;
  }

  /* Sidebar becomes a fixed drawer from the right */
  .player-sidebar {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: 340px;
    z-index: 200;
    transform: translateX(100%);
    box-shadow: none;
    overflow-y: auto;
    border-left: 1px solid var(--player-border);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .player-sidebar.open {
    transform: translateX(0);
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  }

  /* Sidebar backdrop overlay */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    backdrop-filter: blur(2px);
  }
  .sidebar-backdrop.visible {
    display: block;
  }

  .mobile-only { display: block; }
  .objectives-grid { grid-template-columns: 1fr; }
  .course-title-header { display: none; }
}

/* ============================================================
   RESPONSIVE — MOBILE (max 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* ── Header ── */
  .player-header {
    padding: 0 12px;
    height: 52px;
  }
  .player-actions { gap: 8px; }
  .progress-container { display: none; }
  .btn-outline-light {
    padding: 5px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  .brand-logo-img { height: 30px; }

  /* ── Layout: stacked ── */
  .player-layout {
    height: auto;
    overflow: visible;
  }

  /* ── Sidebar becomes full-width bottom sheet ── */
  .player-sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 75vh;
    border-left: none;
    border-top: 1px solid var(--player-border);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .player-sidebar.open {
    transform: translateY(0);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
  }

  /* Drag handle indicator */
  .sidebar-header::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #d1d7dc;
    border-radius: 2px;
    margin: 0 auto 12px;
  }

  .sidebar-backdrop {
    z-index: 199;
  }

  /* ── Video: full bleed ── */
  .video-container {
    border-radius: 0;
    aspect-ratio: 16/9;
  }

  .video-container video {
    max-height: none;
  }

  /* ── Tabs: horizontal scroll ── */
  .player-tabs-wrapper {
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .player-tabs-wrapper::-webkit-scrollbar { display: none; }

  .player-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    padding: 0 8px;
    min-width: max-content;
    border-bottom: none;
  }

  .tab-btn {
    padding: 14px 16px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
  }

  /* ── Content ── */
  .tab-content-container {
    padding: 20px 16px;
  }

  .course-main-title { font-size: 1.3rem; line-height: 1.3; }
  .course-subtitle { font-size: 0.9rem; }
  .course-meta { flex-direction: column; gap: 8px; font-size: 13px; }
  .content-section h2 { font-size: 17px; }
  .content-section p, .content-section li { font-size: 14px; }

  /* objectives single column */
  .objectives-grid {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 12px;
  }
  .objective-item { font-size: 13px; }

  /* ── Paywall ── */
  #paywall-overlay {
    padding: 24px 20px;
  }
  .paywall-icon { font-size: 2.5rem; }
  .paywall-title { font-size: 1.3rem; }
  .paywall-text { font-size: 0.9rem; margin-bottom: 24px; padding: 0; }
  .paywall-btn { padding: 12px 24px; font-size: 0.95rem; }

  /* ── PDF container ── */
  .pdf-container { height: 500px; }

  /* ── Material header ── */
  .material-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* ── Notes / QA ── */
  .qa-container, .notes-container { max-width: 100%; }
  .create-note textarea { height: 100px; }
}

/* ============================================================
   RESPONSIVE — SMALL PHONES (max 480px)
   ============================================================ */
@media (max-width: 480px) {
  .player-header { padding: 0 10px; }
  .brand-logo-img { height: 26px; }
  .tab-btn { padding: 12px 12px; font-size: 12px; }
  .tab-btn i { display: none; } /* icon-only shown as text label on very small screens */
  .course-main-title { font-size: 1.15rem; }
  .paywall-btn { padding: 10px 20px; font-size: 0.88rem; }
  .player-sidebar { height: 80vh; }
}

/* ============================================================
   FLOATING ACTION BUTTON — Mobile Curriculum Toggle
   ============================================================ */
.fab-curriculum {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 198;
  background: var(--player-accent);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 14px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(46,125,49,0.45);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s;
  letter-spacing: 0.01em;
}

.fab-curriculum:hover {
  background: var(--player-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(46,125,49,0.55);
}

/* Only show FAB on tablet/mobile */
@media (min-width: 1025px) {
  .fab-curriculum { display: none !important; }
}

/* Logo image overrides */
.brand-logo-img { height: 36px; width: auto; object-fit: contain; }

/* Smooth scroll on mobile sidebar */
.player-sidebar, .accordion { -webkit-overflow-scrolling: touch; }
