/* ══════════════════════════════════════════════════════════════════════
   PREVIEW MODALS — Publish Rates / Submit for Review
   ----------------------------------------------------------------------
   Shared visual treatment for all four review-and-act modals:

     1. New Leases — Preview & Publish Rates       (analyst / admin)
     2. Renewals   — Preview & Publish Rates       (analyst / admin)
     3. New Leases — Preview & Submit for Review   (property manager)
     4. Renewals   — Preview & Submit for Review   (property manager)

   Modal chrome (dbc.Modal header / body / footer) is overridden via
   the .fr-preview-modal class set on dbc.Modal's contentClassName.
   Body content uses the .fr-preview-* namespace. A colored eyebrow at
   the top of the body identifies the flow at a glance — green for new
   leases (new business), amber for renewals (brand action).
   ══════════════════════════════════════════════════════════════════════ */

/* ── Modal shell overrides ──────────────────────────────────────────── */
.fr-preview-modal .modal-content {
    background: var(--fr-bg);
    border: 1px solid var(--fr-hairline-strong);
    border-radius: var(--fr-r-lg);
    font-family: var(--fr-font-sans);
    color: var(--fr-ink);
}
.fr-preview-modal .modal-header {
    background: var(--fr-surface);
    border-bottom: 1px solid var(--fr-hairline);
    padding: 18px 26px;
    border-radius: var(--fr-r-lg) var(--fr-r-lg) 0 0;
}
.fr-preview-modal .modal-title {
    font-family: var(--fr-font-serif);
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -0.005em;
    color: var(--fr-ink);
}
.fr-preview-modal .btn-close {
    opacity: 0.5;
    transition: opacity 120ms ease;
}
.fr-preview-modal .btn-close:hover { opacity: 1; }
.fr-preview-modal .modal-body {
    padding: 28px 26px 32px;
    background: var(--fr-bg);
}
/* Cap content width and center inside the fullscreen modal so tables don't
   sprawl across an ultrawide monitor. Mirrors the editorial frame used on
   Reports / Executive Summary. The body's first child is the wrapper the
   open callbacks return (preview header + notes + folders). */
.fr-preview-modal .modal-body > div {
    max-width: 1080px;
    margin: 0 auto;
}
.fr-preview-modal .modal-footer {
    background: var(--fr-surface);
    border-top: 1px solid var(--fr-hairline);
    padding: 14px 26px;
    border-radius: 0 0 var(--fr-r-lg) var(--fr-r-lg);
    gap: 10px;
}

/* Footer primary action — amber, matches navbar Publish Rates */
.fr-preview-modal .modal-footer .fr-action-btn {
    font-size: 13px !important;
    height: 38px;
}
/* Footer secondary action (Close) — ghost pill */
.fr-preview-modal .modal-footer .fr-preview-close {
    height: 38px;
    padding: 0 16px;
    background: var(--fr-surface) !important;
    border: 1px solid var(--fr-hairline-strong) !important;
    color: var(--fr-ink-2) !important;
    font-family: var(--fr-font-sans) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.14em !important;
    border-radius: var(--fr-r-md) !important;
}
.fr-preview-modal .modal-footer .fr-preview-close:hover {
    background: var(--fr-bg) !important;
    border-color: #C9C5B8 !important;
    color: var(--fr-ink) !important;
}
/* Footer checkboxes (Send email / Dry run) — sit between Close and primary */
.fr-preview-modal .modal-footer .form-check {
    margin-bottom: 0;
    color: var(--fr-ink-2);
    font-family: var(--fr-font-sans);
    font-size: 12.5px;
}
.fr-preview-modal .modal-footer .form-check-input:checked {
    background-color: var(--fr-accent);
    border-color: var(--fr-accent);
}

/* ══════════════════════════════════════════════════════════════════════
   Post-action confirmation modal body (.fr-export-confirm)
   Reuses the .fr-preview-modal shell. A single calm card acknowledging
   that the user's action was received — publishes and review submissions
   share it (title + message set per flow in export_preview.py).
   ══════════════════════════════════════════════════════════════════════ */
.fr-export {
    display: flex;
    flex-direction: column;
}
.fr-export-confirm {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px 22px;
    border-radius: var(--fr-r-lg);
    border: 1px solid var(--fr-positive-tint-2);
    background: var(--fr-positive-tint);
}
.fr-export-confirm-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--fr-positive);
    color: #fff;
    font-family: var(--fr-font-sans);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}
.fr-export-confirm-text {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-family: var(--fr-font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--fr-ink);
}

/* warning variant — nothing-to-send / no selection */
.fr-export-confirm--warning {
    border-color: var(--fr-warning-tint-2);
    background: var(--fr-warning-tint);
}
.fr-export-confirm--warning .fr-export-confirm-icon { background: var(--fr-warning); }

/* ── Eyebrow chip — flow identifier (NEW LEASES / RENEWALS) ─────────── */
.fr-preview-header {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 14px;
}
.fr-preview-header-text { flex: 1; min-width: 280px; }
.fr-preview-eyebrow {
    display: inline-block;
    font-family: var(--fr-font-sans);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    padding: 4px 11px 5px;
    border-radius: 100px;
    line-height: 1;
    margin-bottom: 10px;
}
.fr-preview-eyebrow--new-leases {
    background: var(--fr-positive-tint-2);
    color: var(--fr-positive-deep);
}
.fr-preview-eyebrow--renewals {
    background: var(--fr-accent-soft);
    color: var(--fr-accent-strong);
}
.fr-preview-title {
    font-family: var(--fr-font-serif);
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -0.005em;
    color: var(--fr-ink);
    line-height: 1;
    margin: 0 0 6px;
}
.fr-preview-prop-line {
    font-family: var(--fr-font-sans);
    font-size: 13px;
    color: var(--fr-ink-2);
}
.fr-preview-prop-name {
    font-weight: 500;
    color: var(--fr-ink);
}
.fr-preview-prop-line .sep {
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--fr-ink-3);
    margin: 0 8px;
    vertical-align: middle;
    opacity: 0.6;
}
.fr-preview-prop-line .id {
    font-family: var(--fr-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: var(--fr-ink-3);
}
.fr-preview-instructions {
    font-family: var(--fr-font-serif);
    font-style: italic;
    font-size: 14.5px;
    color: var(--fr-ink-2);
    margin: 10px 0 0;
    line-height: 1.4;
    max-width: 720px;
}

/* ── Notes section ──────────────────────────────────────────────────── */
.fr-preview-notes {
    background: var(--fr-surface);
    border: 1px solid var(--fr-hairline);
    border-radius: var(--fr-r-lg);
    padding: 14px 18px;
    margin-bottom: 14px;
}
.fr-preview-notes-label {
    font-family: var(--fr-font-sans);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--fr-ink-3);
    margin-bottom: 10px;
    display: block;
}
.fr-preview-notes textarea,
.fr-preview-notes textarea.form-control {
    width: 100%;
    border: 1px solid var(--fr-hairline-strong) !important;
    border-radius: var(--fr-r-md) !important;
    background: var(--fr-bg) !important;
    font-family: var(--fr-font-sans) !important;
    font-size: 13.5px !important;
    color: var(--fr-ink) !important;
    padding: 10px 12px !important;
    resize: vertical;
    box-shadow: none !important;
}
.fr-preview-notes textarea:focus,
.fr-preview-notes textarea.form-control:focus {
    border-color: var(--fr-accent) !important;
    box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.10) !important;
    outline: none !important;
}
.fr-preview-notes textarea::placeholder {
    color: #B5B2A8;
    font-style: italic;
}

/* ── Action bar (Expand All / Select All Unpublished) ───────────────── */
.fr-preview-action-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.fr-preview-action-btn {
    height: 34px;
    padding: 0 14px;
    background: var(--fr-surface);
    border: 1px solid var(--fr-hairline-strong);
    border-radius: var(--fr-r-md);
    font-family: var(--fr-font-sans);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--fr-ink-2);
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.fr-preview-action-btn:hover {
    background: #FBF9F4;
    color: var(--fr-ink);
    border-color: #C9C5B8;
}
.fr-preview-action-btn--accent {
    color: var(--fr-warning-deep);
    border-color: rgba(181, 112, 31, 0.35);
}
.fr-preview-action-btn--accent:hover {
    background: var(--fr-warning-tint);
    border-color: rgba(181, 112, 31, 0.55);
    color: var(--fr-warning-deep);
}
.fr-preview-action-btn[disabled],
.fr-preview-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Master "Select All Units" row ──────────────────────────────────── */
.fr-preview-master-select {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--fr-surface);
    border: 1px solid var(--fr-hairline);
    border-radius: var(--fr-r-md);
    margin-bottom: 10px;
}
.fr-preview-master-select-label {
    font-family: var(--fr-font-sans);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--fr-ink-2);
}
.fr-preview-master-select .form-check {
    margin-bottom: 0;
}
.fr-preview-master-select .form-check-input:checked {
    background-color: var(--fr-accent);
    border-color: var(--fr-accent);
}

/* ── Unit-type folder (collapsible group) ───────────────────────────── */
.fr-preview-folder {
    background: var(--fr-surface);
    border: 1px solid var(--fr-hairline);
    border-radius: var(--fr-r-lg);
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(20, 24, 29, 0.02);
}
.fr-preview-folder-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    background: #FBFAF6;
    border-bottom: 1px solid transparent;
    cursor: pointer;
    transition: background 120ms ease;
}
.fr-preview-folder.is-open .fr-preview-folder-head {
    border-bottom-color: var(--fr-hairline);
}
.fr-preview-folder-head:hover { background: #F7F4EB; }
.fr-preview-folder-head .form-check { margin: 0; }
.fr-preview-folder-head .form-check-input:checked {
    background-color: var(--fr-accent);
    border-color: var(--fr-accent);
}
/* Toggle click target — native <button> with browser defaults stripped so
   it inherits the folder-head layout. A <button> with n_clicks proved more
   reliable than a bare div for cross-browser click registration when many
   folders sit inside a fullscreen dbc.Modal. */
.fr-preview-folder-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    cursor: pointer;
    user-select: none;
    /* Tap target — make sure clicks anywhere on the row register */
    min-height: 28px;
    /* Strip browser default button styling */
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
}
.fr-preview-folder-toggle:focus {
    outline: none;
}
.fr-preview-folder-toggle:focus-visible {
    outline: 2px solid var(--fr-accent);
    outline-offset: -2px;
}
.fr-preview-folder-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex: 1;
    flex-wrap: wrap;
}
.fr-preview-folder-name {
    font-family: var(--fr-font-sans);
    font-size: 13.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--fr-ink);
}
.fr-preview-folder-meta {
    font-family: var(--fr-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
    color: var(--fr-ink-3);
}
.fr-preview-folder-meta .warn { color: var(--fr-warning-deep); font-weight: 600; }
.fr-preview-folder-chev {
    font-family: var(--fr-font-serif);
    font-size: 18px;
    line-height: 1;
    color: var(--fr-ink-3);
    transition: transform 200ms ease;
    width: 14px;
    text-align: center;
}
.fr-preview-folder.is-open .fr-preview-folder-chev { transform: rotate(90deg); }
/* dbc.Collapse applies .show when open — use :has() to drive chevron and
   header underline without round-tripping a server-side class toggle. */
.fr-preview-folder:has(.collapse.show) .fr-preview-folder-chev {
    transform: rotate(90deg);
}
.fr-preview-folder:has(.collapse.show) .fr-preview-folder-head {
    border-bottom-color: var(--fr-hairline);
}
.fr-preview-folder-body { padding: 0; }

/* DataTable wrapper inside a folder — strip the white surface card around
   the DataTable since the folder already provides one. */
.fr-preview-folder .dash-spreadsheet-container,
.fr-preview-folder .dash-spreadsheet,
.fr-preview-folder .dash-spreadsheet-inner {
    border: 0 !important;
    font-family: var(--fr-font-sans) !important;
}

/* Override the legacy global dash-table dark-navy header (defined far above
   at line ~1403) for preview tables specifically. The legacy rule uses
   !important; we bump specificity by prefixing with .fr-preview-folder and
   match-with-!important so this wins the cascade. Result: cream header
   band + small-caps gray label, matching the Reports / Executive vocab. */
.fr-preview-folder .dash-table-container .dash-header,
.fr-preview-folder .dash-spreadsheet .dash-header {
    background: #FBFAF6 !important;
    color: var(--fr-ink-3) !important;
    font-family: var(--fr-font-sans) !important;
    font-size: 10.5px !important;
    font-weight: 500 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.16em !important;
    border-top: 0 !important;
    border-left: 0 !important;
    border-right: 1px solid var(--fr-hairline) !important;
    border-bottom: 1px solid var(--fr-hairline) !important;
    padding: 12px 16px !important;
}
.fr-preview-folder .dash-table-container .dash-header .column-header-name,
.fr-preview-folder .dash-spreadsheet .dash-header .column-header-name {
    color: var(--fr-ink-3) !important;
    font-weight: 500 !important;
}
/* Body cells inside preview tables — match Reports cell rhythm. */
.fr-preview-folder .dash-table-container .dash-cell {
    font-family: var(--fr-font-sans) !important;
    font-size: 13px !important;
    color: var(--fr-ink) !important;
    border: 0 !important;
    border-right: 1px solid var(--fr-hairline) !important;
    border-bottom: 1px solid var(--fr-hairline) !important;
    padding: 10px 16px !important;
    text-align: left !important;
}
/* Money / numeric columns — right-aligned mono-spaced, scanning down the
   column. Uses data-dash-column to target the column IDs that the preview
   builders emit (unit_type_block + renewal_unit_type_block). */
.fr-preview-folder .dash-table-container .dash-cell[data-dash-column="bestPrice"],
.fr-preview-folder .dash-table-container .dash-cell[data-dash-column="newLeaseRent"],
.fr-preview-folder .dash-table-container .dash-cell[data-dash-column="currentRent"],
.fr-preview-folder .dash-table-container .dash-cell[data-dash-column="renewalOffer"],
.fr-preview-folder .dash-table-container .dash-cell[data-dash-column="increasePctDisplay"] {
    text-align: right !important;
    font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace !important;
    font-variant-numeric: tabular-nums !important;
}
.fr-preview-folder .dash-table-container .dash-header[data-dash-column="bestPrice"],
.fr-preview-folder .dash-table-container .dash-header[data-dash-column="newLeaseRent"],
.fr-preview-folder .dash-table-container .dash-header[data-dash-column="currentRent"],
.fr-preview-folder .dash-table-container .dash-header[data-dash-column="renewalOffer"],
.fr-preview-folder .dash-table-container .dash-header[data-dash-column="increasePctDisplay"] {
    text-align: right !important;
}
/* Date columns — mono, no wrap so dates stay on one line */
.fr-preview-folder .dash-table-container .dash-cell[data-dash-column="availableDate"],
.fr-preview-folder .dash-table-container .dash-cell[data-dash-column="expirationDate"] {
    font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace !important;
    font-variant-numeric: tabular-nums !important;
    white-space: nowrap !important;
}
/* Soft warm zebra on even rows, matching frontier_datatable_kwargs */
.fr-preview-folder .dash-spreadsheet tr:nth-of-type(even) {
    background: #FCFBF7;
}
/* Highlight unpublished rows softly in red (no chunky pink) */
.fr-preview-folder .dash-spreadsheet tr.fr-preview-unpublished-row td {
    /* This selector is unused — kept here as a hook for future row-level
       targeting. dash_table doesn't expose row classes; we use
       style_data_conditional with filter_query={_unpublished} = 1 instead. */
}

/* ── Bundle property section (multi-property previews) ──────────────── */
.fr-preview-bundle {
    background: var(--fr-surface);
    border: 1px solid var(--fr-hairline);
    border-radius: var(--fr-r-lg);
    padding: 16px 20px 18px;
    margin-bottom: 18px;
    box-shadow: 0 1px 0 rgba(20, 24, 29, 0.02);
}
.fr-preview-bundle-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--fr-hairline);
    margin-bottom: 14px;
}
.fr-preview-bundle-name {
    font-family: var(--fr-font-serif);
    font-size: 20px;
    font-weight: 400;
    color: var(--fr-ink);
    letter-spacing: -0.005em;
}
.fr-preview-bundle-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 4px;
    border-radius: 100px;
    background: var(--fr-warning-tint-2);
    color: var(--fr-warning-deep);
    font-family: var(--fr-font-sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.fr-preview-bundle.is-locked .fr-preview-bundle-body { opacity: 0.5; pointer-events: none; }
.fr-preview-bundle .form-check { margin: 0; }

/* ══════════════════════════════════════════════════════════════════════
   END PREVIEW MODALS
   ══════════════════════════════════════════════════════════════════════ */


