/* --- Base Styles Provided By You --- */

/* General Body Styles */
body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    margin: 0;
    padding-top: 70px;
    /* Reduced space */
    padding-bottom: var(--footer-height-mobile);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;

    /* Security: Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow selection in inputs and textareas only */
input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Header Banner (Premium Glassmorphism) */
.main-header {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    padding: 0 var(--space-4);
    height: 64px;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#site-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--primary-600);
}



/* User Pill (Profile Badge) */
.user-pill {
    position: absolute;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Main Content Container */
.container {
    max-width: 1100px;
    margin: var(--space-8) auto;
    padding: 0 var(--space-4);
}

/* Page Header Navigation */
.page-header-nav {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: var(--space-3) !important;
    margin: 0 0 var(--space-6) !important;
    width: 100% !important;
}


#nav-container {
    display: flex !important;
    align-items: center !important;
}

/* Page Title - Modern Compact Glass */
.page-title {
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--primary-600) !important;
    padding: 0 var(--space-4) !important;
    border-radius: var(--radius-full) !important;
    box-shadow: var(--shadow-sm) !important;
    border: 1px solid var(--primary-100) !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    flex-grow: 1 !important;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 40px !important;
    min-width: 0 !important;
}


/* Ensure Back Link matches alignment */
.back-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 16px !important;
    background: white !important;
    border: 2px solid var(--secondary-color) !important;
    color: var(--secondary-color) !important;
    border-radius: 50px !important;
    text-decoration: none !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    height: 36px !important;
    /* Match title height perfectly */
    margin: 0 !important;
    transition: all 0.2s !important;
}

.back-link:hover {
    background: var(--secondary-color);
    color: white;
}

/* Unified Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

/* Unified Card Style */
.card {
    background-color: var(--card-background-color);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.07);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 2px solid var(--primary-color);
    text-align: center;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    position: relative;
    /* Essential for visual identity system */
    overflow: hidden;
    /* Keeps watermarks inside */
}

/* --- Card Styles (Locked State) --- */
.card.locked {
    opacity: 0.7;
    filter: grayscale(0.8);
    cursor: not-allowed;
    position: relative;
    background: #f1f5f9;
}

.card.locked:hover {
    transform: none;
    box-shadow: none;
}

.card.locked::after {
    content: '🔒';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.2rem;
    opacity: 0.8;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.card h2 {
    margin: 0;
    font-size: 1.3em;
    color: inherit;
    position: relative;
    /* Ensures title is above watermarks */
    z-index: 2;
}

/* Toolbar for buttons */
.toolbar {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Footer */
.main-footer {
    background-color: var(--footer-background-color);
    color: var(--text-color-light);
    padding: 15px 0;
    text-align: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    font-size: 0.9em;
    border-top: 1px solid var(--border-color);
}

/* --- Visual Identity System (Merged) --- */

/* Base style for icons/tags */
.card h2::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 10px;
    font-size: 0.9em;
}

.card.card--lesson h2::before {
    content: "\f518";
    /* book-open */
}

/* Quiz Card Identity */
.card.card--quiz {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.card.card--quiz h2::before {
    content: "MCQs";
    font-family: 'Segoe UI', sans-serif;
    font-weight: 700;
    padding: 3px 8px;
    border: 2px solid white;
    border-radius: 6px;
    font-size: 0.7em;
    vertical-align: middle;
    margin-right: 12px;
}

/* Flashcards Deck Identity */
.card.card--flashcards {
    background-color: var(--card-flashcards);
    color: white;
    border-color: var(--card-flashcards);
}

.card.card--flashcards h2::before {
    content: "\f24d";
    /* clone */
}

/* Google Form Card Identity */
.card.card--google-form {
    background-color: var(--card-google-form);
    /* A distinct green */
    color: white;
    border-color: var(--card-google-form);
}

.card.card--google-form h2::before {
    content: "\f1c3";
    /* file-alt */
}

/* Document/PDF Card Identity */
.card.card--document {
    background-color: #e55039;
    color: white;
    border-color: #e55039;
}

.card.card--document h2::before {
    content: "\f1c1";
    /* file-pdf */
}

/* Watermark Styles */
.card.card--quiz::after,
.card.card--flashcards::after {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-20deg);
    font-size: 5rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.1);
    z-index: 1;
    pointer-events: none;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.card.card--quiz::after {
    content: "MCQS";
}

.card.card--flashcards::after {
    content: "CARDS";
}

/* ========================================= */
/* ===== STYLES FOR VIDEO CARDS        ===== */
/* ========================================= */

.card--video {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card--video:hover .video-card__thumbnail img {
    transform: scale(1.05);
}

.video-card__thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #e0e0e0;
    /* Placeholder color */
}

.video-card__thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card__play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background-color 0.2s ease;
}

.card--video:hover .video-card__play-icon {
    background-color: var(--primary-color);
}

.video-card__play-icon svg {
    width: 28px;
    height: 28px;
    margin-left: 3px;
    /* Optical alignment */
}

.video-card__title {
    padding: 1rem;
    margin: 0;
    font-size: 1.1rem;
    flex-grow: 1;
    /* Ensures title area fills space */
}

/* --- User Authentication Styles --- */
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 5px 10px;
    border-radius: 50px;
    transition: background-color 0.3s;
}

.user-pill:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.login-btn {
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 4px 12px;
    /* Ultra-compact padding */
    border-radius: 50px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    /* Tighter gap */
    transition: all 0.3s ease;
    font-size: 0.85rem;
    /* Slightly smaller font */
}

.login-btn .fa-google {
    color: white;
    /* More elegant than multicolored in a glass button */
    font-size: 0.9em;
}

.login-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
}

.user-name {
    font-weight: 600;
    font-size: 0.9em;
}

.logout-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.8em;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.logout-btn:hover {
    opacity: 1;
}

/* --- Lesson Completion Styles --- */
.card.completed {
    border-color: var(--success-color);
    /* Green border for completed items */
    background-color: var(--success-bg);
}

.completion-checkmark {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5em;
    color: var(--success-color);
    display: none;
    /* Hidden by default */
}

.card.completed .completion-checkmark {
    display: block;
}

/* --- Completion Button Styles --- */
.completion-button-container {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.mark-complete-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.mark-complete-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.mark-complete-btn.completed {
    background-color: var(--success-color);
    cursor: default;
}

.mark-complete-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ========================================= */
/* ===== MOBILE APP-LIKE EXPERIENCE    ===== */
/* ========================================= */

@media (max-width: 480px) {

    /* --- 1. Compact Header & Navigation --- */
    .main-header {
        padding: 10px 15px;
        height: var(--header-height-mobile);
        /* Fixed height control */
        box-sizing: border-box;
        /* Ensure padding is included in height */
    }

    .main-header h1 {
        font-size: 1rem;
        /* Scaled down title */
    }

    body {
        padding-top: var(--header-height-mobile);
        padding-bottom: var(--footer-height-mobile);
    }

    /* Hide user name to save space, keep avatar */
    .user-name {
        display: none;
    }

    .login-btn {
        padding: 2px 8px;
        /* Absolute minimum on mobile */
        font-size: 0.75rem;
    }

    /* --- 2. Typography & Spacing --- */
    .container {
        padding: 0 15px;
        margin-top: 20px;
        margin-bottom: 30px;
    }

    .page-title {
        font-size: 1rem;
        height: 36px;
        padding: 5px 15px;
    }

    .page-header-nav {
        gap: 8px;
        margin-bottom: 15px;
    }

    .back-link {
        font-size: 0.8rem;
        padding: 5px 12px;
        height: 36px;
    }

    /* --- 3. App-like Cards --- */
    .card-grid {
        grid-template-columns: 1fr;
        /* Single column on phones */
        gap: 15px;
    }

    .card {
        padding: 15px;
        border-radius: var(--radius-app);
        /* Softer corners */
        box-shadow: var(--shadow-sm);
        /* Subtler shadow */
    }

    .card h2 {
        font-size: 1rem;
    }

    /* Adjust icon size */
    .card h2::before {
        font-size: 0.8em;
    }

    /* --- 4. Interactive Feedback (Touch) --- */
    .card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
        background-color: var(--primary-50);
        /* Slight highlight */
    }

    /* --- 5. Footer Adjustments --- */
    .main-footer {
        height: var(--footer-height-mobile);
        box-sizing: border-box;
    }
}


/* --- Welcome Hero Styles --- */
.welcome-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80vh;
    padding: 20px;
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.5), rgba(224, 231, 255, 0.5));
}

.hero-content {
    max-width: 600px;
    animation: fadeInUp 0.8s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    line-height: 1.2;
    text-align: center;
}

.hero-title .highlight {
    color: var(--primary-600);
    position: relative;
    display: inline-block;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
    text-align: center;
}

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

/* User Pill (Modern Circular Avatar) */
.user-pill {
    position: absolute;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
}

.user-pill:hover {
    transform: scale(1.05);
    border-color: white;
    background: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    display: none;
    /* Icon only for global App-like feel */
}

.logout-btn {
    display: none;
    /* Hidden by default, triggered by clicking the pill */
}

.btn-primary,
.btn-secondary {
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary-600);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background: var(--primary-700);
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    border-color: var(--primary-300);
    transform: translateY(-2px);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}