
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    padding: 30px;
    box-sizing: border-box;
}

header {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

header h1 {
    font-size: 1.8em;
    margin: 0;
    color: #005a9e;
}

.version-assurance {
    align-items: center;
    background: #ecfdf3;
    border: 1px solid #abefc6;
    border-radius: 8px;
    color: #067647;
    display: inline-flex;
    gap: 10px;
    margin-top: 12px;
    padding: 9px 12px;
}

.version-assurance::before {
    align-items: center;
    background: #17b26a;
    border-radius: 50%;
    color: #fff;
    content: "\2713";
    display: inline-flex;
    flex: 0 0 22px;
    font-size: 0.86rem;
    font-weight: 900;
    height: 22px;
    justify-content: center;
    line-height: 1;
    width: 22px;
}

.version-assurance strong {
    display: block;
    font-size: 0.92rem;
    line-height: 1.2;
}

.version-assurance span {
    display: block;
    font-size: 0.78rem;
    line-height: 1.35;
}

main {
    padding: 10px 0;
}

.cta-buttons {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

.btn {
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    display: inline-block;
    text-align: center;
    transition: background-color 0.3s, transform 0.2s;
}

.btn-primary {
    background-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: #dc2626;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-compact {
    border-radius: 6px;
    font-size: 0.86rem;
    padding: 8px 10px;
}

#auth-container {
    text-align: center;
    margin-top: 40px;
}

#google-login-btn {
    background-color: #db4437;
    font-size: 1.2em;
}

#google-login-btn:hover {
    background-color: #c23321;
}

#user-info {
    font-weight: bold;
}

.exam-modes {
    margin: 30px 0;
}

.exam-modes p {
    margin-top: 10px;
    color: #666;
}

.exam-history {
    margin-top: 34px;
}

.exam-history-table {
    min-width: 680px;
}

.exam-history-table td:nth-child(3),
.exam-history-table td:nth-child(4),
.exam-history-table td:nth-child(5) {
    text-align: right;
}

#exam-history h3 {
    margin-bottom: 15px;
}

#exam-list {
    list-style: none;
    padding: 0;
}

#exam-list li {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    border-left: 5px solid #007bff;
}

#timer {
    font-size: 1.5em;
    font-weight: bold;
    color: #005a9e;
    background-color: #e9f5ff;
    padding: 10px 20px;
    border-radius: 8px;
}

#exam-container .question-block {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

#exam-container h3 {
    margin-top: 0;
}

#exam-container .options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#exam-container .option {
    display: block;
    background-color: #f1f1f1;
    padding: 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#exam-container .option:hover {
    background-color: #e0e0e0;
}

#exam-container .option.selected {
    background-color: #cce5ff;
    border: 2px solid #007bff;
}

#submit-exam-btn {
    width: 100%;
    margin-top: 20px;
    font-size: 1.2em;
}

#results-container .result-summary {
    background-color: #e9f5ff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 30px;
}

#results-container .result-summary h2 {
    margin: 0 0 10px;
    font-size: 2em;
}

#results-container .result-summary .passed {
    color: #28a745;
}

#results-container .result-summary .failed {
    color: #dc3545;
}

#results-container .score-details {
    font-size: 1.2em;
}

.review-section .question-review {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.review-section .question-review.correct {
    border-left: 5px solid #28a745;
    background-color: #f0fff4;
}

.review-section .question-review.incorrect {
    border-left: 5px solid #dc3545;
    background-color: #fff0f1;
}

.review-section .explanation {
    margin-top: 10px;
    padding: 10px;
    background-color: #fffbe5;
    border-radius: 5px;
    font-style: italic;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: #888;
    font-size: 0.9em;
}

.dashboard-container,
.detail-container {
    max-width: 1100px;
}

.muted {
    color: #667085;
    margin: 6px 0 0;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
}

.status-badge,
.result-badge {
    display: inline-block;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-online,
.result-correct {
    color: #166534;
    background: #dcfce7;
}

.status-offline,
.result-wrong {
    color: #991b1b;
    background: #fee2e2;
}

.result-pending {
    color: #475467;
    background: #eaecf0;
}

.stats-table,
.questions-table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0 24px;
}

.stats-table th,
.stats-table td,
.questions-table th,
.questions-table td {
    border-bottom: 1px solid #e4e7ec;
    padding: 14px 12px;
    text-align: left;
    vertical-align: top;
}

.stats-table th,
.questions-table th {
    color: #475467;
    background: #f9fafb;
    font-size: 0.88rem;
}

.sort-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.sort-button:hover,
.sort-button:focus-visible,
.sort-button.active {
    color: #175cd3;
}

.sort-button:focus-visible {
    outline: 2px solid #84adff;
    outline-offset: 3px;
    border-radius: 2px;
}

.stats-table th:last-child,
.stats-table td:last-child {
    text-align: right;
}

.stats-table a {
    color: #175cd3;
    text-decoration: none;
}

.stats-table a:hover,
.filter-nav a:hover {
    text-decoration: underline;
}

.metric-link {
    font-size: 1.5rem;
    font-weight: 800;
}

.metric-pending {
    color: #667085 !important;
}

.metric-correct {
    color: #16803c !important;
}

.metric-wrong {
    color: #d92d20 !important;
}

.btn-block {
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.admin-only {
    display: none;
}

.admin-only.is-visible {
    display: inline-block;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 28px;
}

.admin-card {
    background: #f9fafb;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    padding: 16px;
}

.admin-card span {
    color: #667085;
    display: block;
    font-size: 0.88rem;
    margin-bottom: 8px;
}

.admin-card strong {
    color: #101828;
    display: block;
    font-size: 1.8rem;
    line-height: 1;
}

.admin-section {
    margin-top: 32px;
}

.risk-badge {
    border-radius: 999px;
    display: inline-block;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 6px 10px;
    white-space: nowrap;
}

.risk-ok {
    background: #dcfce7;
    color: #166534;
}

.risk-watch {
    background: #fef3c7;
    color: #92400e;
}

.risk-danger {
    background: #fee2e2;
    color: #991b1b;
}

.admin-notes {
    color: #667085;
    font-size: 0.9rem;
    margin: 6px 0 0;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-upload {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 14px 0 18px;
}

.admin-upload input {
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    padding: 10px;
}

.admin-check-results {
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    padding: 16px;
}

.admin-check-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.admin-check-list {
    margin: 8px 0 0;
    padding-left: 20px;
}

.admin-check-list li {
    margin-bottom: 6px;
}

.filter-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.filter-nav a {
    color: #344054;
    background: #f2f4f7;
    border-radius: 999px;
    padding: 8px 13px;
    text-decoration: none;
    font-weight: 650;
}

.filter-nav a.active {
    color: #fff;
    background: #175cd3;
}

.table-scroll {
    overflow-x: auto;
}

.questions-table {
    min-width: 900px;
}

.questions-table tbody tr:hover {
    background: #f9fafb;
}

.question-context {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    color: #667085;
    font-size: 0.9rem;
    line-height: 1.4;
}

.answer-correct {
    color: #166534;
    font-weight: 700;
}

.empty-state {
    color: #667085;
    text-align: center !important;
    padding: 30px !important;
}

.error-message {
    color: #b42318;
    background: #fef3f2;
    border-radius: 8px;
    padding: 14px;
}

/* Responsive Design */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 20px;
    }
    header {
        flex-direction: column;
        gap: 15px;
    }
    header h1 {
        font-size: 1.5em;
    }
    .version-assurance {
        width: 100%;
        box-sizing: border-box;
    }
    .cta-buttons {
        flex-direction: column;
    }
    .section-heading {
        flex-direction: column;
    }
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    .admin-grid {
        grid-template-columns: 1fr;
    }
    .admin-check-grid {
        grid-template-columns: 1fr;
    }
    .btn {
        width: 100%;
    }
}

/* Auditoría explicada y fecha de fallo en lista de preguntas */
.why-box {
    background: #f8fafc;
    border: 1px solid #dbe4ef;
    border-left: 4px solid #3182ce;
    border-radius: 8px;
    padding: 12px 14px;
    margin-top: 10px;
}

.why-title {
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #2b6cb0;
}

.why-box p {
    margin: 6px 0 0;
    line-height: 1.5;
    color: #2d3748;
    font-size: 0.92rem;
}

.last-failed-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 0.82rem;
    color: #c53030;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
}


/* ===================================================
   Banner de invitado / modo sin cuenta
   =================================================== */

.guest-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 5px solid #f59e0b;
    border-radius: 8px;
    padding: 16px 18px;
    margin-bottom: 24px;
    color: #78350f;
}

.guest-banner-icon {
    flex: 0 0 auto;
    font-size: 1.4rem;
    line-height: 1;
    margin-top: 2px;
}

.guest-banner-body {
    flex: 1;
    min-width: 0;
}

.guest-banner-body strong {
    display: block;
    font-size: 0.97rem;
    margin-bottom: 4px;
    color: #92400e;
}

.guest-banner-body p {
    margin: 0 0 10px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.guest-banner-body ul {
    margin: 0 0 12px;
    padding-left: 18px;
    font-size: 0.88rem;
    line-height: 1.7;
}

.guest-banner .btn-register {
    display: inline-block;
    padding: 8px 16px;
    background: #d97706;
    color: #fff;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.guest-banner .btn-register:hover {
    background: #b45309;
}

/* Estadísticas deshabilitadas para invitados */
.stat-locked {
    color: #9ca3af !important;
    font-style: italic;
}

.locked-row td {
    opacity: 0.45;
}
