/* ARCHITECTURE: H&P Approval Modal Styles
   WHY: Extends problem-approval-modal patterns for H&P sections + problems
   NOTE: Section cards are expandable/editable, problems use checkbox selection */

/* ============================================================
   H&P SECTION CARDS
   Expandable cards showing extracted H&P sections
   ============================================================ */

.handp-sections-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.handp-section-card {
    border-radius: 12px;
    border: 1px solid var(--border-color, rgba(148, 163, 184, 0.25));
    background: var(--bg-tertiary, rgba(15, 23, 42, 0.8));
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.handp-section-card.is-selected {
    border-color: var(--brand-primary, #6366f1);
}

.handp-section-card.is-expanded {
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.12);
}

.handp-section-header {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-primary, rgba(30, 41, 59, 0.5));
}

.handp-section-header:hover {
    background: var(--bg-primary, rgba(30, 41, 59, 0.8));
}

.handp-section-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--brand-primary, #6366f1);
}

.handp-section-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary, #f8fafc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.handp-section-toggle {
    color: var(--text-tertiary, #94a3b8);
    transition: transform 0.2s;
    font-size: 10px;
    padding: 4px;
}

.handp-section-card.is-expanded .handp-section-toggle {
    transform: rotate(180deg);
}

.handp-section-preview {
    padding: 0 16px 12px 46px;  /* Aligned with checkbox */
    font-size: 13px;
    color: var(--text-secondary, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.handp-section-card.is-expanded .handp-section-preview {
    display: none;
}

.handp-section-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border-color, rgba(148, 163, 184, 0.15));
}

.handp-section-content {
    background: var(--bg-secondary, rgba(15, 23, 42, 0.5));
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary, #cbd5e1);
    white-space: pre-wrap;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 12px;
}

.handp-section-content[contenteditable="true"] {
    background: var(--bg-primary, rgba(30, 41, 59, 0.8));
    border: 1px solid var(--brand-primary, rgba(99, 102, 241, 0.4));
    outline: none;
    cursor: text;
}

.handp-section-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-end;
}

.handp-edit-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(79, 70, 229, 0.15);
    color: var(--brand-primary, #a5b4fc);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.handp-edit-btn:hover {
    background: rgba(79, 70, 229, 0.25);
    border-color: var(--brand-primary, rgba(99, 102, 241, 0.3));
}

.handp-edit-btn.is-editing {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
    border-color: rgba(52, 211, 153, 0.3);
}


/* ============================================================
   H&P PROBLEM CARDS
   Checkbox selection for detected problems
   ============================================================ */

.handp-problem-card {
    border-radius: 10px;
    border: 1px solid var(--border-color, rgba(148, 163, 184, 0.2));
    background: var(--bg-tertiary, rgba(15, 23, 42, 0.6));
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: border-color 0.2s, background 0.2s;
}

.handp-problem-card.is-selected {
    border-color: var(--brand-primary, #6366f1);
    background: var(--bg-tertiary, rgba(99, 102, 241, 0.08));
}

.handp-problem-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.handp-problem-header input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--brand-primary, #6366f1);
    flex-shrink: 0;
}

.handp-problem-title {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary, #f8fafc);
    cursor: pointer;
}

.handp-problem-body {
    margin-top: 8px;
    padding-left: 26px;  /* Aligned with checkbox */
}


/* ============================================================
   CONFIDENCE CHIPS & TREND PILLS
   ============================================================ */

.confidence-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-secondary, rgba(15, 23, 42, 0.5));
    color: var(--text-secondary, #94a3b8);
}

.confidence-chip.high {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
}

.confidence-chip.medium {
    background: rgba(251, 191, 36, 0.15);
    color: #fcd34d;
}

.confidence-chip.low {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
}

.trend-pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 999px;
    text-transform: capitalize;
}

.trend-pill.trend-active {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.trend-pill.trend-stable {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
}

.trend-pill.trend-improving {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

.trend-pill.trend-worsening {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
}


/* ============================================================
   EMPTY STATE
   ============================================================ */

.handp-sections-list .empty-state,
.handp-problems-list .empty-state {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary, #94a3b8);
    font-size: 13px;
}


/* ============================================================
   LOADING & ERROR STATES
   ============================================================ */

#handp-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

#handp-modal-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color, rgba(148, 163, 184, 0.2));
    border-top-color: var(--brand-primary, #6366f1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

#handp-loading-text {
    color: var(--text-secondary, #94a3b8);
    font-size: 14px;
}

#handp-modal-error {
    padding: 24px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 12px;
    margin: 16px;
}

#handp-modal-error strong {
    display: block;
    color: #fca5a5;
    margin-bottom: 8px;
}

#handp-modal-error-text {
    color: var(--text-secondary, #94a3b8);
    font-size: 13px;
}


/* ============================================================
   PRIOR ADMISSIONS SECTION
   ============================================================ */

.handp-prior-admissions {
    margin-top: 16px;
    padding: 12px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 10px;
}

.handp-prior-admissions h5 {
    margin: 0 0 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fcd34d;
}

.handp-prior-admission-item {
    font-size: 13px;
    color: var(--text-secondary, #94a3b8);
    padding: 4px 0;
}

.handp-prior-admission-item strong {
    color: var(--text-primary, #f8fafc);
}
