/* css/style.css */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
    --success-color: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

/* Auth Page Specifics */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-card h2 {
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.auth-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Inputs & Buttons */
input[type="email"],
input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

button {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--primary-hover);
}

button:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

/* Utility Classes */
.message {
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.5em;
    color: var(--error-color);
}

.success-text {
    color: var(--success-color) !important;
    font-weight: 500;
}


/* --- Dashboard Specific Styles --- */
.dashboard-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-header h2 {
    color: var(--primary-color);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: auto;
    background-color: var(--text-muted);
}

.btn-small:hover {
    background-color: var(--text-main);
}

.panel {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.panel h3 {
    margin-bottom: 1rem;
    color: var(--text-main);
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat-box {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
}

.stat-box span {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.exam-list {
    list-style: none;
}

.exam-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-color);
    margin-bottom: 0.5rem;
    border-radius: 6px;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.badge.free { background: #d1fae5; color: #065f46; }
.badge.premium { background: #fef3c7; color: #92400e; }

.btn-take {
    background-color: var(--success-color);
    width: auto;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn-locked {
    background-color: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    width: auto;
    padding: 0.5rem 1rem;
}

/* =========================================
   EXAM INTERFACE STYLING
   ========================================= */

/* Constrain the width and center everything */
.exam-header, 
.exam-container, 
.exam-footer {
    max-width: 800px;  /* Keeps line lengths readable for math */
    margin: 0 auto;    /* Centers the container on the screen */
    width: 100%;
    padding: 1rem;     /* Prevents touching the sides on mobile */
}

/* Style the top header bar */
.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border-radius: 8px;
    margin-top: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    padding: 1.5rem;
    position: sticky;
    top: 10px;
    z-index: 100;
}

.exam-header h2 {
    color: var(--primary-color);
    margin: 0;
}

#timer {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-muted);
    background: var(--bg-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

/* Make the option lists look like clickable buttons */
.exam-list li {
    display: flex;
    align-items: flex-start; /* Aligns checkbox with the top of multi-line math */
    padding: 1rem;
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
    border-radius: 6px;
    background-color: var(--card-bg);
    transition: all 0.2s ease;
}

/* Hover effect for options */
.exam-list li:hover {
    background-color: var(--bg-color);
    border-color: #d1d5db;
}

/* Enlarge radio buttons and checkboxes slightly */
.exam-list input[type="radio"],
.exam-list input[type="checkbox"] {
    transform: scale(1.2);
    margin-top: 0.25rem; /* Adjusts alignment with KaTeX text */
    margin-right: 1rem;
    cursor: pointer;
}

/* The Submit Button Area */
.exam-footer {
    text-align: right;
    padding-bottom: 4rem; /* Extra space at the bottom of the page */
}

#submit-exam-btn {
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    background-color: var(--primary-color);
}


/* Review Page Status Colors */
.correct-bg {
    background-color: #d1fae5 !important;
    border-color: #10b981 !important;
}
.wrong-bg {
    background-color: #fee2e2 !important;
    border-color: #ef4444 !important;
}
.missed-bg {
    background-color: #fef3c7 !important;
    border-color: #f59e0b !important;
    border-style: dashed !important;
}
.review-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 6px;
    background: #f8fafc;
    border-left: 4px solid var(--primary-color);
}


/* Exam Image Constraints */
.exam-image {
    max-width: min(100%, 500px); 
    height: auto;    /* Maintain aspect ratio */
    display: block;  /* Put the image on its own line */
    margin: 1rem auto;  /* Add space above and below */
    border-radius: 6px;
}


/* =========================================
   BRANDING & FOOTERS
   ========================================= */

/* Login Page Logo */
.login-logo {
    max-width: 180px; /* Adjust this number to make it bigger/smaller */
    height: auto;
    margin: 0 auto 1.5rem auto; /* Centers it and adds space below */
    display: block;
}

/* Universal Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.footer-logo {
    max-width: 24px; /* Keeps it icon-sized for the footer */
    height: auto;
    vertical-align: middle; /* Aligns it nicely with the text */
    margin-right: 0.5rem;
    opacity: 0.7; /* Makes it look subtle */
}

/* =========================================
   TOAST NOTIFICATIONS
   ========================================= */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 250px;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.3s forwards;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toast.success { background-color: #10b981; } /* Green */
.toast.error { background-color: #ef4444; }   /* Red */
.toast.info { background-color: #3b82f6; }    /* Blue */

.toast-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: 1rem;
    opacity: 0.8;
}

.toast-close:hover { opacity: 1; }

@keyframes slideIn {
    to { transform: translateX(0); opacity: 1; }
}

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