/* ===========================
   Happy Vet Course — Premium Design
   =========================== */
:root {
    --teal-50: #f0fdf9;
    --teal-100: #ccfbef;
    --teal-200: #99f6df;
    --teal-300: #5fe9cb;
    --teal-400: #2dd4b3;
    --teal-500: #14b89a;
    --teal-600: #0d947e;
    --teal-700: #0f7666;
    --teal-800: #115e53;
    --teal-900: #134e45;
    --warm-50: #fffbeb;
    --warm-200: #fde68a;
    --warm-300: #fcd34d;
    --warm-400: #fbbf24;
    --bg-dark: #1a2e2a;
    --bg-dark-lighter: #243d38;
    --bg-primary: #faf9f7;
    --bg-cream: #f5f0e8;
    --text-primary: #1a2e2a;
    --text-secondary: #4a6660;
    --text-muted: #7a948d;
    --font-serif: 'DM Serif Display', Georgia, serif;
    --font-sans: 'Inter', -apple-system, sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --sidebar-width: 280px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===========================
   Login Gate
   =========================== */
.login-gate {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(165deg, #0d3d35 0%, #0d947e 45%, #14b89a 70%, #2dd4b3 100%);
    padding: 1rem;
}
.login-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 3rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.login-logo { font-size: 3rem; margin-bottom: 0.5rem; }
.login-card h1 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}
.login-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}
.login-card input[type="email"] {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}
.login-card input[type="email"]:focus {
    outline: none;
    border-color: var(--teal-500);
}
.btn-login {
    width: 100%;
    padding: 0.85rem;
    background: var(--teal-600);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font-sans);
}
.btn-login:hover { background: var(--teal-700); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 1.2rem;
}
.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}
.btn-buy {
    display: block;
    padding: 0.85rem;
    background: var(--warm-400);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s;
}
.btn-buy:hover { background: var(--warm-300); }
.login-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 1rem;
}
.login-help a { color: var(--teal-600); }

/* ===========================
   Course App Layout
   =========================== */
.course-app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo {
    color: white;
    text-decoration: none;
    font-family: var(--font-serif);
    font-size: 1.1rem;
}
.sidebar-logo span { margin-left: 0.3rem; }
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
    cursor: pointer;
}
.sidebar-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    padding: 1rem 1.25rem;
    color: var(--teal-300);
    font-weight: 400;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.75rem;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    margin-bottom: 2px;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
}
.sidebar-nav a.active {
    background: rgba(45,212,179,0.15);
    color: var(--teal-300);
    font-weight: 500;
}
.sidebar-nav .nav-num {
    font-family: var(--font-serif);
    font-size: 0.9rem;
    min-width: 1.5rem;
    color: var(--teal-400);
    opacity: 0.6;
}
.sidebar-nav a.active .nav-num { opacity: 1; }
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sidebar-email {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-logout {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.5);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-family: var(--font-sans);
}
.sidebar-logout:hover {
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.8);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(250,249,247,0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.25rem;
}
.topbar-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    flex: 1;
}
.topbar-actions { display: flex; gap: 0.5rem; }
.btn-worksheet {
    background: var(--teal-50);
    color: var(--teal-700);
    border: 1px solid var(--teal-200);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}
.btn-worksheet:hover {
    background: var(--teal-100);
}

/* Module Content */
.module-content {
    flex: 1;
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem;
}
.module-header {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--teal-100);
}
.module-week-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--teal-600);
    margin-bottom: 0.5rem;
}
.module-title {
    font-family: var(--font-serif);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 0.75rem;
}
.module-intro {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Content blocks */
.content-block { margin-bottom: 2rem; }
.content-block p {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1rem;
}
.content-block strong { color: var(--text-primary); }
.content-block em { color: var(--teal-700); }
.content-block ul, .content-block ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}
.content-block li {
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Video embed */
.video-block {
    margin: 2rem 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: #000;
}
.video-block iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    display: block;
}
.video-label {
    background: var(--bg-dark);
    color: rgba(255,255,255,0.6);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Book recommendations */
.book-block {
    background: var(--warm-50);
    border: 1px solid var(--warm-200);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 2rem 0;
}
.book-block h4 {
    font-family: var(--font-serif);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}
.book-block ul { list-style: none; padding: 0; }
.book-block li {
    padding: 0.4rem 0 0.4rem 1.5rem;
    position: relative;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.book-block li::before {
    content: '📖';
    position: absolute;
    left: 0;
}

/* Callout */
.callout {
    background: linear-gradient(135deg, var(--teal-50), #f0fdf4);
    border-left: 4px solid var(--teal-500);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 1.5rem;
    margin: 2rem 0;
}
.callout p {
    font-size: 0.95rem !important;
    color: var(--teal-800) !important;
}

/* Module nav */
.module-nav {
    border-top: 1px solid rgba(0,0,0,0.06);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    max-width: 780px;
    margin: 0 auto;
    width: 100%;
}
.nav-btn {
    background: none;
    border: 1px solid var(--teal-300);
    color: var(--teal-700);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}
.nav-btn:hover {
    background: var(--teal-50);
}
.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ===========================
   Worksheet Modal
   =========================== */
.worksheet-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: white;
    overflow-y: auto;
}
.worksheet-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem;
}
.worksheet-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--teal-200);
}
.worksheet-toolbar h3 {
    font-family: var(--font-serif);
    font-size: 1.3rem;
}
.worksheet-toolbar div { display: flex; gap: 0.5rem; }
.btn-print {
    background: var(--teal-600);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
}
.btn-print:hover { background: var(--teal-700); }
.btn-close-ws {
    background: none;
    border: 1px solid #ddd;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-sans);
}
.worksheet-content h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    margin: 1.5rem 0 1rem;
    color: var(--text-primary);
}
.worksheet-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}
.worksheet-content .ws-question {
    border-bottom: 2px dotted #ccc;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    min-height: 3rem;
}
.worksheet-content .ws-answer-area {
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    min-height: 80px;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: block; }
    .module-content { padding: 2rem 1.25rem; }
    .topbar { padding: 0.75rem 1.25rem; }
}

/* ===========================
   Print Styles
   =========================== */
@media print {
    body * { visibility: hidden; }
    .worksheet-modal, .worksheet-modal * { visibility: visible; }
    .worksheet-modal {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
    }
    .worksheet-toolbar button { display: none; }
    .worksheet-content .ws-answer-area {
        border: 1px solid #999;
        min-height: 100px;
    }
}
