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

:root {
    --primary: #3498db;
    --secondary: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --border: #bdc3c7;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f6fa;
    color: var(--dark);
    line-height: 1.6;
}

.top-strip {
    background: #0d6efd;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 2rem;
    font-size: 0.9rem;
}

.top-strip a {
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.top-strip a:hover {
    text-decoration: underline;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #2980b9 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

.header-content h1 {
    font-size: 1.8rem;
    margin-bottom: 0.2rem;
}

.header-content p {
    font-size: 0.9rem;
    opacity: 0.9;
}

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

.btn-login {
    background: white;
    color: var(--primary);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ===== Navigation ===== */
.main-nav {
    display: flex;
    gap: 1rem;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scroll-behavior: smooth;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--dark);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--primary);
}

.nav-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== Main Layout ===== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

/* ===== Cards ===== */
.card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: all 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card h2,
.card h3 {
    margin-bottom: 1rem;
    color: var(--dark);
}

.card p {
    margin-bottom: 0.5rem;
    color: #7f8c8d;
}

.intro-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid rgba(52, 152, 219, 0.18);
    background: linear-gradient(135deg, #f7fbff 0%, #eef7ff 45%, #ffffff 100%);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.6rem;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.intro-copy {
    max-width: 780px;
}

.intro-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-outline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.3rem;
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-outline-link:hover {
    background: #eef7ff;
}

.subtitle {
    font-size: 0.85rem;
    color: #95a5a6;
    margin-top: 0.5rem;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.big-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    margin: 1rem 0;
}

/* ===== Buttons ===== */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 0.8rem 1.6rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: #27ae60;
}

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

.btn-danger:hover {
    background: #c0392b;
}

/* ===== Quick Access ===== */
.quick-access {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.quick-access h3 {
    margin-bottom: 1rem;
}

/* ===== Exams Grid ===== */
.exams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.exam-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid var(--primary);
}

.exam-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

.exam-card h3 {
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.exam-details {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin: 0.5rem 0;
}

.exam-details span {
    display: inline-block;
    margin-right: 1rem;
}

.exam-button {
    margin-top: 1rem;
    width: 100%;
    padding: 0.7rem;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.exam-button:hover {
    background: #27ae60;
}

/* ===== Leaderboard ===== */
.filter-bar {
    margin-bottom: 1.5rem;
}

.filter-bar select {
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.leaderboard-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    box-shadow: var(--shadow);
    border-radius: 10px;
    overflow: hidden;
}

.leaderboard-table th {
    background: var(--primary);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.leaderboard-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--light);
}

.leaderboard-table tr:hover {
    background: #f9f9f9;
}

.leaderboard-table tr:nth-child(2) td:first-child::before {
    content: "🥇 ";
}

.leaderboard-table tr:nth-child(3) td:first-child::before {
    content: "🥈 ";
}

.leaderboard-table tr:nth-child(4) td:first-child::before {
    content: "🥉 ";
}

/* ===== Forms ===== */
.reward-form {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* ===== Reward Info ===== */
.reward-info {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-left: 4px solid var(--secondary);
}

.reward-info p {
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

/* ===== Reward History ===== */
.reward-history {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.reward-history h3 {
    margin-bottom: 1rem;
}

.admin-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.admin-queue-list {
    display: grid;
    gap: 1rem;
}

.admin-queue-item {
    border: 1px solid #dde6ee;
    border-radius: 10px;
    padding: 1rem;
    background: #fbfdff;
}

.admin-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.admin-queue-meta {
    display: grid;
    gap: 0.35rem;
    color: #5d6d7e;
    font-size: 0.92rem;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.status-chip.pending {
    background: #fff3cd;
    color: #8a6d1d;
}

.status-chip.approved {
    background: #d4edda;
    color: #25653c;
}

.status-chip.rejected {
    background: #f8d7da;
    color: #8f2430;
}

.admin-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
}

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

.btn-warning:hover {
    background: #d68910;
}

.history-item {
    padding: 1rem;
    border-left: 4px solid var(--warning);
    margin-bottom: 1rem;
    background: #fef5e7;
    border-radius: 6px;
}

.history-item.approved {
    border-left-color: var(--secondary);
    background: #d5f4e6;
}

.history-item.rejected {
    border-left-color: var(--danger);
    background: #fadbd8;
}

.history-status {
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ===== Settings Grid ===== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.settings-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
}

.settings-grid input[type="checkbox"] {
    cursor: pointer;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content.large {
    max-width: 900px;
    max-height: 95vh;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--dark);
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--dark);
}

/* ===== Exam Modal ===== */
#examContainer {
    background: white;
}

.exam-header {
    background: linear-gradient(135deg, var(--primary) 0%, #2980b9 100%);
    color: white;
    padding: 1.5rem;
    margin: -2rem -2rem 1.5rem -2rem;
    border-radius: 10px 10px 0 0;
}

.exam-header h2 {
    color: white;
    margin-bottom: 0.5rem;
}

.exam-timer {
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 1rem;
}

.question-container {
    margin-bottom: 2rem;
}

.question-number {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

.question-passage {
    background: #f7fbff;
    border: 1px solid #dcecf9;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    color: #2c3e50;
    line-height: 1.7;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.option {
    padding: 1rem;
    border: 2px solid var(--light);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.option:hover {
    border-color: var(--primary);
    background: #f0f7ff;
}

.option.selected {
    border-color: var(--primary);
    background: #e8f4f8;
}

.option.correct {
    border-color: var(--secondary);
    background: #e8f8f1;
}

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

.option input[type="radio"] {
    margin-right: 0.7rem;
    cursor: pointer;
}

.exam-navigation {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: space-between;
}

.exam-navigation button {
    padding: 0.8rem 1.6rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.exam-navigation .btn-prev {
    background: var(--light);
    color: var(--dark);
}

.exam-navigation .btn-next {
    background: var(--primary);
    color: white;
}

.exam-navigation .btn-finish {
    background: var(--secondary);
    color: white;
    flex: 1;
}

.exam-progress {
    width: 100%;
    height: 8px;
    background: var(--light);
    border-radius: 4px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.exam-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .top-strip {
        padding: 0.7rem 1rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .user-section {
        width: 100%;
        justify-content: center;
    }

    .main-nav {
        padding: 0.7rem 1rem;
        gap: 0.5rem;
        font-size: 0.85rem;
    }

    .content {
        padding: 1rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .intro-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .intro-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .exams-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .admin-summary,
    .admin-queue-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .exam-header {
        margin: -1.5rem -1.5rem 1rem -1.5rem;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.3rem;
    }

    .big-number {
        font-size: 2rem;
    }

    .leaderboard-table {
        font-size: 0.9rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.7rem;
    }

    .exam-navigation {
        flex-direction: column;
    }

    .exam-navigation button {
        width: 100%;
    }
}
