/* Bootstrap 5 Variable Overrides (ADHD-friendly palette) — loaded BEFORE Bootstrap CDN */
:root {
    --bs-body-bg: #f0f4f8;
    --bs-body-color: #334155;
    --bs-primary: #7c9eb2;
    --bs-primary-rgb: 124, 158, 178;
    --bs-secondary: #94a3b8;
    --bs-secondary-rgb: 148, 163, 184;
    --bs-success: #86b89c;
    --bs-success-rgb: 134, 184, 156;
    --bs-danger: #d4919b;
    --bs-danger-rgb: 212, 145, 155;
    --bs-warning: #e8c87a;
    --bs-warning-rgb: 232, 200, 122;
    --bs-info: #82a3b8;
    --bs-info-rgb: 130, 163, 184;
    --bs-light: #f0f4f8;
    --bs-dark: #334155;
    --bs-border-color: #cbd5e1;
    --bs-card-bg: #ffffff;
    --bs-link-color: #7c9eb2;
}

/* ── Override precompiled Bootstrap color classes ── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 50%, #f0f4f8 100%);
    background-size: 400% 400%;
    animation: bgShift 20s ease infinite;
    color: #334155 !important;
    min-height: 100vh;
}

@keyframes bgShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.bg-primary { background-color: #7c9eb2 !important; }
.text-primary { color: #7c9eb2 !important; }
.bg-success { background-color: #86b89c !important; }
.text-success { color: #86b89c !important; }
.bg-danger { background-color: #d4919b !important; }
.text-danger { color: #d4919b !important; }
.bg-warning { background-color: #e8c87a !important; }
.text-warning { color: #e8c87a !important; }
.bg-info { background-color: #82a3b8 !important; }
.text-info { color: #82a3b8 !important; }
.bg-dark { background-color: #334155 !important; }
.text-dark { color: #334155 !important; }

.btn-primary {
    background-color: #7c9eb2 !important;
    border-color: #7c9eb2 !important;
    transition: all 0.2s ease !important;
}
.btn-primary:hover, .btn-primary:focus {
    background-color: #6b8da3 !important;
    border-color: #6b8da3 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 158, 178, 0.4);
}

.btn-success {
    background-color: #86b89c !important;
    border-color: #86b89c !important;
    color: #fff !important;
    transition: all 0.2s ease !important;
}
.btn-success:hover {
    background-color: #76a88c !important;
    border-color: #76a88c !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(134, 184, 156, 0.4);
}

.btn-danger {
    background-color: #d4919b !important;
    border-color: #d4919b !important;
    color: #fff !important;
    transition: all 0.2s ease !important;
}
.btn-danger:hover {
    background-color: #c4818b !important;
    border-color: #c4818b !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 145, 155, 0.4);
}

.btn-outline-secondary {
    color: #334155 !important;
    border-color: #cbd5e1 !important;
}
.btn-outline-secondary:hover {
    background-color: #f0f4f8 !important;
    border-color: #94a3b8 !important;
}

.btn-outline-light {
    color: #fff !important;
    border-color: rgba(255,255,255,0.5) !important;
}

.alert-danger {
    color: #8a3a3f !important;
    background-color: #fde8eb !important;
    border-color: #f5c6cc !important;
}

.alert-info {
    color: #3a6070 !important;
    background-color: #e8f0f5 !important;
    border-color: #bee5eb !important;
}

.badge.bg-secondary {
    background-color: #94a3b8 !important;
    color: #fff !important;
}

.spinner-border.text-primary {
    border-color: #7c9eb2 !important;
}

/* ── Quiz card styles ── */
.quiz-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-radius: 1rem !important;
    overflow: hidden;
    animation: fadeInUp 0.5s ease backwards;
}

.quiz-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 1rem 2.5rem rgba(124, 158, 178, 0.25) !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for cards */
.col-md-6:nth-child(1) .quiz-card { animation-delay: 0.05s; }
.col-md-6:nth-child(2) .quiz-card { animation-delay: 0.1s; }
.col-md-6:nth-child(3) .quiz-card { animation-delay: 0.15s; }
.col-md-6:nth-child(4) .quiz-card { animation-delay: 0.2s; }
.col-md-6:nth-child(5) .quiz-card { animation-delay: 0.25s; }
.col-md-6:nth-child(6) .quiz-card { animation-delay: 0.3s; }

/* ── Answer button animation ── */
.d-grid .btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border-radius: 0.75rem !important;
}
.d-grid .btn:active {
    transform: scale(0.97) !important;
}

/* ── Score result animation ── */
.display-1.my-4 {
    animation: scoreReveal 0.6s ease-out;
}
@keyframes scoreReveal {
    from {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.1);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ── Navbar glow effect ── */
.navbar {
    box-shadow: 0 2px 12px rgba(51, 65, 85, 0.15);
    backdrop-filter: blur(10px);
}

/* ── Form input focus glow ── */
.form-control:focus {
    box-shadow: 0 0 0 3px rgba(124, 158, 178, 0.25);
    border-color: var(--bs-primary);
}

/* ── Table row hover ── */
.table-hover tbody tr:hover {
    background-color: rgba(124, 158, 178, 0.08) !important;
    transition: background-color 0.2s ease;
}

/* ── Alert animation ── */
.alert {
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Progress bar pulse ── */
.progress-bar {
    transition: width 0.3s ease;
    animation: progressShimmer 2s ease infinite;
}
@keyframes progressShimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* ── Card shadow enhancement ── */
.shadow-sm {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06) !important;
}

/* ── Dropdown animation ── */
.dropdown-menu {
    animation: dropIn 0.2s ease;
    border: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-radius: 0.75rem;
}
@keyframes dropIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Validation ── */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #86b89c;
}

.invalid {
    outline: 1px solid #d4919b;
}

.validation-message {
    color: #d4919b;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    padding: 1rem;
    color: white;
    background: #b32121;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #7c9eb2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #7c9eb2;
}
