/*
 * reports-panel.css — Reports Slide-In Panel + Report Detail Modal
 * Batch 30: Slides over content from right, per-scenario report cards.
 * Zero hardcoded colors — CSS vars only.
 */

/* ============================================================
   BACKDROP
   ============================================================ */
#lf-reports-backdrop {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.20);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

#lf-reports-backdrop.rp-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   SLIDE-IN PANEL
   ============================================================ */
#lf-reports-panel {
    position: fixed;
    top: 46px; /* below main tabs bar */
    right: 0;
    bottom: 0;
    z-index: 501;
    width: 380px;
    max-width: 100vw;
    background: var(--surface-dark);
    border-left: 1px solid var(--glass-border);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#lf-reports-panel.rp-open {
    transform: translateX(0);
}

/* Panel not in STATE A (landing) */
body.lf-state-landing #lf-reports-panel,
body.lf-state-landing #lf-reports-backdrop {
    display: none;
}

/* ============================================================
   PANEL HEADER
   ============================================================ */
.rp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
    background: var(--surface-dark);
}

.rp-title {
    font-family: 'Exo 2', var(--font-heading);
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    color: var(--text-primary);
    margin: 0;
}

.rp-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: var(--text-base);
    transition: color 0.15s ease, background 0.15s ease;
}

.rp-close-btn:hover {
    color: var(--text-primary);
    background: var(--glass-bg-hover);
}

/* ============================================================
   SCENARIO SELECTOR
   ============================================================ */
.rp-scenario-wrap {
    padding: 10px 14px;
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.rp-scenario-label {
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-widest);
    color: var(--text-dim);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.rp-scenario-select {
    width: 100%;
    padding: 6px 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    color: var(--text-secondary);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.rp-scenario-select:focus {
    border-color: var(--glass-border-hover);
    background: var(--surface-dark);
}

/* ============================================================
   REPORTS LIST
   ============================================================ */
.rp-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.rp-list::-webkit-scrollbar { width: 3px; }
.rp-list::-webkit-scrollbar-track { background: transparent; }
.rp-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: var(--radius-full);
}

/* ============================================================
   REPORT CARD
   ============================================================ */
.rp-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s ease;
}

.rp-card:hover {
    border-color: var(--glass-border-hover);
}

.rp-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.rp-card__title {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.rp-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.rp-strategy-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    white-space: nowrap;
}

.rp-badge--flip      { background: var(--cyan-alpha-10, rgba(19,65,96,.08)); color: var(--text-cyan, #134160); border: 1px solid rgba(19,65,96,.25); }
.rp-badge--wholesale { background: var(--gold-alpha-20); color: var(--gold-500); border: 1px solid var(--gold-alpha-30); }
.rp-badge--rental    { background: rgba(0,160,80,.08); color: var(--color-positive); border: 1px solid var(--color-positive-border); }
.rp-badge--brrrr     { background: var(--color-purple-bg); color: var(--color-purple); border: 1px solid var(--color-purple-border); }
.rp-badge--financing { background: rgba(59,130,246,.08); color: #3b82f6; border: 1px solid rgba(59,130,246,.25); }

.rp-card__scenario {
    font-family: var(--font-body);
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rp-card__date {
    font-family: var(--font-body);
    font-size: 9px;
    color: var(--text-dim);
    white-space: nowrap;
}

.rp-card__actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.rp-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: none;
    border: 1.5px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.rp-btn-download:hover {
    border-color: var(--glass-border-hover);
    color: var(--text-primary);
    background: var(--glass-bg-hover);
}

.rp-btn-view {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-wide);
    cursor: pointer;
    transition: var(--btn-transition);
    white-space: nowrap;
}

.rp-btn-view:hover {
    background: var(--btn-primary-bg-hover);
    box-shadow: var(--glow-gold-sm);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.rp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 20px;
    text-align: center;
}

.rp-empty i {
    font-size: 2.5rem;
    color: var(--text-dim);
    opacity: 0.20;
}

.rp-empty__text {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    color: var(--text-muted);
    letter-spacing: var(--tracking-wide);
}

.rp-empty__sub {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    color: var(--text-dim);
}

/* ============================================================
   REPORT DETAIL MODAL
   ============================================================ */
#lf-report-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0, 0, 0, 0.50);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#lf-report-detail-modal.rd-open {
    display: flex;
}

.rd-card {
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: rdCardIn 0.22s ease;
}

@keyframes rdCardIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.rd-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #e2e4e8;
    flex-shrink: 0;
    background: #ffffff;
}

.rd-modal-title {
    font-family: 'Exo 2', var(--font-heading);
    font-size: var(--text-base);
    font-weight: var(--weight-bold);
    color: #1a1a2e;
    margin: 0;
}

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

.rd-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-fg);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    cursor: pointer;
    transition: var(--btn-transition);
    white-space: nowrap;
}

.rd-print-btn:hover {
    background: var(--btn-primary-bg-hover);
    box-shadow: var(--glow-gold-sm);
}

.rd-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: #718096;
    cursor: pointer;
    font-size: var(--text-base);
    transition: all 0.15s ease;
}

.rd-close-btn:hover {
    color: #1a1a2e;
    background: #f0f2f4;
}

/* Report body (scrollable) */
.rd-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px 28px;
    background: #ffffff;
    scrollbar-width: thin;
}

/* Report property header */
.rd-prop-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e2e4e8;
    margin-bottom: 16px;
}

.rd-prop-header__left {
    flex: 1;
    min-width: 0;
}

.rd-prop-address {
    font-family: 'Exo 2', var(--font-heading);
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    color: #1a1a2e;
    margin: 0 0 4px;
}

.rd-prop-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rd-strategy-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    background: #134160;
    color: #ffffff;
}

.rd-meta-text {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    color: #718096;
}

/* KPI grid in report */
.rd-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.rd-kpi-card {
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #e2e4e8;
    border-radius: 6px;
}

.rd-kpi__label {
    font-family: var(--font-heading);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #a0aec0;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.rd-kpi__value {
    font-family: 'Orbitron', var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
    color: #134160;
    letter-spacing: -0.02em;
}

.rd-kpi__value--gold { color: var(--gold-600, #e09120); }

/* Section in report */
.rd-section {
    margin-bottom: 14px;
}

.rd-section__title {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #a0aec0;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e4e8;
    padding-bottom: 4px;
    margin-bottom: 8px;
}

.rd-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid #f0f2f4;
}

.rd-row__label {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: #4a5568;
}

.rd-row__value {
    font-family: var(--font-heading);
    font-size: var(--text-sm);
    font-weight: 600;
    color: #1a1a2e;
    font-variant-numeric: tabular-nums;
}

.rd-row__value--positive { color: #00a050; }
.rd-row__value--negative { color: #dc2626; }
.rd-row__value--gold     { color: var(--gold-600, #e09120); }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    #lf-reports-panel,
    #lf-reports-backdrop,
    #lf-app-frame > *:not(#lf-report-print-target) {
        display: none !important;
    }

    #lf-report-print-target {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        background: #fff !important;
        box-shadow: none !important;
        border: none !important;
    }

    .rd-modal-header {
        border-bottom: 2px solid #1a1a2e !important;
    }

    .rd-modal-actions {
        display: none !important;
    }

    * {
        color-adjust: exact !important;
        -webkit-print-color-adjust: exact !important;
    }
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 768px) {
    #lf-reports-panel {
        width: 100vw;
        top: 42px;
    }

    .rd-kpi-grid {
        grid-template-columns: 1fr 1fr;
    }

    #lf-report-detail-modal {
        padding: 0;
    }

    .rd-card {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
}
