/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Plus Jakarta Sans', sans-serif; background: #fff; color: #253655; overflow: hidden; }
a, button { cursor: pointer; text-decoration: none; border: none; background: none; font: inherit; color: inherit; }
input { font: inherit; outline: none; }
img { display: block; max-width: 100%; }

/* --- PREMIUM DOWNLOAD BUTTON --- */
.premium-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--navy-700);
  color: #ffffff !important;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
  border: 1px solid transparent;
}

.premium-download-btn:hover {
  background-color: #24497c;
  color: #f8fafc !important;
}

:root {
  --navy: #12233F;
  --navy-800: #1A4072;
  --navy-700: #1A365D;
  --gold: #D4AF37;
  --anzac-400: #D4AF37;
  --gold-50: #FBF8EB;
  --gold-600: #A57B22;
  --gold-700: #825C1E;
  --blue: #2F78C8;
  --h-900: #253655;
  --h-800: #273E65;
  --muted-300: #D1D5DB;
  --muted-400: #9CA3AF;
  --muted-500: #6B7280;
  --gray-50: #F5F7FA;
  --gray-100: #EBEEF3;
  --gray-200: #D2D9E5;
  --haze: #F7FAFC;
  --base-50: #F9FAFB;
  --sidebar-w: 280px;
}

.page { display: none; height: 100vh; overflow: hidden; }
.page.active { display: flex; }

.auth { width: 100%; align-items: stretch; }

.auth__brand {
  width: 50%; background: var(--navy); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 64px; overflow: hidden; flex-shrink: 0;
}
.auth__logo {
  display: flex; gap: 20px; align-items: center; opacity: .7; padding-bottom: 56px;
}
.auth__logo-img { width: 87px; height: 87px; object-fit: contain; }
.auth__logo-name {
  display: flex; flex-direction: column; align-items: center; font-family: 'Montserrat', sans-serif;
  color: #fff; text-align: center; line-height: 1.2;
}
.auth__logo-name strong { font-size: 45px; font-weight: 700; }
.auth__logo-name span { font-size: 32px; font-weight: 500; }
.auth__quote {
  font-style: italic; font-size: 24px; line-height: 1.3; color: #F3F4F6; max-width: 400px;
}
.auth__author {
  font-style: italic; font-size: 24px; line-height: 1.3; color: var(--gold); margin-top: 24px;
  max-width: 400px;
}

.auth__form-wrap {
  width: 50%; background: var(--base-50); display: flex; align-items: center; justify-content: center;
  overflow-y: auto; padding: 32px;
}
.auth__form {
  width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 40px;
}
.auth__header { text-align: center; }
.auth__title { font-size: 32px; font-weight: 700; color: var(--h-900); line-height: 1.2; margin-bottom: 8px; }
.auth__sub { font-size: 16px; color: var(--muted-500); }

.fields { display: flex; flex-direction: column; gap: 24px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 24px; font-weight: 600; color: var(--h-800); letter-spacing: .02em; line-height: 1.3; }
.field__label--sm { font-size: 14px; font-weight: 600; color: var(--h-800); letter-spacing: 0; }
.field__input {
  height: 56px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 0 16px; font-size: 14px; font-weight: 500; color: #111827; width: 100%; transition: border-color .15s;
}
.field__input::placeholder { color: var(--muted-400); }
.field__input:focus { border-color: var(--blue); }
.field__hint { font-size: 14px; font-weight: 500; color: var(--blue); text-align: right; }

.btn-gold {
  display: flex; align-items: center; justify-content: center; height: 56px; width: 100%;
  background: var(--gold); border-radius: 12px; font-size: 16px; font-weight: 700; color: var(--navy);
  transition: opacity .15s;
}
.btn-gold:hover { opacity: .88; }
.auth__link { font-size: 16px; color: var(--muted-500); text-align: center; }
.auth__link a { color: var(--blue); font-weight: 500; }
.auth__bottom { display: flex; flex-direction: column; gap: 24px; padding-top: 8px; }

.app { width: 100%; align-items: stretch; }

.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--navy); display: flex;
  flex-direction: column; padding: 32px 24px; gap: 10px; overflow: hidden; transition: transform .25s ease;
  position: relative; z-index: 10;
}
.sidebar__logo {
  display: flex; gap: 7px; align-items: center; justify-content: center; opacity: .7; padding-bottom: 17px;
}
.sidebar__logo-img { width: 31px; height: 31px; object-fit: contain; }
.sidebar__logo-name {
  display: flex; flex-direction: column; align-items: center; font-family: 'Montserrat', sans-serif;
  color: #fff; text-align: center; line-height: 1.15;
}
.sidebar__logo-name strong { font-size: 16px; font-weight: 700; }
.sidebar__logo-name span { font-size: 11px; font-weight: 500; }

.nav-links { display: flex; flex-direction: column; gap: 16px; }
.nav-link {
  display: flex; align-items: center; justify-content: center; padding: 14px 12px; border-radius: 8px;
  font-size: 15px; font-weight: 600; color: var(--muted-300); text-align: center; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.06); }
.nav-link.active { background: var(--navy-800); color: var(--gold); }

.sidebar__bottom { display: flex; flex-direction: column; gap: 16px; margin-top: auto; }
.sidebar__user { display: flex; gap: 16px; align-items: center; }
.sidebar__avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.sidebar__username { font-size: 17px; font-weight: 600; color: var(--muted-300); }
.sidebar__signout {
  display: flex; align-items: center; justify-content: center; padding: 14px 12px; border-radius: 8px;
  font-size: 15px; font-weight: 600; color: var(--muted-300); text-align: center;
}
.sidebar__signout:hover { background: rgba(255,255,255,.06); }

.hamburger { display: none; flex-direction: column; gap: 5px; padding: 8px; background: none; }
.hamburger span { display: block; width: 22px; height: 2px; background: var(--h-900); border-radius: 2px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9; }

.main {
  flex: 1; background: var(--haze); overflow-y: auto; padding: 40px 48px; display: flex; flex-direction: column;
}

.app-header {
  display: flex; align-items: center; justify-content: space-between; padding-bottom: 32px;
}
.app-header__title { font-size: 24px; font-weight: 600; color: var(--h-900); }
.app-header__icons { display: flex; gap: 24px; align-items: center; }
.icon-btn { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }

.progress-card { background: var(--navy-700); border-radius: 16px; padding: 28px 32px; margin-bottom: 40px; }
.progress-card__title { font-size: 18px; font-weight: 600; color: #fff; margin-bottom: 8px; }
.progress-card__label { font-size: 12px; color: var(--gold-50); margin-bottom: 12px; }
.progress-track { height: 8px; background: var(--navy); border-radius: 1000px; overflow: hidden; }
.progress-bar { height: 8px; background: var(--gold); border-radius: 1000px; width: 30%; }

.section-heading { font-size: 20px; font-weight: 700; color: var(--h-900); margin-bottom: 24px; }

.weeks { display: flex; flex-direction: column; gap: 24px; align-items: stretch; }
.week-card {
  background: #fff; border: 1px solid var(--gray-100); border-radius: 16px; padding: 24px;
  width: 100%; max-width: 100%;
}
.week-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 16px; }
.week-card__name { font-size: 16px; font-weight: 700; color: var(--navy-700); }
.week-card__name--locked { color: var(--muted-400); }
.badge-unlocked {
  background: var(--gold-50); border-radius: 114px; padding: 8px 16px; font-size: 16px; font-weight: 600; color: var(--gold-600);
}
.badge-locked {
  background: var(--gold-50); border-radius: 4px; padding: 12px; display: flex; align-items: center; justify-content: center;
}

.video-rows { display: flex; flex-direction: column; gap: 12px; }
.video-row { background: var(--gray-50); border-radius: 8px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.video-row__left { display: flex; gap: 16px; align-items: center; flex: 1; min-width: 0; }
.video-row__title { font-size: 16px; font-weight: 600; color: var(--navy-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-row__dur { font-size: 16px; font-weight: 600; color: var(--navy-700); flex-shrink: 0; margin-left: 8px; }
.video-row__action-done { font-size: 16px; font-weight: 600; color: var(--gold-700); }
.video-row__action-watch { font-size: 16px; font-weight: 600; color: var(--blue); white-space: nowrap; flex-shrink: 0; }
.video-row__action-watch:hover { text-decoration: underline; }

.video-layout { display: flex; gap: 40px; height: 100%; align-items: flex-start; }
.video-main { flex: 0 0 auto; width: min(700px, 100%); display: flex; flex-direction: column; }
.back-link { font-size: 16px; font-weight: 600; color: var(--blue); margin-bottom: 24px; display: inline-block; }
.back-link:hover { text-decoration: underline; }
.video-player { background: var(--navy); border-radius: 12px; height: 400px; margin-bottom: 24px; display: flex; align-items: center; justify-content: center; }
.video-player__placeholder { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; }
.video-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.video-meta__title { font-size: 24px; font-weight: 600; color: #111827; }
.btn-complete { background: var(--gold); border-radius: 8px; padding: 12px 24px; font-size: 14px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.btn-complete:hover { opacity: .88; }
.video-tabs { display: flex; gap: 24px; margin-bottom: 24px; }
.video-tab { font-size: 20px; font-weight: 600; color: var(--muted-400); }
.video-tab.active { color: #C39C2B; }
.video-desc { font-size: 16px; font-weight: 600; color: var(--navy-700); line-height: 1.5; }

.content-panel {
  flex: 1; min-width: 0; background: #fff; border: 1px solid var(--gray-100); border-radius: 16px; padding: 24px;
  display: flex; flex-direction: column; max-height: calc(100vh - 80px); overflow-y: auto;
}
.content-panel__heading { font-size: 18px; font-weight: 700; color: var(--h-900); margin-bottom: 24px; }
.content-list { display: flex; flex-direction: column; gap: 12px; }
.content-item { display: flex; align-items: center; justify-content: space-between; padding: 12px; border-radius: 8px; }
.content-item.active-item { background: var(--navy-700); }
.content-item.active-item .content-item__title { color: var(--base-50); }
.content-item__title { font-size: 20px; font-weight: 600; color: var(--h-800); }

.page-title { font-size: 24px; font-weight: 700; color: var(--h-900); margin-bottom: 4px; }
.page-sub { font-size: 14px; font-weight: 600; color: var(--muted-500); margin-bottom: 40px; }
.tasks-heading { font-size: 20px; font-weight: 600; color: var(--h-900); margin-bottom: 24px; }
.tasks { display: flex; flex-direction: column; gap: 24px; margin-bottom: 40px; }
.task-card {
  background: #fff; border: 1px solid var(--gray-100); border-radius: 16px; padding: 24px;
  display: flex; align-items: stretch; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.task-left { display: flex; flex-direction: column; gap: 12px; }
.task-week {
  display: inline-block; background: var(--gray-100); border-radius: 4px; padding: 8px 12px; font-size: 16px; font-weight: 500; color: var(--navy-700);
}
.task-name { font-size: 16px; font-weight: 700; color: var(--h-900); }
.task-desc { font-size: 14px; font-weight: 700; color: var(--muted-500); }
.task-right { display: flex; align-items: center; justify-content: center; gap: 16px; flex-shrink: 0; }
.status-submitted { display: flex; gap: 6px; align-items: center; padding: 12px; font-size: 16px; font-weight: 500; color: var(--gold); }
.task-input {
  background: var(--gray-50); border: none; border-radius: 8px; height: 36px; padding: 0 16px; font-size: 16px; font-weight: 700; color: var(--h-900); min-width: 200px;
}
.task-input::placeholder { color: var(--muted-400); }
.btn-submit { background: var(--gold); border-radius: 8px; padding: 12px; font-size: 16px; font-weight: 500; color: var(--navy-700); white-space: nowrap; }
.btn-submit:hover { opacity: .88; }

.resources-heading { font-size: 20px; font-weight: 600; color: var(--h-900); margin-bottom: 24px; margin-top: 48px; }
.resource-cards { display: flex; gap: 24px; flex-wrap: wrap; }
.resource-card {
  flex: 1; min-width: 180px; background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: 12px; padding: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.resource-card__left { display: flex; gap: 16px; align-items: center; }
.resource-card__name { font-size: 14px; font-weight: 500; color: var(--h-800); }
.resource-card button[aria-label="Download"] {
  width: 40px; height: 40px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, transform .15s ease;
}
.resource-card button[aria-label="Download"]:hover {
  background: var(--anzac-400);
  transform: translateY(-1px);
}
.resource-card button[aria-label="Download"] svg {
  transition: stroke .15s ease;
}
.resource-card button[aria-label="Download"]:hover svg {
  stroke: #fff;
}

.settings-cards { display: flex; flex-direction: column; gap: 32px; max-width: 720px; }
.settings-card { background: #fff; border: 1px solid var(--gray-100); border-radius: 16px; padding: 32px; }
.settings-card__heading { font-size: 18px; font-weight: 600; color: var(--h-900); margin-bottom: 24px; }
.avatar-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.avatar-row__img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.avatar-row__btns { display: flex; gap: 16px; align-items: center; }
.btn-text-gold { font-size: 16px; font-weight: 600; color: var(--gold); }
.btn-text-muted { font-size: 16px; font-weight: 600; color: var(--muted-400); }
.name-row { display: flex; gap: 16px; }
.name-row .field { flex: 1; }
.save-row { display: flex; justify-content: flex-end; padding-top: 24px; }
.btn-save { background: var(--gold); border-radius: 8px; height: 48px; padding: 0 16px; font-size: 16px; font-weight: 700; color: var(--navy); }
.btn-save:hover { opacity: .88; }

.icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

@media (max-width: 900px) {
  .auth { flex-direction: column; overflow-y: auto; height: auto; min-height: 100vh; }
  .auth__brand { width: 100%; padding: 40px 32px; min-height: auto; }
  .auth__logo { padding-bottom: 24px; }
  .auth__quote, .auth__author { font-size: 18px; }
  .auth__form-wrap { width: 100%; padding: 32px 24px; }

  .app { flex-direction: column; position: relative; }
  .hamburger { display: flex; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100%; transform: translateX(-100%); z-index: 20; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { padding: 16px 16px 80px; }

  .app-header { padding-bottom: 20px; }
  .video-layout { flex-direction: column; }
  .video-main { width: 100%; }
  .content-panel { max-height: none; }
  .resource-cards { flex-direction: column; }
  .name-row { flex-direction: column; gap: 16px; }
  .task-card { flex-direction: column; }
  .task-right { justify-content: flex-start; }
  .task-input { min-width: 0; width: 100%; }
  .settings-cards { max-width: 100%; }
}

@media (max-width: 600px) {
  .auth__logo-name strong { font-size: 28px; }
  .auth__logo-name span { font-size: 20px; }
  .field__label { font-size: 16px; }
  .video-layout { gap: 24px; }
  .video-player { height: 220px; }
  .video-meta__title { font-size: 18px; }
  .video-tab { font-size: 16px; }
}

/* 📱 MOBILE & TABLET BREAKPOINT */
@media (max-width: 768px) {

    /* 1. Force the parent container holding BOTH the video and playlist to stack */
    /* Note: If your container in video.html has a different class, apply flex-direction: column to it! */
    .video-page-layout, 
    .video-content-wrapper,
    .video-layout {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
    }

    /* 2. Smash the Desktop constraints on the Playlist (The Yellow Circle) */
    .video-playlist-sidebar,
    #playlist-container {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important; /* Stops it from acting like a rigid desktop sidebar */
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin-left: 0 !important; /* Removes any desktop spacing */
        box-sizing: border-box !important;
    }

    /* 3. Nuke internal scrolling on any child divs inside the playlist */
    .video-playlist-sidebar *,
    #playlist-container * {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* Playlist item helper classes (used to remove inline styles from JS) */
.content-item__left { display: flex; align-items: center; gap: 12px; }
.content-item__link {
  display:flex; align-items:center; gap:12px; text-decoration:none; color: var(--h-800);
  background:none; border:none; text-align:left; font-size:20px; font-weight:600;
}

.mobile-topbar {
  display: none; align-items: center; justify-content: space-between; padding: 16px; background: #fff;
  border-bottom: 1px solid var(--gray-100); position: sticky; top: 0; z-index: 5; flex-shrink: 0;
}
@media (max-width: 900px) { .mobile-topbar { display: flex; } }
.mobile-topbar__logo { font-family: 'Montserrat', sans-serif; font-size: 16px; font-weight: 700; color: var(--navy); }

/* 📱 TABLET & MOBILE GLOBAL SCROLL FIX */
@media (max-width: 1024px) {
    /* 1. Release the body wrapper */
    body, html {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        display: block !important; /* Breaks rigid flex layouts on the body */
    }
    
    /* 2. Release your main layout containers */
    .main-content, 
    .auth-container, 
    .app-wrapper {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
    }
}

/* Fix Assignment Tab Overlap */
.task-actions {
    display: flex;
    flex-direction: column;
    gap: 20px; /* Forces a standard 20px gap between the input and button */
}

/* Fallback margin just in case */
.task-actions input[type="url"],
.task-actions input[type="text"] {
    margin-bottom: 20px !important;
}
