/* SpringerBK — Extended CSS
   Supplements the base design system in base.html with modal, tab,
   totals bar, accordion, and other component styles. */

/* ─── Alpine.js Cloak ──────────────────────────────────────────────────── */
[x-cloak] { display: none !important; }

/* ─── Modal Overlay ────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}
.modal {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}
.modal-dialog {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
}
.modal-lg, .modal-dialog.modal-lg { max-width: 800px; }
.modal-sm, .modal-dialog.modal-sm { max-width: 420px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; }
.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Tabs ─────────────────────────────────────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    overflow-x: auto;
}
.tab-btn {
    padding: 0.625rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    font-family: inherit;
}
.tab-btn:hover {
    color: var(--text);
    background: var(--surface-2);
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── Totals Bar ───────────────────────────────────────────────────────── */
.totals-bar {
    position: sticky;
    bottom: 0;
    background: #f8f9fa;
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    z-index: 50;
    font-size: 0.85rem;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.04);
}
.totals-bar .total-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.totals-bar .total-label {
    color: var(--text-muted);
    font-size: 0.725rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.totals-bar .total-value {
    font-weight: 700;
    font-size: 1rem;
}
.totals-bar .total-value.positive { color: var(--success); }
.totals-bar .total-value.negative { color: var(--danger); }
.totals-bar .total-value.neutral { color: var(--accent); }

/* ─── Accordion ────────────────────────────────────────────────────────── */
.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    cursor: pointer;
    margin-bottom: 0.25rem;
    transition: background 0.1s;
}
.accordion-header:hover { background: #e9ecef; }
.accordion-header .acc-title {
    font-size: 0.85rem;
    font-weight: 600;
}
.accordion-header .acc-badge {
    font-size: 0.7rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}
.accordion-header .acc-arrow {
    color: var(--text-dim);
    transition: transform 0.2s;
    font-size: 0.7rem;
}
.accordion-header[aria-expanded="true"] .acc-arrow {
    transform: rotate(90deg);
}
.accordion-body {
    padding: 1rem;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    margin-bottom: 0.75rem;
}

/* ─── Completion Dots (sidebar) ────────────────────────────────────────── */
.sidebar-item .completion-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.375rem;
}
.completion-dot.complete { background: #2ecc71; }
.completion-dot.partial { background: #f1c40f; }
.completion-dot.empty { background: #7f8c8d; }

/* ─── Progress Bar ─────────────────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar .progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ─── Status Badges (dashboard) ────────────────────────────────────────── */
.case-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    transition: all 0.1s;
}
.case-card:hover {
    border-color: var(--accent);
    background: #f8f9fa;
}
.case-card .case-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.case-card .case-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ─── SOFA Yes/No Toggle ──────────────────────────────────────────────── */
.yes-no-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    overflow: hidden;
}
.yes-no-toggle button {
    padding: 0.375rem 1rem;
    border: none;
    background: #f8f9fa;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.1s;
}
.yes-no-toggle button:first-child { border-right: 1px solid var(--border); }
.yes-no-toggle button.active-yes {
    background: #d1e7dd;
    color: #0f5132;
    font-weight: 600;
}
.yes-no-toggle button.active-no {
    background: #e9ecef;
    color: var(--text);
    font-weight: 600;
}

/* ─── Inline Add Button ────────────────────────────────────────────────── */
.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: rgba(13, 110, 253, 0.06);
    border: 1px dashed var(--accent);
    border-radius: 0.375rem;
    color: var(--accent);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.add-btn:hover {
    background: rgba(13, 110, 253, 0.12);
    border-style: solid;
}

/* ─── Search Input ─────────────────────────────────────────────────────── */
.search-box {
    position: relative;
}
.search-box .search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.search-box .search-result {
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.search-box .search-result:last-child { border-bottom: none; }
.search-box .search-result:hover { background: #f8f9fa; }
.search-box .search-result .result-name { font-weight: 600; }
.search-box .search-result .result-meta { color: var(--text-muted); font-size: 0.75rem; }

/* ─── Collapsible Sidebar Sections ─────────────────────────────────────── */
.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 1rem;
    cursor: pointer;
}
.sidebar-section-header:hover { background: var(--sidebar-active); }
.sidebar-section-header .sidebar-label { cursor: pointer; }
.sidebar-section-body { overflow: hidden; }

/* ─── Sidebar Icons & Sub-labels (Jubilee-style) ─────────────────────── */
.sb-icon {
    display: inline-block;
    width: 1.25rem;
    text-align: center;
    font-size: 0.85rem;
    margin-right: 0.375rem;
    opacity: 0.7;
}
.sidebar-item.active .sb-icon { opacity: 1; }
.sb-label { display: block; line-height: 1.3; }
.sb-sub {
    display: block;
    font-size: 0.6rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.6;
    margin-top: 1px;
}
.sb-main { display: block; font-weight: 500; }

/* ─── Exemption Hints ──────────────────────────────────────────────────── */
.exemption-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    background: #f0f4ff;
    border-radius: 0.25rem;
    margin-top: 0.25rem;
}
.exemption-hint.fully-exempt { color: #0f5132; background: #d1e7dd; }
.exemption-hint.not-exempt { color: #842029; background: #f8d7da; }

/* ─── Form Layout Enhancements ─────────────────────────────────────────── */
.form-section {
    margin-bottom: 1.5rem;
}
.form-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid var(--border);
}

/* ─── Quick Stats Row ──────────────────────────────────────────────────── */
.quick-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}
.quick-stat {
    flex: 1;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.625rem 0.75rem;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.quick-stat .qs-value { font-size: 1.1rem; font-weight: 700; }
.quick-stat .qs-label { font-size: 0.675rem; color: var(--text-muted); margin-top: 0.125rem; }

/* ─── Save Bar (fixed bottom) ──────────────────────────────────────────── */
.save-bar {
    position: sticky;
    bottom: 0;
    background: #f8f9fa;
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    z-index: 50;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.04);
}

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .tab-bar { flex-wrap: wrap; }
    .totals-bar { flex-wrap: wrap; gap: 0.75rem; }
    .quick-stats { flex-wrap: wrap; }
    .modal { width: 95%; max-height: 90vh; }
}
