/* --- General & Variables --- */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #343a40;
    --text-color: #212529;
    --border-radius: 5px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Header & Navigation --- */
.site-header {
    background-color: #fff;
    padding: 1rem 0;
    border-bottom: 1px solid var(--medium-gray);
    margin-bottom: 2rem;
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--dark-gray);
}
.logo:hover { text-decoration: none; }

nav a, .nav-button {
    margin-left: 20px;
    font-size: 1rem;
}

.nav-button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}
.nav-button:hover { text-decoration: underline; }

/* --- Flash Messages --- */
.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* --- Tournament List & Cards --- */
.page-title {
    margin-bottom: 2rem;
    text-align: center;
}
.page-title h2 { margin-bottom: 0.5rem; }

.tournament-card-link { display: block; margin-bottom: 1rem; }
.tournament-card-link:hover { text-decoration: none; }

.tournament-card {
    background: #fff;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}
.tournament-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-3px);
}
.tournament-card h3 {
    margin-top: 0;
    color: var(--dark-gray);
}
.tournament-card .details span {
    color: #6c757d;
    margin-right: 1.5rem;
}

/* --- Forms --- */
.form-card {
    max-width: 450px;
    margin: 2rem auto;
    background: #fff;
    padding: 2rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
}
.form-card h2 { text-align: center; margin-top: 0; }

.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}
.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: var(--border-radius);
    box-sizing: border-box; /* Important */
}
.form-switch { text-align: center; }

/* --- Buttons --- */
.btn {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease-in-out;
}
.btn:hover {
    background-color: var(--primary-hover);
    color: #fff;
    text-decoration: none;
}
.btn-large { font-size: 1.2rem; padding: 15px; }

/* --- Tournament Detail Page --- */
.tournament-detail {
    background: #fff;
    padding: 2rem;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
}
.tournament-detail h1 { margin-top: 0; }
.tournament-detail .entry-fee {
    font-size: 1.2rem;
    font-weight: bold;
    color: #28a745;
}
.login-prompt { font-style: italic; color: #6c757d; }

/* --- Footer --- */
.site-footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    color: #6c757d;
    font-size: 0.9rem;
    border-top: 1px solid var(--medium-gray);
}

/* --- Quiz Page Styles --- */
.quiz-container {
    max-width: 700px;
    margin: 2rem auto;
    background: #fff;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    padding: 2rem;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--medium-gray);
    padding-bottom: 1rem;
}

.quiz-timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* This is the key functional style: hide all question cards by default. */
.question-card {
    display: none;
    margin-bottom: 2rem;
}

/* JS will add this class to the currently visible question card. */
.question-card.active {
    display: block;
}

.question-text {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.answer-options label {
    display: block;
    background: var(--light-gray);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.answer-options label:hover {
    background: var(--medium-gray);
}

.answer-options input {
    margin-right: 10px;
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--medium-gray);
}

.btn-secondary {
    background-color: #6c757d;
}
.btn-secondary:hover {
    background-color: #5a6268;
}

/* --- Practice Test Results Page --- */
.results-container {
    max-width: 750px;
    margin: 2rem auto;
    background: #fff;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
}

.results-header {
    text-align: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--medium-gray);
}
.results-header h2 {
    margin-top: 0;
}
.results-header h3 {
    margin-bottom: 0;
    font-weight: normal;
    color: #333;
}

.results-list {
    padding: 1rem;
}

.result-card {
    border: 1px solid var(--medium-gray);
    border-left-width: 5px; /* Key visual indicator */
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
}

.result-card.correct {
    border-left-color: #28a745; /* Green for correct */
    background-color: #f7fff9;
}

.result-card.incorrect {
    border-left-color: #dc3545; /* Red for incorrect */
    background-color: #fff8f8;
}

.result-card .question-text {
    font-weight: bold;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.answer-section {
    margin-bottom: 0.5rem;
}

.answer-tag {
    display: inline-block;
    padding: 5px 10px;
    background-color: var(--medium-gray);
    border-radius: var(--border-radius);
    margin-right: 5px;
    margin-bottom: 5px;
}
.answer-tag.correct {
    background-color: #d4edda; /* Light green */
    color: #155724;
}

.answer-tag-none {
    color: #6c757d;
}

.correct-answer-section {
    margin-top: 1rem;
}

.results-footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--medium-gray);
}

/* --- Admin Dashboard & Components --- */
.admin-link {
    font-weight: bold;
    color: #dc3545; /* A distinct color for the admin link in the nav */
}

.admin-actions {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--medium-gray);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: #fff;
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    overflow: hidden; /* Ensures border-radius is respected by table rows */
}

.admin-table th,
.admin-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--medium-gray);
}

.admin-table th {
    background-color: var(--light-gray);
    font-weight: bold;
}

/* Zebra-striping for better readability */
.admin-table tbody tr:nth-of-type(even) {
    background-color: var(--light-gray);
}

.admin-table tbody tr:last-of-type td {
    border-bottom: none;
}

.admin-table .action-link {
    margin-right: 15px;
    font-weight: bold;
}

.status-active {
    color: #28a745; /* Green */
    font-weight: bold;
}

.status-inactive {
    color: #6c757d; /* Gray */
}

/* --- Admin Upload Page --- */
.csv-example {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--medium-gray);
}

.csv-example h4 {
    margin-top: 0;
}

.csv-example pre {
    background-color: var(--light-gray);
    padding: 1rem;
    border-radius: var(--border-radius);
    white-space: pre-wrap; /* Allows long lines to wrap */
    word-break: break-all;
}

/* --- Admin Dashboard Enhancements --- */
.admin-table .actions-cell {
    white-space: nowrap; /* Prevents action buttons from wrapping */
}

.action-link-btn {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    text-decoration: underline;
    font-weight: bold;
}
.action-link-btn.success { color: #28a745; }
.action-link-btn.danger { color: #dc3545; }

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    border-radius: 10px;
    text-transform: uppercase;
}

.status-badge.status-draft { background-color: #6c757d; } /* Gray */
.status-badge.status-open { background-color: #007bff; } /* Blue */
.status-badge.status-live { background-color: #dc3545; } /* Red */
.status-badge.status-completed { background-color: #28a745; } /* Green */
  

