/* ================================================
   INDEX PAGE — MODERN MINIMALIST REDESIGN
   Loaded last → safely overrides Bootstrap & custom.css
   ================================================ */

/* ── DESIGN TOKENS ───────────────────────────── */
:root {
    --brand-50:  #f0fbf9;
    --brand-100: #d6f2ec;
    --brand-200: #aae3d9;
    --brand-300: #74ccbf;
    --brand-500: #14a89a;
    --brand-600: #0e8a7e;
    --brand-700: #0b6d63;

    --accent:      #3b82f6;
    --accent-dark: #2563eb;

    --ink:      #1f2a2e;
    --ink-soft: #4b5563;
    --muted:    #6b7280;

    --surface:  #ffffff;
    --page-bg:  #f5faf8;
    --border:   #e4efec;

    --shadow-sm: 0 1px 2px rgba(16,40,37,.05), 0 2px 6px rgba(16,40,37,.05);
    --shadow-md: 0 6px 20px rgba(16,40,37,.08);
    --shadow-lg: 0 16px 40px rgba(16,40,37,.13);

    --radius:    16px;
    --radius-sm: 10px;
    --pill:      999px;

    --ease:       cubic-bezier(.4, 0, .2, 1);
    --transition: .25s var(--ease);

    /* To revert body text to your handwriting font,
       set --font-body: 'Chilanka', cursive; */
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    --font-display: 'Homenaje', var(--font-body);
}

/* ── PAGE BASE ───────────────────────────────── */
body {
    background-color: var(--page-bg);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

/* ── 1. HERO ─────────────────────────────────── */
.container h1 {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 4.5vw, 3rem);
    font-weight: 400;
    letter-spacing: -0.01em;
    color: var(--ink);
    line-height: 1.15;
}

.container h2 {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 400;
    color: var(--brand-700);
    letter-spacing: -0.005em;
}

.hero-description,
.topics-description-text {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.75;
    color: var(--ink-soft);
    letter-spacing: 0;
    word-spacing: 0;
    max-width: 70ch;
    margin-inline: auto;
}

.container p a b { color: var(--brand-600); }

/* ── 2. TOPIC SELECTION AREA ─────────────────── */
#selectAllTopics + label,
.topic-group-card .form-check-label strong { color: var(--ink); }

/* Global "Select All Topics" pill */
.container-fluid .form-check.d-inline-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--pill);
    padding: 10px 22px 10px 36px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.container-fluid .form-check.d-inline-block:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Topic group cards (requires wrapper — see markup snippet) */
.topic-group-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 22px 18px;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}
.topic-group-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.topic-group-title {
    font-family: var(--font-display);
    font-size: 1.25rem !important;
    font-weight: 400;
    color: var(--brand-700);
    margin-bottom: .75rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--border);
}

.topic-group-card .form-check { padding-left: 1.9em; }

.topic-group-card .form-check-label {
    font-size: .92rem;
    color: var(--ink-soft);
    cursor: pointer;
}
.topic-group-card .form-check-label strong { color: var(--ink); }

/* Modern checkboxes */
.form-check-input {
    border: 1.5px solid #c4d6d1;
    cursor: pointer;
    transition: var(--transition);
}
.form-check-input:checked {
    background-color: var(--brand-500);
    border-color: var(--brand-500);
}
.form-check-input:focus {
    border-color: var(--brand-300);
    box-shadow: 0 0 0 .2rem rgba(20,168,154,.2);
}

.status-topic label { font-weight: 600; }

/* ── 3. RANDOM NUMBER / TEST SECTION ─────────── */
.random-number-section {
    background: linear-gradient(180deg, var(--brand-50) 0%, #ffffff 100%);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-top: 2rem;
    padding: 1rem 0 2rem;
    text-align: center;
}
.random-number-section h2 {
    font-family: var(--font-display) !important;
    color: var(--ink);
    font-weight: 400;
}

/* Question count buttons */
.btn-manage-mcq-option,
.question-btn {
    background: var(--surface);
    color: var(--brand-700);
    border: 1.5px solid var(--brand-200);
    border-radius: var(--pill);
    width: 64px;
    height: 64px;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 6px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.btn-manage-mcq-option:hover,
.question-btn:hover {
    transform: translateY(-2px);
    border-color: var(--brand-500);
    box-shadow: var(--shadow-md);
    color: var(--brand-700);
}
.question-btn.active {
    background: var(--brand-500);
    border-color: var(--brand-500);
    color: #fff;
    box-shadow: 0 6px 16px rgba(20,168,154,.35);
}

#selectedTopicsText {
    font-size: .95rem;
    color: var(--muted) !important;
}
#selectedTopicsText span { font-weight: 700; color: var(--brand-600); }

/* Custom input */
.input-custom-field {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 12px 18px;
    font-size: 1.05rem;
    color: var(--ink);
    outline: none;
    width: 160px;
    text-align: center;
    transition: var(--transition);
}
.input-custom-field:focus {
    border-color: var(--brand-400, var(--brand-300));
    box-shadow: 0 0 0 4px rgba(20,168,154,.15);
}

/* Test me button */
.btn-test-me {
    background: var(--brand-500);
    color: #fff;
    border: none;
    border-radius: var(--pill);
    padding: 14px 48px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: 0 8px 22px rgba(20,168,154,.35);
    transition: var(--transition);
}
.btn-test-me:hover:not(:disabled) {
    background: var(--brand-600);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(20,168,154,.45);
}
.btn-test-me:disabled {
    background: #cfdedb;
    color: #fff;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
}

/* ── 4. QUIZ RESULTS ─────────────────────────── */
.quiz-results-container h2,
.diagnostic-section h3,
.benchmark-faq-section h3 { font-family: var(--font-display); }

.quiz-result-card .card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
}
.quiz-result-card .card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.badge-quiz-number {
    background: var(--brand-500);
    color: #fff;
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    font-weight: 700;
}

.topics-label { color: var(--ink); font-size: .9rem; }
.topic-badge {
    display: inline-block;
    background: var(--brand-50);
    color: var(--brand-700);
    border: 1px solid var(--brand-100);
    border-radius: var(--pill);
    padding: 4px 12px;
    margin: 3px 3px 0 0;
    font-size: .78rem;
    font-weight: 600;
}

.score-numbers {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ink);
    margin-right: 6px;
}
.percentage-badge {
    display: inline-block;
    border-radius: var(--pill);
    padding: 4px 12px;
    font-size: .85rem;
    font-weight: 700;
}
.percentage-excellent  { background:#dcfce7; color:#15803d; }
.percentage-good       { background:#dbeafe; color:#1d4ed8; }
.percentage-average    { background:#fef3c7; color:#b45309; }
.percentage-needs-work { background:#fee2e2; color:#b91c1c; }

.no-quiz-history {
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--brand-200);
    border-radius: var(--radius);
    padding: 48px 24px;
    color: var(--muted);
}
.no-quiz-history i { font-size: 2.5rem; color: var(--brand-300); }

/* ── 5. DIAGNOSTIC SECTION ───────────────────── */
.diagnostic-section,
.diagnostic-section-teaser {
    background: linear-gradient(180deg, #ffffff 0%, var(--brand-50) 100%);
    border-top: 1px solid var(--border);
    margin-top: 0;
}
.diagnostic-section-title,
.diagnostic-section-teaser h2 {
    font-family: var(--font-display);
    color: var(--brand-700);
    font-weight: 400;
}

.diagnostic-card {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: var(--transition);
}
.diagnostic-card:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-3px);
}
.diagnostic-card .card-title { font-family: var(--font-display); color: var(--ink); }
.diagnostic-icon { color: var(--brand-500); font-size: 1.4rem; }

.diagnostic-threshold-bar .progress {
    border-radius: var(--pill);
    background: var(--brand-50);
}
.diagnostic-threshold-bar .progress-bar.bg-primary { background: var(--brand-500) !important; }

.btn-diagnostic,
.btn-diagnostic-login {
    background: var(--brand-500);
    color: #fff;
    border: none;
    border-radius: var(--pill);
    padding: 11px 26px;
    font-weight: 600;
    transition: var(--transition);
}
.btn-diagnostic:hover,
.btn-diagnostic-login:hover {
    background: var(--brand-600);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.diagnostic-history-table {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.diagnostic-history-table thead th {
    background: var(--brand-50);
    color: var(--brand-700);
    border: none;
    font-weight: 700;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
/* Force-center the diagnostic sign-in button everywhere */
.diagnostic-section-teaser .container.text-center .btn-diagnostic-login {
    display: flex !important;
    width: -moz-fit-content;
    width: fit-content;
    margin-left: auto !important;
    margin-right: auto !important;
    align-items: center;
    justify-content: center;
    gap: .4rem;
}
.diagnostic-history-table td { vertical-align: middle; }

/* ── 6. FEATURES SECTION ─────────────────────── */
.features-section {
    background-color: var(--brand-50);
    padding: 72px 0 80px;
}
.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 30px;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--brand-700);
    margin-bottom: .9rem;
}
.feature-card p {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ink-soft);
    margin-bottom: 0;
}

/* ── 7. BENCHMARK + FAQ ──────────────────────── */
.benchmark-faq-section {
    background-color: var(--surface);
    padding: 76px 0 84px;
}
.benchmark-title,
.faq-title {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--ink);
}
.benchmark-title { font-size: 1.9rem; margin-bottom: 1.2rem; }
.faq-title { font-size: 1.5rem; margin-bottom: 1.2rem; }

.benchmark-text {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--ink-soft);
}

.faq-accordion .accordion-item {
    border: 1px solid var(--border);
    margin-bottom: 10px;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.faq-accordion .accordion-button {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    background-color: var(--surface);
    color: var(--ink);
    padding: 18px 22px;
}
.faq-accordion .accordion-button:not(.collapsed) {
    background-color: var(--brand-50);
    color: var(--brand-700);
    box-shadow: none;
    transition: none;
}
.faq-accordion .accordion-button:focus {
    box-shadow: 0 0 0 .2rem rgba(20,168,154,.18);
}
.faq-accordion .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230e8a7e'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
   transition: transform 0.25s ease;
}
.faq-accordion .accordion-body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ink-soft);
    background-color: #fff;
    padding: 16px 22px 20px;
}
.faq-accordion .accordion-collapse {
    will-change: height;
}

@media (max-width: 767px) {
    /* Move the shadow off the animating item so it isn't repainted each frame */
    .faq-accordion .accordion-item {
        box-shadow: none;
    }
    .faq-accordion {
        box-shadow: var(--shadow-sm);
        border-radius: var(--radius-sm);
    }
    .faq-accordion .accordion-collapse { transition: none !important; }
}

.btn-signin-access {
    display: block;
    width: -moz-fit-content;
    width: fit-content;
    background-color: var(--accent);
    color: #fff !important;
    text-decoration: none !important;
    border: none;
    border-radius: var(--pill);
    padding: 12px 36px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    margin: 1.5rem auto 0;          /* auto left/right = centered */
    box-shadow: 0 6px 18px rgba(59,130,246,.3);
    transition: var(--transition);
}
.btn-signin-access:hover {
    background-color: var(--accent-dark);
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(59,130,246,.4);
}

/* ── 8. UPDATE MODAL ─────────────────────────── */
.update-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.update-card .card-header {
    background: var(--brand-500);
    color: #fff;
    border: none;
    padding: 18px 22px;
}
.update-card .card-header .card-title { font-family: var(--font-display); }
.update-card .card-header .btn-close { filter: brightness(0) invert(1); }
.scrollable-paragraph { max-height: 320px; overflow-y: auto; line-height: 1.7; }

.btn-modal-delete {
    background: #ef4444; color:#fff; border:none;
    border-radius: var(--pill); padding: 9px 22px; font-weight:600;
    transition: var(--transition);
}
.btn-modal-delete:hover { background:#dc2626; color:#fff; }
.btn-modal-cancel {
    background:#eef2f1; color: var(--ink-soft); border:none;
    border-radius: var(--pill); padding: 9px 22px; font-weight:600;
    transition: var(--transition);
}
.btn-modal-cancel:hover { background:#e2e8e6; }

/* ── 9. FOOTER ───────────────────────────────── */
.footer-menu {
    background-color: var(--surface) !important;
    border-top: 1px solid var(--border) !important;
    margin-top: 0 !important;
    padding: 2.5rem 0 1.5rem !important;
}

/* ── 10. SCROLL-REVEAL ANIMATIONS ────────────── */
.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .65s var(--ease), transform .65s var(--ease);
    will-change: opacity, transform;
}
.reveal.in-view { opacity: 1; transform: none; }

.features-section .col-lg-4:nth-child(2) .reveal,
.features-section .feature-card.reveal { transition-delay: .05s; }
.features-section .col-lg-4:nth-child(2) .feature-card.reveal { transition-delay: .12s; }
.features-section .col-lg-4:nth-child(3) .feature-card.reveal { transition-delay: .2s; }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1 !important; transform: none !important; transition: none; }
    * { scroll-behavior: auto !important; }
}

/* ── 11. RESPONSIVE ──────────────────────────── */
@media (max-width: 991px) {
    .feature-card { margin-bottom: 1.25rem; }
    .topic-group-card { margin-bottom: 1rem; }
}
@media (max-width: 767px) {
    .features-section   { padding: 48px 0 56px; }
    .benchmark-faq-section { padding: 48px 0; }
    .benchmark-title { font-size: 1.5rem; }
    .faq-title { font-size: 1.25rem; margin-top: 2rem; }
    .btn-manage-mcq-option, .question-btn { width: 56px; height: 56px; margin: 4px; }
    /* Center the diagnostic sign-in button on mobile */

}