
/* Material Design & App-like Theme */
:root {
    /* Color Palette - Default Blue/Teal */
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --primary-light: #BBDEFB;
    --secondary-color: #009688; /* Teal */
    --accent-color: #FFC107;

    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;

    /* Spacing & Layout */
    --border-radius: 12px;
    --shadow-1: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-2: 0 4px 8px rgba(0,0,0,0.12);
    --shadow-3: 0 8px 16px rgba(0,0,0,0.14);

    --max-width: 800px; /* App-like constraints */
    --header-height: 60px;
    --nav-height: 64px; /* Bottom nav if used, or footer action bar */

    /* Typography */
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* Dark Mode Override */
[data-theme="dark"] {
    --bg-color: #121212;
    --card-bg: #1E1E1E;
    --text-primary: #E0E0E0;
    --text-secondary: #B0B0B0;
    --border-color: #333333;
    --shadow-1: 0 2px 4px rgba(0,0,0,0.5);
    --shadow-2: 0 4px 8px rgba(0,0,0,0.5);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    /* Ensure body fills height for centered layouts */
    min-height: 100vh;
}

/* Utilities */
.hidden { display: none !important; }
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Material Card */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-1);
    padding: 20px;
    margin-bottom: 16px;
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    border: 1px solid var(--border-color);
    box-sizing: border-box;
}

.card:hover {
    box-shadow: var(--shadow-2);
}

/* App Header (Dashboard & Exams) */
.app-header {
    background: var(--card-bg);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow-1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px; /* Slightly rounded */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 0.875rem;
    text-decoration: none; /* For links styled as buttons */
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(33, 150, 243, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4);
    transform: translateY(-1px);
}

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

.btn-text {
    background: transparent;
    color: var(--text-secondary); /* Changed from primary to secondary for standard icons */
}
.btn-text:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

/* Form Inputs */
input[type="text"], input[type="password"], input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    margin: 8px 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border: none;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.password-toggle-btn {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.password-toggle-btn:hover {
    color: var(--text-primary);
}

/* Login specific */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
    /* Reset margins/padding of parent if needed */
    position: fixed; top: 0; left: 0; width: 100%; z-index: 1000;
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--primary-light);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-dark);
    font-size: 2rem;
    font-weight: bold;
}

/* Course Cards (Horizontal Scroll or Grid) */
.course-scroller {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    padding: 4px 4px 20px 4px; /* Bottom padding for scrollbar/shadow */
    margin-bottom: 20px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.course-card {
    flex: 0 0 85%; /* Shows part of next card on mobile */
    max-width: 300px;
    scroll-snap-align: start;
    border-radius: 16px;
    padding: 24px;
    color: white; /* Text color usually overridden inline */
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
    box-shadow: var(--shadow-2);
}

.course-card:active {
    transform: scale(0.98);
}

@media (min-width: 600px) {
    .course-card {
        flex: 0 0 45%;
    }
}

/* Exam List */
.exam-list {
    display: grid;
    gap: 12px;
}

.exam-item {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.exam-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
    border: none;
}

.exam-info h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    font-weight: 500;
}

.exam-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
    align-items: center;
}

.exam-action {
    background: var(--primary-light);
    color: var(--primary-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Exam Interface (Taking Exam) */
.exam-container {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 80px; /* Space for bottom bar */
    box-sizing: border-box;
    width: 100%;
}

.question-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-1);
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: auto;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 20px;
    color: var(--text-primary);
    max-width: 100%;
    overflow-x: auto;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0px;
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
}

.option-item {
    display: flex;
    align-items: flex-start; /* Align top for long text */
    padding: 16px 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    margin-bottom: 0;
}

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

.option-item:hover {
    background: rgba(33, 150, 243, 0.05);
}

.option-item.selected {
    background: rgba(33, 150, 243, 0.1);
}

.option-circle { /* Changed from option-marker */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    margin-right: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-secondary);
    background: transparent;
    opacity: 0.6;
}

.option-item.selected .option-circle {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    opacity: 1;
}

.exam-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    background: var(--card-bg);
    padding: 12px 16px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

/* MathJax Specific */
.mathy {
    font-family: 'Cambria Math', serif;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, var(--bg-color) 25%, var(--border-color) 50%, var(--bg-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    height: 20px;
    margin-bottom: 8px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Bookmark Icon */
.bookmark-icon {
    float: right;
    cursor: pointer;
    color: var(--border-color);
    transition: color 0.2s;
}
.bookmark-icon.active {
    color: var(--accent-color);
    fill: var(--accent-color);
}

/* Additional overrides for results page question cards */
.question-container {
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    background: var(--card-bg);
    box-shadow: var(--shadow-1);
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: auto;
}

.option-item.correct {
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.option-item.incorrect {
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.option-item.correct .option-circle {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
    opacity: 1;
}

.option-item.incorrect .option-circle {
    border-color: var(--danger-color);
    background: var(--danger-color);
    color: white;
    opacity: 1;
}

.option-item.correct:last-child,
.option-item.incorrect:last-child {
    border-bottom: none;
}

/* Global App Footer */
.app-footer {
    text-align: center;
    padding: 24px 16px;
    margin-top: 40px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.9rem;
    box-sizing: border-box;
    width: 100%;
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

/* Filter Buttons (Results Page) */
.filter-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.filter-btn:hover:not(.active) {
    background-color: var(--bg-color);
}

/* Badges (Results Page) */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    margin-right: 5px;
}

/* Colors missing from material theme */
:root {
    --accent-color: #6366f1; /* Indigo */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}

[data-theme="dark"] {
    --accent-color: #818cf8;
}


.explanation-box {
    margin-top: 15px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.05); /* Soft primary tint */
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    border-left: 4px solid var(--primary-color);
}
