@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Merriweather:ital,wght@0,400;0,700;1,400&display=swap');

:root {
    --bg: #f5f5f0;
    --surface: #ffffff;
    --surface-hover: #fafaf8;
    --text: #1a1a1a;
    --text-2: #6b6b6b;
    --text-3: #a0a0a0;
    --border: #e5e5e0;
    --border-hover: #d0d0c8;
    --accent: #2d2d2d;
    --accent-hover: #000;
    --accent-glow: rgba(45, 45, 45, 0.08);
    --success: #16a34a;
    --success-bg: rgba(22, 163, 74, 0.08);
    --error: #dc2626;
    --error-bg: rgba(220, 38, 38, 0.06);
    --warning-bg: rgba(234, 179, 8, 0.1);
    --warning: #ca8a04;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --serif: 'Merriweather', Georgia, serif;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.1);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: var(--serif);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.4rem;
}

h3 {
    font-size: 1.15rem;
}

/* ========= LAYOUT ========= */
.container {
    max-width: 940px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

/* ========= AUTH PAGE ========= */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(120, 119, 198, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 119, 48, 0.04) 0%, transparent 50%),
        linear-gradient(180deg, #f0f0ec 0%, #e8e8e2 100%);
    padding: 1rem;
}

.card {
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
    animation: cardAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #555, var(--accent));
    background-size: 200% 100%;
    animation: shimmerBar 3s ease-in-out infinite;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shimmerBar {

    0%,
    100% {
        background-position: 200% 0;
    }

    50% {
        background-position: -200% 0;
    }
}

.card h2 {
    text-align: center;
    margin-bottom: 0.4rem;
    font-size: 1.5rem;
}

.card .subtitle {
    text-align: center;
    color: var(--text-2);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* ========= FORM ELEMENTS ========= */
.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-2);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--transition);
}

.form-group:focus-within label {
    color: var(--accent);
}

input[type="text"],
input[type="password"],
input[type="email"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    transition: all var(--transition);
    outline: none;
}

input::placeholder {
    color: var(--text-3);
}

input:hover {
    border-color: var(--border-hover);
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--surface);
}

/* ========= BUTTONS ========= */
.btn-primary {
    width: 100%;
    padding: 0.85rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s;
}

.btn-primary:hover:not(:disabled)::after {
    transform: translateX(100%);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ========= DASHBOARD HEADER ========= */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #1a1a1a, #555);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.03);
    padding: 4px;
    border-radius: var(--radius);
}

.nav-links button {
    background: none;
    border: none;
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text-2);
    cursor: pointer;
    padding: 0.45rem 0.85rem;
    border-radius: calc(var(--radius) - 2px);
    transition: all var(--transition);
    font-weight: 500;
    position: relative;
}

.nav-links button:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
}

.nav-links button.active {
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* ========= TEST CARDS ========= */
.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.test-card {
    background: var(--surface);
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.test-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 0;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
    transition: height var(--transition-spring);
}

.test-card:hover::before {
    height: 100%;
}

.test-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.test-card:active {
    transform: translateY(-1px) scale(0.99);
}

.test-card h3 {
    font-size: 1.05rem;
    margin-bottom: 0.6rem;
}

.test-card p {
    font-size: 0.88rem;
    color: var(--text-2);
    margin-bottom: 1.25rem;
    line-height: 1.55;
}

.test-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    background: var(--bg);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-2);
    transition: all var(--transition);
    white-space: nowrap;
}

.status-badge.completed {
    background: var(--success-bg);
    color: var(--success);
}

.test-card:hover .status-badge {
    background: var(--accent);
    color: white;
    transform: translateX(3px);
}

/* ========= STAGGER ANIMATION ========= */
.stagger-in {
    animation: staggerFade 0.5s ease-out both;
}

.stagger-in:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-in:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-in:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-in:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger-in:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-in:nth-child(6) {
    animation-delay: 0.3s;
}

@keyframes staggerFade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========= TEST RUNNER OVERLAY ========= */
.test-runner-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 100;
    overflow-y: auto;
    padding: 2rem;
    animation: overlayIn 0.3s ease-out;
}

@keyframes overlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.quiz-container {
    max-width: 700px;
    margin: 0 auto;
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    animation: quizSlideUp 0.4s var(--transition-spring);
}

@keyframes quizSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========= QUIZ PROGRESS BAR ========= */
.quiz-progress {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #555);
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.quiz-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: -2px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* ========= QUESTIONS ========= */
.question-block {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    animation: staggerFade 0.4s ease-out both;
}

.question-block:last-of-type {
    border-bottom: none;
}

.question-text {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    font-family: var(--serif);
    line-height: 1.6;
    color: var(--text);
}

.question-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--sans);
    margin-right: 0.6rem;
    flex-shrink: 0;
    vertical-align: middle;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.option-item {
    padding: 0.9rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.option-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition);
}

.option-item:hover {
    border-color: var(--border-hover);
    background: var(--surface-hover);
    transform: translateX(3px);
}

.option-item.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.option-item.selected::after {
    content: '✓';
    position: absolute;
    right: 1rem;
    font-weight: 700;
    color: var(--accent);
    animation: checkPop 0.3s var(--transition-spring);
}

@keyframes checkPop {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.option-item input[type="radio"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.option-item span {
    position: relative;
    z-index: 1;
}

/* ========= RESULT SCREEN ========= */
.result-screen {
    text-align: center;
    padding: 3rem 1.5rem;
    animation: resultPop 0.6s var(--transition-spring);
}

@keyframes resultPop {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    60% {
        transform: scale(1.03);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.result-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 0.6s ease-out 0.3s both;
}

@keyframes bounce {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    50% {
        transform: translateY(-8px);
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.result-score {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: var(--sans);
    background: linear-gradient(135deg, var(--accent), #666);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    animation: countUp 0.8s ease-out 0.4s both;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========= TABLES ========= */
.admin-table-container {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

th,
td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: linear-gradient(180deg, var(--bg), #eeeee8);
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

td {
    font-size: 0.92rem;
}

tr {
    transition: background var(--transition);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(0, 0, 0, 0.015);
}

/* ========= ACTION BUTTONS ========= */
.action-btn {
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    font-weight: 500;
    transition: all var(--transition);
}

.action-btn:hover {
    background: var(--bg);
    transform: translateY(-1px);
}

.delete-btn {
    color: var(--error);
    border-color: rgba(220, 38, 38, 0.3);
}

.delete-btn:hover {
    background: var(--error-bg);
    border-color: var(--error);
}

/* ========= ALERTS / TOAST ========= */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: alertSlide 0.35s var(--transition-spring);
}

@keyframes alertSlide {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(220, 38, 38, 0.15);
}

.alert-error::before {
    content: '⚠';
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.15);
}

.alert-success::before {
    content: '✓';
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.alert-warning::before {
    content: '!';
}

/* ========= LOADING STATES ========= */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, #eaeae4 37%, var(--border) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: var(--radius);
    min-height: 80px;
}

@keyframes shimmer {
    from {
        background-position: 100% 50%;
    }

    to {
        background-position: 0 50%;
    }
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    color: var(--text-3);
    padding: 4rem 1rem;
    font-size: 0.95rem;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

/* ========= PAGE TRANSITIONS ========= */
.view-enter {
    animation: viewEnter 0.35s ease-out;
}

.view-exit {
    animation: viewExit 0.2s ease-in forwards;
}

@keyframes viewEnter {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes viewExit {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-10px);
    }
}

/* ========= UTILITIES ========= */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========= ERROR BANNER ========= */
.error-banner {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    animation: toastIn 0.4s var(--transition-spring);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-banner.hiding {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
}

/* ========= DIAGNOSTIC QUIZ ========= */
.diag-intro {
    text-align: center;
    padding: 2rem 1rem;
    max-width: 650px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

.diag-intro h2 {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

.diag-intro-text {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-2);
    box-shadow: var(--shadow-sm);
}

.diag-method {
    max-width: 700px;
    margin: 0 auto;
    background: var(--surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.diag-breadcrumb {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.diag-instruction {
    color: var(--text-2);
    font-size: 0.92rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    line-height: 1.6;
}

.question-counter {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

/* Checkbox variant for multi-select */
.checkbox-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.checkbox-item.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.multi-select-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.hint-text {
    font-size: 0.82rem;
    color: var(--text-3);
    margin-bottom: 1rem;
    font-style: italic;
}

/* Text input for open answers */
.text-input {
    width: 100%;
    padding: 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    transition: all var(--transition);
    outline: none;
    margin-bottom: 1.25rem;
    min-height: 80px;
    line-height: 1.5;
}

.text-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--surface);
}

textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    transition: all var(--transition);
    outline: none;
}

textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--surface);
}

select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    transition: all var(--transition);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236b6b6b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Small button variant */
.btn-sm {
    width: auto;
    padding: 0.6rem 1.5rem;
    font-size: 0.88rem;
    margin-top: 0.75rem;
}

/* ========= DIAGNOSTIC RESULTS ========= */
.diag-results {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 1rem 0;
}

.result-score-big {
    font-size: 3rem;
    font-weight: 800;
    font-family: var(--sans);
    background: linear-gradient(135deg, var(--accent), #666);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.result-level-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 2rem;
}

.result-level-badge.level-1 {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.result-level-badge.level-2 {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.25);
}

.result-level-badge.level-3 {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.criterion-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: left;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    animation: staggerFade 0.4s ease-out both;
}

.criterion-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.criterion-score {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-2);
}

.level-text {
    font-weight: 700;
}

.level-text.level-1 {
    color: var(--error);
}

.level-text.level-2 {
    color: var(--warning);
}

.level-text.level-3 {
    color: var(--success);
}

.criterion-desc {
    font-size: 0.88rem;
    color: var(--text-2);
    line-height: 1.6;
}

.ai-analysis-card,
.recommendation-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: left;
    margin-top: 1rem;
    box-shadow: var(--shadow-sm);
}

.ai-analysis-card h3,
.recommendation-card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.ai-analysis-card p,
.recommendation-text {
    font-size: 0.88rem;
    color: var(--text-2);
    line-height: 1.7;
}

.recommendation-text b {
    color: var(--text);
}

.diagnostic-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    background: linear-gradient(135deg, #2d2d2d, #555);
    color: white;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: var(--sans);
    vertical-align: middle;
    letter-spacing: 0.3px;
}

/* ========= TEST BUILDER ========= */
.builder-form {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.builder-questions-list {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.builder-question {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    animation: staggerFade 0.3s ease-out both;
}

.builder-q-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.builder-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.92rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: all var(--transition);
    margin-bottom: 0.75rem;
}

.builder-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.builder-scoring-type {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-2);
}

.builder-scoring-type label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: none;
    font-weight: 500;
    cursor: pointer;
}

.builder-scoring-type input[type="radio"] {
    accent-color: var(--accent);
}

.builder-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.builder-option {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.builder-option input[type="text"] {
    flex: 1;
    padding: 0.55rem 0.75rem;
    font-size: 0.88rem;
}

.score-input {
    width: 55px !important;
    padding: 0.55rem 0.4rem !important;
    text-align: center;
    font-size: 0.88rem !important;
    font-weight: 600;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius) !important;
    background: var(--surface) !important;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.correct-radio {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--success);
    text-transform: none;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.correct-radio input[type="radio"] {
    accent-color: var(--success);
}

.builder-labels-section {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.builder-labels-section summary {
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-2);
}

@keyframes overlayOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ========= RESPONSIVE ========= */
@media (max-width: 640px) {
    .container {
        padding: 1rem 1rem 3rem;
    }

    .card {
        padding: 1.75rem;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-links {
        justify-content: center;
    }

    .nav-links button {
        font-size: 0.82rem;
        padding: 0.4rem 0.6rem;
    }

    .test-grid {
        grid-template-columns: 1fr;
    }

    .quiz-container {
        padding: 1.5rem;
    }

    .question-text {
        font-size: 0.95rem;
    }

    #create-user-form {
        grid-template-columns: 1fr !important;
    }

    table {
        min-width: 400px;
    }

    th,
    td {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    .result-score {
        font-size: 2.5rem;
    }

    h1 {
        font-size: 1.4rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}