/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

:root {
    --bg-1: var(--light);
    --panel: #ffffff;
    --muted: var(--gray);
    --accent: var(--primary);
    --accent-600: var(--primary-dark);
    --surface-2: #f1f5f9;
    --text: var(--dark);
    --radius: 12px;
    --gap: 16px;
    --shadow: 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);
    --btn-padding: 12px 18px;
    font-family: var(--font-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.skip {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
}

.skip:focus {
    left: 16px;
    top: 16px;
    width: auto;
    height: auto;
    padding: 8px 10px;
    background: #fff;
    border-radius: 6px;
    box-shadow: var(--shadow);
    z-index: 100;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 2rem;
}

@media (min-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr 420px;
        align-items: start;
    }

    .panel-bottom {
        grid-column: 1 / -1;
    }
}

.panel {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid #f1f5f9;
    transition: box-shadow 0.2s ease;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
}

.panel-head {
    margin-bottom: 16px;
}

.panel-head h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 700;
}

.panel-head .small {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.controls-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-wrap {
    flex: 1;
    min-width: 0;
    display: block;
}

#search {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    outline: none;
    font-size: 0.95rem;
    background: #fff;
    transition: all 0.2s ease;
}

#search:focus {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    border-color: var(--accent);
}

.symptom-list {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
    padding: 8px;
    margin-bottom: 16px;
}

@media (min-width: 700px) {
    .symptom-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.symptom {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #f1f5f9;
    background: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
}

.symptom:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: rgba(79, 70, 229, 0.2);
}

.symptom.selected {
    border-color: var(--accent);
    background: rgba(79, 70, 229, 0.03);
}

.symptom-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.symptom label {
    font-size: 0.95rem;
    cursor: pointer;
    font-weight: 500;
}

.symptom small {
    display: block;
    color: var(--muted);
    margin-top: 6px;
    font-size: 0.85rem;
}

.intensity {
    margin-left: auto;
    min-width: 110px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    transition: all 0.2s ease;
}

.intensity:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.actions-row {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.export-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.result-summary {
    margin-bottom: 16px;
    color: var(--muted);
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.suggestions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.suggestion {
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(79, 70, 229, 0.1);
    background: #fff;
    transition: all 0.2s ease;
}

.suggestion:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.suggestion h3 {
    margin: 0 0 12px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.percent-badge {
    margin-left: auto;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
}

.taglist {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.tag {
    font-size: 0.85rem;
    padding: 6px 10px;
    background: #eef2ff;
    border-radius: 6px;
    color: var(--accent);
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag:hover {
    background: #e0e7ff;
    transform: translateY(-1px);
}

.strategies {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: block;
}

.strategy {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.strategy:hover {
    background: #f8fafc;
}

.strategy button.copy {
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: 600;
    min-width: 70px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.pattern-insights {
    margin-top: 16px;
    padding: 16px;
    background: var(--surface-2);
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.pattern-item {
    padding: 16px;
    background: #fff;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.pattern-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    max-height: 360px;
    overflow: auto;
    padding: 8px;
}

.hist-item {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #f1f5f9;
    background: #fff;
    transition: all 0.2s ease;
}

.hist-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.hist-left {
    font-size: 0.95rem;
}

.hist-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.hist-metadata {
    font-size: 0.9rem;
    color: var(--muted);
    text-align: right;
    min-width: 180px;
}

.charts {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

@media (min-width: 900px) {
    .charts {
        flex-direction: row;
    }
}

.chart-wrap {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid #f1f5f9;
}

canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
    background: #fff;
}

dialog {
    border: none;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 90vw;
    width: 500px;
}

.dialog-form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.9rem;
    color: var(--muted);
}

.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease both;
}

@media (hover: none) {
    .symptom {
        padding: 18px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .panel {
        padding: 16px;
    }

    .symptom {
        padding: 14px;
    }

    .hist-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .hist-metadata {
        text-align: left;
        width: 100%;
    }

    .export-actions {
        flex-direction: column;
        width: 100%;
    }

    .export-actions .btn {
        width: 100%;
    }

    .charts {
        gap: 16px;
    }

    .chart-wrap {
        padding: 12px;
    }
}

.loading {
    opacity: 0.7;
    pointer-events: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.hero-banner {
    margin-top: 20px;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

main {
    margin-top: 80px;
    min-height: calc(100vh - 160px);
}

dialog {
    z-index: 2000;
}

details summary {
    cursor: pointer;
    padding: 10px;
    background: var(--surface-2);
    border-radius: var(--radius);
    font-weight: 500;
}

details[open] summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

details > p {
    padding: 15px;
    background: var(--surface-2);
    border-top: none;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    margin-top: 0;
}

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

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

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

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

.btn.ghost {
    background: transparent;
    border: none;
    color: var(--primary);
}

.btn.ghost:hover {
    background: rgba(37, 99, 235, 0.1);
}

#symptom-heading,
#results-heading,
#history-heading {
    color: var(--primary);
}