/* PD Clinical Decision Support — Hybrid Layout (Tabs + Decision Panel) */

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

body {
    font-family: -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f0f2f5;
    color: #2c3e50;
    line-height: 1.5;
}

.app-container { min-height: 100vh; }

/* ===== Header ===== */
.dashboard-header {
    background: linear-gradient(135deg, #1a365d 0%, #2b6cb0 100%);
    color: white;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-left { flex: 1; min-width: 200px; }
.header-title { font-size: 20px; font-weight: 700; margin: 0; }
.header-subtitle { font-size: 11px; opacity: 0.75; margin-top: 2px; }

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-label { font-size: 12px; font-weight: 600; opacity: 0.9; }
.case-dropdown { width: 300px; color: #2c3e50; }

/* ===== Badge ===== */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-pd { background: #fed7d7; color: #c53030; }
.badge-healthy { background: #c6f6d5; color: #276749; }
.badge-new { background: #e9d8fd; color: #553c9a; }
.badge-other { background: #fefcbf; color: #975a16; }
.badge-unknown { background: #edf2f7; color: #4a5568; }

/* ===== Main Grid (Content + Right Panel) ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    min-height: calc(100vh - 64px);
}

/* ===== Main Content (Tabs) ===== */
.main-content {
    padding: 0;
    overflow-y: auto;
}

/* Tabs */
.custom-tabs {
    background: white;
    border-bottom: 2px solid #e2e8f0;
    padding: 0 20px;
}

.custom-tab {
    padding: 12px 18px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #718096 !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    background: transparent !important;
}

.custom-tab:hover {
    color: #2b6cb0 !important;
    background: #ebf8ff !important;
}

.custom-tab--selected {
    color: #1a365d !important;
    font-weight: 700 !important;
    border-bottom: 3px solid #2b6cb0 !important;
    background: transparent !important;
}

.tab-content-area {
    padding: 20px;
}

.tab-description {
    font-size: 12px;
    color: #718096;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 6px;
    border-left: 3px solid #4299e1;
}

/* ===== Right Panel (Decision Workspace) ===== */
.right-panel {
    background: white;
    border-left: 1px solid #e2e8f0;
    padding: 16px;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2b6cb0;
}

.sidebar-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 12px 0;
}

/* ===== New Patient Indicator ===== */
.new-case-alert {
    background: #faf5ff;
    border: 1px solid #d6bcfa;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: #553c9a;
    margin-bottom: 12px;
}

.new-star { font-size: 16px; }

.new-indicator { margin-bottom: 8px; }

/* ===== Summary Cards ===== */
.summary-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
    border-top: 3px solid #2b6cb0;
}

.card-label {
    font-size: 10px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 18px;
    font-weight: 700;
    color: #1a365d;
    margin-top: 2px;
    word-break: keep-all;
}

.card-value-main {
    font-size: 16px;
    font-weight: 700;
    color: #553c9a;
    line-height: 1.2;
}

.card-value-sub {
    font-size: 11px;
    font-weight: 500;
    color: #805ad5;
    margin-top: 1px;
}

.summary-cards-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

/* ===== Viz Blocks ===== */
.viz-block {
    background: white;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.viz-title {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
}

/* ===== Controls Row ===== */
.controls-row {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
}

.inline-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inline-label {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    white-space: nowrap;
}

.inline-dropdown { min-width: 150px; }

/* ===== Chart Layout ===== */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.chart-half { min-width: 0; }

/* ===== Demographics ===== */
.demographics-row {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.demo-content {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.demo-item {
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
}

.demo-id { font-weight: 700; color: #1a365d; }
.demo-condition { font-weight: 700; }
.demo-new { color: #805ad5; }
.demo-dx { color: #2b6cb0; font-style: italic; }

/* ===== NMS ===== */
.nms-grid { max-height: 200px; overflow-y: auto; }

.nms-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.nms-symptom-item {
    font-size: 12px;
    padding: 4px 8px;
    background: #fff5f5;
    border-radius: 4px;
    color: #c53030;
}

/* ===== Decision Form ===== */
.decision-form { padding-top: 4px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    margin: 10px 0 4px;
}

.decision-radio {
    display: flex;
    gap: 8px;
    padding: 6px 0;
}

.radio-label {
    font-size: 13px;
    cursor: pointer;
    padding: 4px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.15s;
}

.radio-label:hover {
    border-color: #805ad5;
    background: #faf5ff;
}

.confidence-slider { margin: 8px 0; }

.evidence-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0;
}

.check-label {
    font-size: 11px;
    padding: 3px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.check-label:hover {
    border-color: #805ad5;
    background: #faf5ff;
}

.decision-textarea {
    width: 100%;
    min-height: 50px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
}

.decision-textarea:focus {
    outline: none;
    border-color: #805ad5;
    box-shadow: 0 0 0 2px rgba(128,90,213,0.15);
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 8px 16px;
    margin-top: 10px;
    background: #805ad5;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover { background: #553c9a; }

.decision-btn-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    margin-top: 10px;
}

.decision-btn-row .btn-primary { margin-top: 0; }

.btn-reset {
    padding: 8px 12px;
    background: white;
    color: #e53e3e;
    border: 1px solid #feb2b2;
    border-radius: 6px;
    font-weight: 600;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-reset:hover {
    background: #fff5f5;
    border-color: #e53e3e;
}

.btn-secondary {
    width: 100%;
    padding: 8px 16px;
    margin-top: 8px;
    background: white;
    color: #805ad5;
    border: 2px solid #805ad5;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.btn-secondary:hover { background: #faf5ff; }

.export-section { margin-top: 16px; }
.save-feedback { text-align: center; margin-top: 8px; font-size: 12px; }
.feedback-success { color: #38a169; font-weight: 600; }
.feedback-reset { color: #805ad5; font-weight: 600; }
.feedback-warn { color: #dd6b20; font-weight: 600; }

/* ===== Video Layout ===== */
.video-split-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
}

.video-left { }
.video-right { }

.video-container {
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: hidden;
    background: #1a202c;
}

.video-player { width: 100%; display: block; min-height: 400px; }

.video-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 10px;
}

/* ===== Raw Sensor Section ===== */
.raw-sensor-section { margin-top: 12px; }

.raw-toggle {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    padding: 8px 12px;
    background: #edf2f7;
    border-radius: 6px;
    margin-bottom: 8px;
}

.raw-toggle:hover { background: #e2e8f0; }

/* ===== Detail Panel (UPDRS) ===== */
.detail-panel {
    margin-top: 10px;
    padding: 10px 14px;
    background: #f7fafc;
    border-left: 3px solid #2b6cb0;
    border-radius: 4px;
    font-size: 13px;
}

/* ===== Section Title ===== */
.section-title {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin: 8px 0 6px;
}

/* ===== Clinical Summary ===== */
.verdict-box {
    padding: 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border: 1px solid #e2e8f0;
}

.findings-list {
    list-style: none;
    padding: 0;
}

.findings-list li {
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.finding-pd {
    background: #fff5f5;
    color: #c53030;
    border-left: 3px solid #e53e3e;
}

.finding-healthy {
    background: #f0fff4;
    color: #276749;
    border-left: 3px solid #38a169;
}

.finding-border {
    background: #faf5ff;
    color: #553c9a;
    border-left: 3px solid #805ad5;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.summary-table th {
    background: #f7fafc;
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.summary-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #edf2f7;
}

.summary-table .high-asym {
    color: #e53e3e;
    font-weight: 700;
    background: #fff5f5;
}

/* ===== Scrollbar ===== */
.right-panel::-webkit-scrollbar { width: 4px; }
.right-panel::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 4px; }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: 1fr 280px; }
    .summary-cards-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .right-panel {
        position: static;
        height: auto;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }
    .chart-row { grid-template-columns: 1fr; }
    .video-split-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .dashboard-header { flex-direction: column; align-items: flex-start; }
    .case-dropdown { width: 100%; }
    .summary-cards-row { grid-template-columns: 1fr 1fr; }
    .controls-row { flex-direction: column; align-items: flex-start; }
}

/* ===== UPDRS Task-based Scoring Form ===== */
.updrs-form { margin-bottom: 8px; }

.updrs-group {
    margin-bottom: 6px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.updrs-group[open] { border-color: #cbd5e0; }

.updrs-group-title {
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: #2c3e50;
    padding: 6px 10px;
    background: #f7fafc;
    user-select: none;
}

.updrs-group-title:hover { background: #edf2f7; }

.updrs-group-items { padding: 4px 8px 6px; }

.updrs-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    border-bottom: 1px solid #f7fafc;
    gap: 4px;
}

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

.updrs-item-label {
    font-size: 11px;
    color: #4a5568;
    flex-shrink: 0;
    min-width: 90px;
    max-width: 120px;
}

.updrs-number-input {
    width: 56px !important;
    padding: 3px 6px !important;
    font-size: 12px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 4px !important;
    text-align: center !important;
    flex-shrink: 0;
}

.updrs-number-input:focus {
    outline: none !important;
    border-color: #805ad5 !important;
    box-shadow: 0 0 0 2px rgba(128,90,213,0.15) !important;
}

.updrs-dropdown {
    width: 80px !important;
    font-size: 11px !important;
    flex-shrink: 0;
}

.updrs-dropdown .Select-value-label,
.updrs-dropdown .Select-placeholder {
    font-size: 11px !important;
}

.updrs-dropdown .Select-value {
    font-weight: 600 !important;
    color: #2b6cb0 !important;
}

.updrs-radio {
    display: flex !important;
    gap: 10px;
    flex-shrink: 0;
}

.updrs-radio label {
    display: flex !important;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
}

.updrs-radio input[type="radio"] {
    accent-color: #805ad5;
}

/* ===== Clinician Comparison Table ===== */
.comparison-scroll {
    max-height: 450px;
    overflow-y: auto;
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.comparison-table th {
    background: #f7fafc;
    padding: 4px 5px;
    text-align: center;
    font-weight: 700;
    font-size: 10px;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1;
}

.comparison-table td {
    padding: 3px 5px;
    border-bottom: 1px solid #edf2f7;
}

.comp-item-name {
    font-size: 10px;
    color: #4a5568;
    max-width: 100px;
    word-break: break-word;
}

.comp-cell { text-align: center; }
.comp-you { font-weight: 700; color: #2b6cb0; }
.comp-majority { font-weight: 700; color: #805ad5; }

.comparison-agree td { background: #f0fff4; }
.comparison-disagree td { background: #fff5f5; }
.comparison-disagree .comp-you { color: #e53e3e; }
