@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Bengali:wght@400;500;700&family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* Light Theme Variables */
    --bg-body: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-surface-2: #e9ecef;
    
    --text-primary: #212529;
    --text-secondary: #6c757d;
    
    --primary-color: #4361ee;
    --primary-hover: #3a56d4;
    --primary-light: #eaf0ff;
    
    --accent-color: #06d6a0; /* Success/Green */
    --accent-hover: #05b589;
    
    --danger-color: #ef476f;
    --warning-color: #ffd166;
    
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.12);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --nav-height: 70px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-surface-2: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    
    --primary-color: #4cc9f0;
    --primary-hover: #4895ef;
    --primary-light: rgba(76, 201, 240, 0.1);
    
    --accent-color: #06d6a0;
    --accent-hover: #05b589;
    
    --border-color: #334155;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
}

/* Global Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Noto Sans Bengali', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

/* Navigation */
header {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--nav-height);
}

[data-theme="dark"] header {
    background-color: rgba(30, 41, 59, 0.9);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
}

.logo-area {
    display: flex;
    flex-direction: column;
}

.logo-area h1 {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-area p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.4);
}

.btn-secondary {
    background-color: var(--bg-surface-2);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.theme-toggle {
    background: var(--bg-surface);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    background-color: var(--bg-surface-2);
    color: var(--primary-color);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Cards & Sections */
.menu-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--bg-surface-2);
    padding-bottom: 1rem;
}

.topic-list li {
    margin-bottom: 0.8rem;
}

.topic-list a {
    display: block;
    padding: 1rem;
    background-color: var(--bg-body);
    border-radius: var(--radius-md);
    font-weight: 500;
    border: 1px solid transparent;
}

.topic-list a:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateX(5px);
}

/* User Profile (Header) */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface-2);
    padding: 5px 15px 5px 5px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    display: none; 
    cursor: pointer;
    position: relative; /* For dropdown positioning */
    transition: var(--transition);
}

.user-profile:hover {
    background: var(--bg-surface);
    border-color: var(--primary-color);
}

.user-profile img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-arrow {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.user-profile.active .profile-arrow {
    transform: rotate(180deg);
}

/* User Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: 100%; /* Right below the profile */
    right: 0;
    width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 10px;
    display: none;
    flex-direction: column;
    gap: 5px;
    z-index: 1100;
    margin-top: 10px;
    animation: slideDown 0.2s ease-out;
}

.user-dropdown.show {
    display: flex;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border: none;
    background: transparent;
    text-align: left;
    transition: var(--transition);
    width: 100%;
}

.dropdown-item:hover {
    background: var(--bg-surface-2);
    color: var(--primary-color);
}

.dropdown-item.danger {
    color: var(--danger-color);
}

.dropdown-item.danger:hover {
    background: rgba(239, 71, 111, 0.1);
}

/* Feedback Modal */
.feedback-modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.feedback-modal.active {
    display: flex;
}

.feedback-content {
    background-color: var(--bg-surface);
    margin: auto;
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.feedback-textarea {
    width: 100%;
    height: 120px;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    margin: 15px 0;
    transition: border-color 0.3s;
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* History Modal */
.history-modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.history-modal.active {
    display: flex;
}

.history-content {
    background-color: var(--bg-surface);
    margin: auto;
    padding: 25px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px; /* Wider for history table */
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.history-list-container {
    max-height: 400px;
    overflow-y: auto;
    margin-top: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.history-table th, .history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    background: var(--bg-surface-2);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.history-table tr:last-child td {
    border-bottom: none;
}

/* --- MCQ Specific Styles --- */
/* Reusing global vars for consistency */

.screen {
    display: none;
    animation: fadeIn 0.4s ease-out;
}
.screen.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* MCQ Container Override */
.mcq-container {
    max-width: 800px;
    margin: 2rem auto;
    background: var(--bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    text-align: center;
}

.selection-box { margin-bottom: 1.5rem; text-align: left; }
.selection-box label { display: block; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-primary); }

select {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* MCQ Options */
#options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.option-btn {
    background: var(--bg-body);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    padding: 1.2rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-weight: 500;
}

.option-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.option-btn.correct {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.option-btn.incorrect {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: #fff;
}

/* Leaderboard */
#leaderboard-section {
    margin-top: 2rem;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

/* Auth Profile in MCQ */
.user-profile-section {
    background: var(--bg-body);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--border-color);
}

.user-info { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.user-avatar { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--primary-color); }
.user-welcome { font-size: 1.2rem; font-weight: 700; }

/* About Section (Footer Style) */
.about-section {
    margin-top: 4rem;
    padding: 3rem 1.5rem;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.creators {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-body);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Topic Specifics */
.topic-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.topic-btn {
    padding: 1.5rem;
    min-width: 200px;
    border-radius: var(--radius-md);
    color: white;
    text-align: center;
    font-weight: 600;
    background-size: 200% auto;
    transition: 0.5s;
}

.topic-btn:nth-child(1) { background-image: linear-gradient(to right, #4facfe 0%, #00f2fe 51%, #4facfe 100%); }
.topic-btn:nth-child(2) { background-image: linear-gradient(to right, #43e97b 0%, #38f9d7 51%, #43e97b 100%); }
.topic-btn:nth-child(3) { background-image: linear-gradient(to right, #fa709a 0%, #fee140 51%, #fa709a 100%); }
.topic-btn:nth-child(4) { background-image: linear-gradient(to right, #a18cd1 0%, #fbc2eb 51%, #a18cd1 100%); }

.topic-btn:hover {
    background-position: right center;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Responsive */
@media (max-width: 768px) {
    /* --- Mobile Top Bar Optimization --- */
    :root {
        --nav-height: 60px; /* Compact height for mobile */
    }

    nav {
        padding: 0 1rem; /* Reduced side padding */
    }

    .logo-area h1 {
        font-size: 1rem; /* Smaller Title */
    }

    .logo-area p {
        font-size: 0.65rem;
        /* Optional: Hide subtitle on very small screens if needed, but keeping it for now */
    }

    .user-area {
        gap: 0.5rem;
    }

    .user-area .btn-primary#login-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    .user-profile {
        padding: 2px 8px 2px 2px; /* Minimal padding */
        gap: 8px;
        background: transparent; /* Remove background on mobile for cleaner look */
        border: none;
    }

    /* Hide User Name on Mobile for Minimalism */
    #user-name {
        display: none;
    }

    .user-profile img {
        width: 28px;
        height: 28px;
        border: 1px solid var(--border-color);
    }

    /* Minimal Logout Button */
    #logout-btn {
        padding: 0.2rem 0.5rem !important;
        font-size: 0.7rem !important;
        background: transparent;
        color: var(--danger-color);
        border: 1px solid var(--danger-color);
        border-radius: 4px; /* Slightly less rounded for minimal look */
    }

    #logout-btn:hover {
        background: var(--danger-color);
        color: white;
    }

    /* Adjust Notification Bell if present */
    #notif-bell-container {
        margin-right: 5px !important;
    }
    #notif-bell {
        font-size: 1.1rem !important;
    }

    /* --- Other Mobile Adjustments --- */
    .menu-section { grid-template-columns: 1fr; }
    #options-container { grid-template-columns: 1fr; }
    .user-welcome { font-size: 1rem; }
    .container { padding: 1.5rem 1rem; }

    .main-footer {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    .footer-right { text-align: center; }
}

/* --- New Footer Styles --- */
.main-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 2.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align content to top */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 2rem; /* Space between columns */
    margin-top: 4rem; /* Add some space above the footer */
}

.main-footer .footer-left {
    flex: 2; /* Take more space */
    min-width: 280px; /* Minimum width before wrapping */
}

.main-footer .footer-left p:first-child {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.main-footer .footer-left p:last-child {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.main-footer .footer-right {
    flex: 1; /* Take less space */
    min-width: 250px; /* Minimum width before wrapping */
    text-align: right; /* Align contact info to the right */
}

.main-footer .footer-right p {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.main-footer .footer-right p:last-child {
    margin-bottom: 0;
}

.main-footer .footer-right a {
    color: var(--primary-color);
}

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

