/* ==========================================
   ADA Compliance Checker - Styles
   SeenLabs 2024
   ========================================== */

:root {
    --primary: var(--sl-blue-primary);
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border: #e2e8f0;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --transition: 200ms ease;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border: #334155;
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header__logo-img {
    height: 36px;
    border-radius: var(--radius-sm);
}

.header__title-group {
    display: flex;
    flex-direction: column;
}

.header__brand {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header__title {
    font-size: 1.125rem;
    font-weight: 700;
}

.header__actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-main);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.btn--secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border-color: var(--border);
}

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

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn--ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn--icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.btn--lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn--full {
    width: 100%;
}

/* Theme Toggle */
.theme-toggle {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.icon-sun {
    display: none;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

[data-theme="dark"] .icon-sun {
    display: block;
}

/* Main Layout */
.main {
    flex: 1;
    display: grid;
    grid-template-columns: 280px 1fr;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Page Title (H1 for SEO) */
.page-title {
    grid-column: 1 / -1;
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    padding: 1.5rem 2rem 0.5rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    margin: 0;
}

/* Sidebar */
.sidebar {
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 65px;
    height: calc(100vh - 65px);
}

.compliance-score {
    text-align: center;
}

.compliance-score__circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border: 6px solid var(--text-tertiary);
    transition: border-color var(--transition);
}

.compliance-score__circle.score--high {
    border-color: var(--success);
}

.compliance-score__circle.score--medium {
    border-color: var(--warning);
}

.compliance-score__circle.score--low {
    border-color: var(--danger);
}

.compliance-score__value {
    font-size: 2.5rem;
    font-weight: 800;
}

.compliance-score__label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.risk-level {
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.risk-level__label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.risk-level__value {
    font-weight: 700;
    font-size: 1rem;
}

.risk-level--low .risk-level__value {
    color: var(--success);
}

.risk-level--medium .risk-level__value {
    color: var(--warning);
}

.risk-level--high .risk-level__value {
    color: var(--danger);
}

.risk-level--unknown .risk-level__value {
    color: var(--text-tertiary);
}

.section-scores h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.section-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.section-score__icon {
    font-size: 1.25rem;
}

.section-score__name {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.section-score__value {
    font-weight: 600;
    font-size: 0.875rem;
}

/* Content */
.content {
    padding: 2rem;
    max-width: 900px;
}

/* Progress */
.progress {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    width: 0%;
    transition: width 0.3s ease;
}

/* Checklist Section */
.checklist-section {
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-header__icon {
    font-size: 2rem;
}

.section-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Checklist Items */
.checklist {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.checklist-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
}

.checklist-item.answered--yes {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.checklist-item.answered--no {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.checklist-item.answered--unknown {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.05);
}

.checklist-item__content {
    flex: 1;
}

.checklist-item__content h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.checklist-item__content p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.checklist-item__ref {
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

.checklist-item__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Check Buttons */
.check-btn {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.check-btn:hover {
    border-color: var(--text-tertiary);
}

.check-btn--yes.active {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.check-btn--no.active {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.check-btn--unknown.active {
    background: var(--warning);
    border-color: var(--warning);
    color: white;
}

/* Results Summary */
.results-summary {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-top: 2rem;
}

.results-summary h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.results-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.result-card__label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.result-card__value {
    font-size: 1.5rem;
    font-weight: 700;
}

.result-card--score .result-card__value {
    color: var(--primary);
}

.result-card--risk.risk--low .result-card__value {
    color: var(--success);
}

.result-card--risk.risk--medium .result-card__value {
    color: var(--warning);
}

.result-card--risk.risk--high .result-card__value {
    color: var(--danger);
}

.issues-list,
.remediation-section {
    margin-bottom: 2rem;
}

.issues-list h3,
.remediation-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.no-issues,
.no-items {
    color: var(--text-tertiary);
    font-style: italic;
}

.issue-item,
.remediation-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.issue-item__severity {
    width: 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.issue-item__severity--critical {
    background: var(--danger);
}

.issue-item__severity--high {
    background: var(--warning);
}

.issue-item__severity--medium {
    background: var(--info);
}

.issue-item__content h4 {
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.issue-item__content p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.remediation-item {
    align-items: flex-start;
}

.remediation-item__number {
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.remediation-item__content h4 {
    font-size: 0.875rem;
}

.remediation-item__content p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* CTA */
.cta-section {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(14, 165, 233, 0.1));
    border-radius: var(--radius-lg);
}

.cta-section p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Footer */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer p {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    max-width: 600px;
}

.footer__links {
    display: flex;
    gap: 1.5rem;
}

.footer__links a {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.footer__links a:hover {
    color: var(--primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .main {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .section-scores {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .content {
        padding: 1rem;
    }

    .checklist-item {
        flex-direction: column;
    }

    .checklist-item__actions {
        width: 100%;
        justify-content: stretch;
    }

    .check-btn {
        flex: 1;
    }

    .results-cards {
        grid-template-columns: 1fr;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .cta-buttons .btn {
        width: 100%;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }
}

/* ==========================================
   FAQ & Methodology Modals
   ========================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    overflow-y: auto;
    padding: var(--space-xl);
}

.modal-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.modal-overlay.active .modal {
    display: block !important;
    position: relative !important;
    opacity: 1 !important;
    visibility: visible !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
}

.faq-modal,
.methodology-modal {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
    margin: var(--space-xl) 0;
}

.modal__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xl);
}

.faq-modal__content {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.faq__item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq__question {
    display: block;
    padding: var(--space-md);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    background: var(--bg-secondary);
}

.faq__question:hover {
    color: var(--primary);
}

.faq__answer {
    padding: var(--space-md);
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.methodology-modal__content {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.methodology-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.methodology-section p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.methodology-section ul {
    margin: var(--space-sm) 0 0 var(--space-lg);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.methodology-section ul li {
    margin-bottom: var(--space-xs);
}

.methodology-section--sources {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.btn__icon-text {
    font-weight: 700;
    font-size: 1rem;
}

/* ==========================================
   Mobile & Accessibility Hardening Layer
   ========================================== */

/* Touch Targets (WCAG 2.1 Target Size) */
.theme-toggle,
.btn--icon,
button,
select,
input[type="text"],
input[type="email"],
input[type="number"],
.form-control,
.btn {
    min-height: 44px;
    /* Accessible touch target */
}

/* Fix iOS Input Zoom & Tap Area */
@media (max-width: 768px) {

    input,
    select,
    textarea {
        font-size: 16px !important;
        /* Prevents auto-zoom on iOS */
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}/* Close Button Fix */
.modal__close,
.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 10;
    padding: 0.5rem;
    transition: color 0.2s;
}

.modal__close:hover,
.modal-close:hover {
    color: var(--danger);
}