/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    background: #f4f6f8;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== NAVBAR ===== */
.navbar {
    background-color: #20232a;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.5px;
}

.navbar-brand span {
    color: #4a90d9;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-nav a {
    color: #ccc;
    text-decoration: none;
    padding: 0.4rem 0.85rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s;
    margin: 0;
}

.navbar-nav a:hover {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
}

.navbar-nav a.btn-nav {
    background-color: #4a90d9;
    color: #fff;
    font-weight: 600;
}

.navbar-nav a.btn-nav:hover {
    background-color: #357abd;
}

/* ===== MAIN ===== */
main {
    flex: 1;
    padding: 2.5rem 1.5rem;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 960px;
    margin: 0 auto;
}

.container-sm {
    max-width: 480px;
    margin: 0 auto;
}

/* ===== FOOTER ===== */
footer {
    background-color: #20232a;
    color: #888;
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
}

/* ===== TYPOGRAPHY ===== */
h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 1.75rem;
    color: #1a1a2e;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: #2c2c4e;
}

a {
    color: #4a90d9;
    text-decoration: none;
    margin: 0;
    transition: color 0.2s;
}

a:hover {
    color: #357abd;
    text-decoration: underline;
}

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.05);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

/* ===== QUIZ LIST ===== */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.quiz-card {
    background: #fff;
    border-radius: 8px;
    border-left: 4px solid #4a90d9;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
    color: #1a1a2e;
    text-decoration: none;
    font-weight: 600;
}

.quiz-card:hover {
    box-shadow: 0 4px 16px rgba(74,144,217,0.18);
    transform: translateY(-2px);
    color: #4a90d9;
    text-decoration: none;
}

/* ===== FORMS ===== */
.form-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), 0 2px 12px rgba(0,0,0,0.05);
    padding: 2rem;
    margin: 0 auto;
    max-width: 480px;
}

/* Symfony form_row renders <div> inside <form> */
.form-group,
.form-card form > div,
.form-card .mb-3 {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #444;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: #1a1a2e;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin: 0;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
}

/* Checkboxes & radios — never stretched */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    accent-color: #4a90d9;
    cursor: pointer;
    flex-shrink: 0;
}

/* Symfony checkbox row: Symfony renders label then input, so reverse to get ☑ Label */
.form-card form > div:has(input[type="checkbox"]) {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
}

.form-card form > div:has(input[type="checkbox"]) label {
    font-weight: 400;
    margin: 0;
    cursor: pointer;
    font-size: 0.92rem;
    color: #555;
}

/* ===== BUTTONS ===== */
.btn, button {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 5px;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
    background-color: #4a90d9;
    color: #fff;
}

.btn:hover, button:hover {
    background-color: #357abd;
    text-decoration: none;
    color: #fff;
    box-shadow: 0 2px 8px rgba(74,144,217,0.25);
    transform: translateY(-1px);
}

.btn:active, button:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
}

.btn-danger {
    background-color: #dc3545;
}

.btn-danger:hover {
    background-color: #b02a37;
    box-shadow: 0 2px 8px rgba(220,53,69,0.25);
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #565e64;
}

.btn-outline {
    background-color: transparent;
    border: 1.5px solid #4a90d9;
    color: #4a90d9;
}

.btn-outline:hover {
    background-color: #4a90d9;
    color: #fff;
}

/* ===== QUIZ FORM ===== */
.quiz-question {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem 1.5rem 1rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    border-left: 4px solid #4a90d9;
}

.quiz-question strong {
    display: block;
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1a1a2e;
}

.quiz-question ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.quiz-question li {
    margin: 0;
}

.quiz-question label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 400;
    font-size: 0.95rem;
    color: #333;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    border: 1.5px solid transparent;
    transition: background-color 0.15s, border-color 0.15s;
    margin: 0;
}

.quiz-question label:hover {
    background-color: #f0f5ff;
    border-color: #c5d9f5;
}

.quiz-question input[type="radio"]:checked + * {
    font-weight: 600;
}

/* Highlight the selected label */
.quiz-question input[type="radio"] {
    margin: 0;
}

/* ===== TABLES ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.93rem;
}

thead {
    background-color: #20232a;
    color: #fff;
}

th {
    padding: 0.9rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: #f8faff;
}

.rank-1 td:first-child { color: #f5a623; font-weight: 700; }
.rank-2 td:first-child { color: #9b9b9b; font-weight: 700; }
.rank-3 td:first-child { color: #c97b3a; font-weight: 700; }

/* ===== ALERTS ===== */
.alert {
    padding: 0.8rem 1.1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
    font-size: 0.93rem;
    border-left: 4px solid transparent;
}

.alert-success,
.alert-succes {
    background-color: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.alert-danger {
    background-color: #fde8ea;
    color: #721c24;
    border-color: #dc3545;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #17a2b8;
}

/* ===== NAV TABS (leaderboard) ===== */
.nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
    padding: 0;
    list-style: none;
}

.nav-tabs a {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    background: #fff;
    border: 1.5px solid #d1d5db;
    color: #555;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-tabs a:hover,
.nav-tabs a.active {
    background-color: #4a90d9;
    border-color: #4a90d9;
    color: #fff;
    text-decoration: none;
}

/* ===== RESULT PAGE ===== */
.result-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 2.5rem 2rem;
    text-align: center;
    max-width: 440px;
    margin: 2rem auto;
}

.result-score {
    font-size: 3rem;
    font-weight: 800;
    color: #4a90d9;
    line-height: 1;
    margin: 1rem 0;
}

.result-card p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 1.5rem;
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== DASHBOARD NAV ===== */
.dashboard-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.dashboard-nav li a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    color: #333;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.dashboard-nav li a:hover {
    background-color: #f0f4ff;
    color: #4a90d9;
    border-color: #4a90d9;
    text-decoration: none;
}

/* ===== ADMIN TABLE ACTIONS ===== */
.action-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.action-group form {
    background: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    max-width: none;
}

/* ===== BACK LINK ===== */
.back-link {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: #6c757d;
    font-size: 0.9rem;
    text-decoration: none;
}

.back-link:hover {
    color: #4a90d9;
    text-decoration: none;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
    font-size: 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .navbar {
        padding: 0 1rem;
    }

    .navbar-nav {
        gap: 0.1rem;
    }

    .navbar-nav a {
        padding: 0.35rem 0.55rem;
        font-size: 0.82rem;
    }

    main {
        padding: 1.5rem 1rem;
    }

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

    .form-card {
        padding: 1.5rem;
    }
}
