/* ============================================================
   Web Accessibility Checklist — Styles
   Modern dark-first design with purple primary
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #8B5CF6;
    --primary-light: #A78BFA;
    --primary-dark: #7C3AED;
    --bg: #0F172A;
    --bg-elevated: #1E293B;
    --bg-surface: #334155;
    --bg-card: #1E293B;
    --bg-hover: #2D3B55;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: #334155;
    --success: #22C55E;
    --success-bg: rgba(34, 197, 94, .08);
    --warning: #EAB308;
    --warning-bg: rgba(234, 179, 8, .08);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, .08);
    --info: #3B82F6;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 50px;
    --shadow: 0 4px 16px rgba(0, 0, 0, .3);
    --transition: 200ms ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="light"] {
    --bg: #F8FAFC;
    --bg-elevated: #FFFFFF;
    --bg-surface: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-hover: #E2E8F0;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.app {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 16px 100px;
}

/* --- Header --- */
.header {
    text-align: center;
    padding: 32px 0 24px;
}

.header-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-top: 4px;
}

/* --- Toolbar --- */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .9rem;
    outline: none;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn:hover {
    background: var(--bg-hover);
}

.btn:active {
    transform: scale(.97);
}

.btn-primary {
    background: var(--primary-dark);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: .8rem;
}

/* --- Progress Bar --- */
.progress-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.progress-label {
    font-size: .85rem;
    font-weight: 600;
}

.progress-stats {
    display: flex;
    gap: 16px;
    font-size: .8rem;
    color: var(--text-secondary);
}

.progress-bar {
    height: 8px;
    background: var(--bg-surface);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    transition: width .5s ease;
}

/* --- Level Filter --- */
.level-filter {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.level-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.level-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.level-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* --- Category Sections --- */
.category {
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--transition);
}

.category-header:hover {
    background: var(--bg-hover);
}

.category-icon {
    font-size: 1.2rem;
}

.category-title {
    font-weight: 700;
    font-size: .95rem;
    flex: 1;
}

.category-count {
    font-size: .75rem;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-surface);
    color: var(--text-muted);
}

.category-chevron {
    color: var(--text-muted);
    transition: transform var(--transition);
}

.category.open .category-chevron {
    transform: rotate(180deg);
}

.category-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.category.open .category-body {
    max-height: 5000px;
}

/* --- Checklist Items --- */
.check-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.check-item:last-child {
    border-bottom: none;
}

.check-item:hover {
    background: var(--bg-hover);
}

.check-item.checked {
    opacity: .6;
}

.check-item.checked .check-text {
    text-decoration: line-through;
}

.check-box {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition);
    font-size: .75rem;
    margin-top: 2px;
}

.check-item.checked .check-box {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.check-content {
    flex: 1;
    min-width: 0;
}

.check-text {
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.check-desc {
    font-size: .8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.check-level {
    font-size: .65rem;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    flex-shrink: 0;
    margin-top: 2px;
}

.check-level.a {
    background: var(--success-bg);
    color: var(--success);
}

.check-level.aa {
    background: rgba(139, 92, 246, .1);
    color: var(--primary);
}

.check-level.aaa {
    background: var(--warning-bg);
    color: var(--warning);
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: .85rem;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .toolbar {
        gap: 6px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .progress-stats {
        gap: 8px;
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}