/*
 * Minimal styling for the Quiz platform.  The colours and layout borrow
 * inspiration from the provided React prototype.  Feel free to tweak
 * variables below or add new classes as you build out additional views.
 */

:root {
    --bg-color: #f9fafb;
    --text-color: #1f2937;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --primary-color: #4f46e5;
    --primary-color-light: #e0e7ff;
    --primary-text-dark: #312e81;
    --secondary-bg: #f3f4f6;
    --border-color: #e5e7eb;
    --red-color: #dc2626;
    --green-color: #16a34a;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #111827;
        --text-color: #e5e7eb;
        --header-bg: #1f2937;
        --card-bg: #1f2937;
        --card-shadow: 0 4px 6px -1px rgba(255, 255, 255, 0.05);
        --primary-color-light: #3730a3;
        --primary-text-dark: #a5b4fc;
        --secondary-bg: #374151;
        --border-color: #4b5563;
        --red-color: #ef4444;
        --green-color: #4ade80;
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.header {
    background-color: var(--header-bg);
    box-shadow: var(--card-shadow);
    padding: 1rem;
    margin-bottom: 2rem;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
}

/* New logo image styling.  The header now contains an image alongside the
   site name.  Keep the height modest so it fits nicely in the nav bar. */
.logo-img {
    height: 40px;
    width: auto;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Footer styles for the legal pages links. */
.footer {
    background-color: var(--header-bg);
    color: var(--text-color);
    padding: 1rem;
    text-align: center;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}
.footer a {
    color: var(--primary-color);
    text-decoration: none;
    margin: 0 0.5rem;
}
.footer a:hover {
    text-decoration: underline;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
}

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

.user-points {
    font-weight: bold;
    color: var(--primary-color);
}

.view-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
    text-align: center;
}

.button:active {
    transform: scale(0.97);
}

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

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

.button-secondary {
    background-color: var(--secondary-bg);
    color: var(--text-color);
}

.button-secondary.active {
    background-color: var(--primary-color);
    color: white;
}

.button-success {
    background-color: var(--green-color);
    color: white;
}

/* Styles for admin lists of languages and categories */
.admin-list {
    list-style: none;
    padding-left: 0;
    margin-top: 0.5rem;
}
.admin-list li {
    background-color: var(--card-bg);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
    border-radius: 6px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hidden {
    display: none;
}

/* Home page styles */
/* Adjust the quiz grid to display more cards per row by reducing the min width */
.quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.quiz-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Slightly smaller images to fit the reduced card width */
.quiz-card-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.quiz-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.quiz-card-category {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.quiz-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.quiz-card-author {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.quiz-card-footer {
    margin-top: auto;
}

/* Quiz play styles */
.quiz-container {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quiz-header {
    text-align: center;
}

.quiz-category {
    color: var(--primary-color);
    font-weight: 600;
}

.quiz-title {
    font-size: 2rem;
    font-weight: 800;
    margin-top: 0.5rem;
}

.quiz-description {
    margin-top: 1rem;
    font-size: 1.125rem;
}

.stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
    font-size: 1.25rem;
}

.stats-counter, .stats-timer {
    background-color: var(--secondary-bg);
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.stats-counter .found {
    color: var(--primary-color);
    font-weight: bold;
}

.progress-bar {
    width: 100%;
    background-color: var(--secondary-bg);
    border-radius: 99px;
    height: 1rem;
    overflow: hidden;
}

.progress-bar-inner {
    background-color: var(--primary-color);
    height: 100%;
    width: 0%;
    border-radius: 99px;
    transition: width 0.3s ease-out;
}

.answer-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1.25rem;
    background-color: var(--secondary-bg);
    border: 2px solid transparent;
    border-radius: 6px;
    color: var(--text-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-light);
}

.answer-input:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.answer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.answer-cell {
    padding: 0.75rem;
    text-align: center;
    border-radius: 6px;
    background-color: var(--secondary-bg);
    transition: all 0.3s;
    /* Ensure all answer boxes have consistent height and vertically centered text */
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.answer-cell.found {
    background-color: var(--primary-color-light);
    color: var(--primary-text-dark);
    font-weight: 600;
}

.answer-cell .placeholder {
    color: transparent;
    user-select: none;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.summary-view {
    text-align: center;
    padding: 4rem 2rem;
    background-color: var(--card-bg);
    border-radius: 8px;
}

.summary-view h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.summary-view p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

.form-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
}

.form-container h2 {
    text-align: center;
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-color-light);
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    margin-top: 1rem;
    border-radius: 6px;
}

.dynamic-list-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.dynamic-list-item input {
    flex-grow: 1;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th, .admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background-color: var(--secondary-bg);
}

.admin-table td .button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.admin-table-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}