:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #a855f7;
    --accent: #f43f5e;
    --bg-main: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: rgba(226, 232, 240, 0.8);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --body-gradient: radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-main);
    background-image: var(--body-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    padding: 2rem 1rem;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: #fff;
    margin-bottom: 1rem;
}

.title-section {
    text-align: center;
    margin-bottom: 3rem;
}

.title-section h1 {
    font-size: 2.5rem;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.title-section p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
}

/* Form Elements */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
    color: var(--text-main);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: #fff;
}

button {
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    width: 100%;
    margin-top: 2rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-word {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 600;
}

/* Steps & Progress */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.step-dot.active {
    background: var(--primary-light);
    box-shadow: 0 0 10px var(--primary-light);
}

/* Sidebar / Settings */
.settings-trigger {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 0.75rem;
    border-radius: 50%;
    color: var(--text-main);
    box-shadow: var(--shadow-md);
}

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 350px;
    background: #fff;
    z-index: 1000;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    padding: 2.5rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.settings-panel.open {
    transform: translateX(0);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
}

.data-table tr td:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.data-table tr td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* Tab Buttons */
.tab-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-button {
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: auto;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-main);
}

.tab-button:hover {
    background: var(--bg-main);
}

.tab-button.active {
    background: var(--text-main);
    color: white;
    border-color: var(--text-main);
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   Responsive Design & Accessibility
   ═══════════════════════════════════════════════════════════════ */

/* Focus styles for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Touch-friendly minimum sizes */
button,
input,
select,
textarea,
a {
    min-height: 44px;
    min-width: 44px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    body {
        padding: 1.5rem 1rem;
    }

    .title-section h1 {
        font-size: 2rem;
    }

    .glass-card {
        padding: 1.5rem;
    }

    .settings-panel {
        width: 320px;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.75rem;
        font-size: 16px;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .title-section {
        margin-bottom: 2rem;
    }

    .title-section h1 {
        font-size: 1.75rem;
    }

    .glass-card {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }

    .settings-panel {
        width: 100%;
        max-width: 100vw;
        padding: 1.5rem;
    }

    .settings-trigger {
        top: 1rem;
        right: 1rem;
        padding: 0.5rem;
    }

    .btn-primary {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .report-content {
        padding: 1.5rem;
        font-size: 1rem;
    }

    label {
        font-size: 0.8rem;
    }

    input,
    select,
    textarea {
        padding: 0.625rem 0.875rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Small mobile (max-width: 480px) */
@media (max-width: 480px) {
    body {
        padding: 0.75rem 0.5rem;
    }

    .title-section h1 {
        font-size: 1.5rem;
    }

    .title-section p {
        font-size: 1rem;
    }

    .glass-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .btn-primary {
        padding: 0.75rem 1rem;
    }

    .report-content {
        padding: 1rem;
    }

    .report-content h1 { font-size: 1.5rem; }
    .report-content h2 { font-size: 1.25rem; }
    .report-content h3 { font-size: 1.1rem; }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass-card {
        border-width: 2px;
    }

    input,
    select,
    textarea {
        border-width: 2px;
    }

    button {
        border: 2px solid currentColor;
    }
}

/* Print styles */
@media print {
    .settings-trigger,
    .settings-panel,
    .overlay,
    .btn-primary {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .glass-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }

    .report-content {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Version Badge */
.version-badge {
    display: inline-block;
    font-size: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 2px 10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* Report View (Rendered Markdown) */
.report-content {
    background: #fff;
    padding: 3rem;
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    font-size: 1.05rem;
    line-height: 1.8;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.report-content h1 { font-size: 1.8rem; color: #1e293b; margin-bottom: 1rem; border-bottom: 2px solid var(--primary); padding-bottom: 0.5rem; }
.report-content h2 { font-size: 1.4rem; color: #334155; margin-top: 1.5rem; margin-bottom: 0.75rem; }
.report-content h3 { font-size: 1.15rem; color: #475569; margin-top: 1.25rem; margin-bottom: 0.5rem; }
.report-content p { margin-bottom: 0.75rem; }
.report-content ul, .report-content ol { margin-bottom: 0.75rem; padding-left: 1.5rem; }
.report-content li { margin-bottom: 0.25rem; }
.report-content strong { color: #1e293b; }
.report-content table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.report-content th, .report-content td { border: 1px solid #cbd5e1; padding: 0.5rem; text-align: left; }
.report-content th { background: #f1f5f9; font-weight: 600; }
.report-content blockquote { border-left: 4px solid var(--primary); padding-left: 1rem; margin-left: 0; color: #64748b; }
