/**
 * Price Report — restyled onto the Rate Pulse design system (tokens.css).
 * Class names / IDs are preserved so price-report.js keeps working.
 */

/* Page chrome */
body { background: var(--paper); color: var(--ink); }

#generateReportBtn { margin-bottom: 22px; }

/* ── Section card ───────────────────────────────────────────────────── */
.report-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
    padding: 24px;
    margin-bottom: 18px;
}

.report-section h2 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0 0 6px 0;
    padding: 0;
    border: 0;
}

.report-hotel-name {
    font-family: var(--font-display);
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 16px;
}

/* ── Section 1: Verdict ─────────────────────────────────────────────── */
.report-verdict {
    border-left: 6px solid var(--ink-3);
}
.report-verdict.verdict-great_deal { border-left-color: var(--emerald); }
.report-verdict.verdict-good_rate  { border-left-color: var(--emerald); }
.report-verdict.verdict-fair_rate  { border-left-color: var(--amber); }
.report-verdict.verdict-expensive  { border-left-color: var(--coral); }

.verdict-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 14px;
}

.verdict-badge {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    border-radius: 99px;
    background: var(--paper-2);
    color: var(--ink-2);
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.verdict-badge.badge-great_deal,
.verdict-badge.badge-good_rate { background: var(--emerald-soft); color: color-mix(in oklch, var(--emerald), black 22%); }
.verdict-badge.badge-fair_rate { background: var(--amber-soft);  color: color-mix(in oklch, var(--amber), black 28%); }
.verdict-badge.badge-expensive { background: var(--coral-soft);  color: color-mix(in oklch, var(--coral), black 14%); }

.verdict-summary {
    font-size: 18px;
    line-height: 1.5;
    color: var(--ink);
    letter-spacing: -0.01em;
    max-width: 820px;
}
.verdict-summary strong { font-weight: 700; }

/* ── Key Metrics ────────────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
@media (max-width: 560px) { .dashboard-grid { grid-template-columns: repeat(2, 1fr); } }

.dash-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
    padding: 16px 16px 14px;
    text-align: left;
}

.dash-label {
    font-family: var(--font-mono);
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-value {
    font-family: var(--font-mono);
    font-feature-settings: "tnum" 1;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    line-height: 1.2;
    margin-top: 9px;
}
.dash-value.dash-positive { color: color-mix(in oklch, var(--emerald), black 18%); }
.dash-value.dash-negative { color: color-mix(in oklch, var(--coral), black 10%); }
.dash-value.dash-neutral  { color: var(--ink-3); }
.dash-value.dash-amber    { color: color-mix(in oklch, var(--amber), black 28%); }
.dash-value.dash-value-sm { font-size: 16px; }

.dash-sub {
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 4px;
}

/* ── Charts ─────────────────────────────────────────────────────────── */
.rate-chart-container { position: relative; height: 300px; margin: 16px 0 12px; }
.dates-chart-container { position: relative; height: 260px; margin: 16px 0 12px; }

/* ── Section descriptions / insights ────────────────────────────────── */
.section-description {
    font-size: 13px;
    color: var(--ink-2);
    line-height: 1.55;
    margin-bottom: 14px;
    max-width: 760px;
}

.report-insights {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}
.insight-line {
    font-size: 13.5px;
    color: var(--ink-2);
    line-height: 1.5;
    padding: 3px 0;
}
.insight-line .insight-highlight { font-weight: 700; color: var(--ink); }
.insight-line.insight-positive { color: color-mix(in oklch, var(--emerald), black 18%); }
.insight-line.insight-negative { color: color-mix(in oklch, var(--coral), black 10%); }
.insight-line.insight-neutral  { color: var(--ink-2); }

/* ── Neighbour cards ────────────────────────────────────────────────── */
.neighbours-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
@media (max-width: 900px) { .neighbours-cards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .neighbours-cards { grid-template-columns: repeat(2, 1fr); } }

.neighbour-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--sh-1);
    padding: 12px 14px;
    min-width: 0;
    overflow: hidden;
}
.neighbour-card-selected {
    border: 1.5px solid var(--violet);
    background: var(--violet-tint);
}
.neighbour-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.neighbour-card-date { font-size: 13px; font-weight: 700; color: var(--ink); }

.neighbour-card-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
}
.neighbour-card-badge.badge-positive { background: var(--emerald-soft); color: color-mix(in oklch, var(--emerald), black 22%); }
.neighbour-card-badge.badge-negative { background: var(--coral-soft);   color: color-mix(in oklch, var(--coral), black 14%); }
.neighbour-card-badge.badge-neutral  { background: var(--paper-2);      color: var(--ink-2); }

.neighbour-card-chart { position: relative; height: 80px; margin-bottom: 6px; overflow: hidden; }
.neighbour-card-chart canvas { width: 100% !important; height: 100% !important; }

.neighbour-card-rates { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }
.neighbour-card-rates span { display: flex; align-items: center; gap: 4px; }
.neighbour-card-rates .rate-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.neighbour-card-rates .rate-dot.dot-hotel  { background: var(--violet); }
.neighbour-card-rates .rate-dot.dot-market { background: var(--ink-3); }

/* demand chip (also used on neighbour cards + the Demand key-metric) */
.demand-chip { display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 99px; }
.demand-chip--high { background: var(--amber-soft); color: color-mix(in oklch, var(--amber), black 30%); }
.demand-chip--med  { background: var(--paper-2); color: var(--ink-2); }
.demand-chip--low  { background: var(--paper-2); color: var(--ink-3); }
.neighbour-card-demand { margin-top: 6px; }

.neighbour-card-link { text-decoration: none; color: inherit; display: block; transition: transform 0.12s ease; }
.neighbour-card-link:hover { transform: translateY(-2px); }
.neighbour-card-link:hover .neighbour-card {
    border-color: var(--violet);
    box-shadow: var(--sh-2);
}
.neighbour-card-link-current,
.neighbour-card-link-current:hover { cursor: default; transform: none; }
.neighbour-card-link-current:hover .neighbour-card { border-color: var(--violet); box-shadow: none; }

.neighbours-summary {
    background: var(--violet-tint);
    border: 1px solid var(--violet-soft);
    border-radius: var(--r-md);
    padding: 16px 20px;
}
.neighbours-summary-text { font-size: 14px; color: var(--violet-ink); line-height: 1.6; }

/* ── Benchmark table ────────────────────────────────────────────────── */
.benchmark-header { margin-bottom: 6px; }
.benchmark-header h2 { margin: 0; padding: 0; border: 0; }

.benchmark-table-wrap {
    overflow-x: auto;
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
}
.benchmark-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.benchmark-table thead { background: var(--paper-2); }
.benchmark-table th {
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--ink-3);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--line);
}
.benchmark-table th:first-child { text-align: left; }
.benchmark-table th:not(:first-child) { text-align: right; }
.benchmark-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.benchmark-table tbody tr:last-child td { border-bottom: none; }
.benchmark-table tbody tr:hover { background: var(--paper-2); }

.benchmark-cell-hotel { text-align: left; min-width: 140px; }
.benchmark-cell-hotel .benchmark-hotel-name { display: block; font-weight: 600; color: var(--ink); }
.benchmark-cell-hotel .benchmark-your-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 2px 7px;
    font-size: 9.5px;
    font-weight: 800;
    color: #fff;
    background: var(--violet);
    border-radius: 6px;
    letter-spacing: 0.02em;
}
.benchmark-cell-hotel .benchmark-deep-dive {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 9px;
    font-size: 11px;
    color: var(--violet);
    background: transparent;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    transition: background 0.14s, border-color 0.14s;
}
.benchmark-cell-hotel .benchmark-deep-dive:hover { background: var(--violet-tint); border-color: var(--violet); }

.benchmark-cell-num, .benchmark-cell-vs { text-align: right; white-space: nowrap; font-family: var(--font-mono); }
.benchmark-cell-num { width: 84px; }
.benchmark-cell-vs { width: 84px; }

.benchmark-row-yours { background: var(--violet-tint) !important; }
.benchmark-row-yours:hover { background: var(--violet-soft) !important; }
.benchmark-vs-you.benchmark-cheaper { color: color-mix(in oklch, var(--emerald), black 18%); font-weight: 700; }
.benchmark-vs-you.benchmark-pricier { color: color-mix(in oklch, var(--coral), black 10%); font-weight: 700; }

/* ── Deep Dive Modal ────────────────────────────────────────────────── */
.deep-dive-modal { position: fixed; inset: 0; z-index: 9999; padding: 20px; box-sizing: border-box; overflow-y: auto; }
.deep-dive-backdrop { position: fixed; inset: 0; background: oklch(0.2 0.02 300 / 0.45); z-index: 0; }
.deep-dive-content {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-3);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.deep-dive-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); position: relative; }
.deep-dive-header h3 {
    font-family: var(--font-mono);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--ink-3); margin: 0 0 4px;
}
.deep-dive-header h4 { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ink); margin: 0; }
.deep-dive-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border: none; background: transparent; font-size: 24px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.deep-dive-close:hover { color: var(--ink); }
.deep-dive-body { padding: 20px 24px 24px; }
.deep-dive-chart-wrap h5 { font-size: 14px; font-weight: 700; color: var(--ink); margin: 0 0 12px; }
.deep-dive-chart-container { height: 240px; margin-bottom: 20px; position: relative; }
.deep-dive-chart-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 14px; }
.deep-dive-averages { display: flex; gap: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.deep-dive-avg-item { display: flex; flex-direction: column; gap: 4px; }
.deep-dive-avg-label { font-size: 12px; color: var(--ink-3); }
.deep-dive-avg-value { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--ink); }

/* ── Alternative hotels ─────────────────────────────────────────────── */
.alternatives-list { display: flex; flex-direction: column; gap: 8px; }
.alternative-card {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    text-decoration: none; color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.alternative-card:hover { border-color: var(--violet); box-shadow: var(--sh-2); transform: translateY(-2px); }
.alt-card-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alt-card-name { font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alt-card-price { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.alt-card-badges { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.alt-avg-badge { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); padding: 2px 8px; background: var(--paper-2); border-radius: 99px; }
.alt-drift-badge { font-size: 11px; padding: 2px 8px; border-radius: 99px; font-weight: 700; }
.alt-drift-badge.badge-positive { color: color-mix(in oklch, var(--emerald), black 22%); background: var(--emerald-soft); }
.alt-drift-badge.badge-negative { color: color-mix(in oklch, var(--coral), black 14%); background: var(--coral-soft); }
.alt-drift-badge.badge-neutral  { color: var(--ink-2); background: var(--paper-2); }

/* ── Mobile refinements ─────────────────────────────────────────────── */
@media (max-width: 560px) {
    /* Reclaim horizontal room: section padding is the biggest offender. */
    .report-section { padding: 16px; }
    .report-hotel-name { font-size: 21px; }
    .verdict-summary { font-size: 16px; }

    /* Full-width primary action = bigger tap target, no awkward left float. */
    #generateReportBtn { width: 100%; margin-bottom: 16px; }

    /* Let the share/export buttons wrap instead of cramming one row. */
    .rp-toolbar-actions { flex-wrap: wrap; gap: 8px; }

    /* Long "vs market" / drift badges should wrap, not overflow the card. */
    .alt-card-badges { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

    /* Tighten the deep-dive modal so content isn't squeezed by chrome. */
    .deep-dive-modal { padding: 12px; }
    .deep-dive-header { padding: 16px 18px 12px; }
    .deep-dive-body { padding: 16px 18px 18px; }
    .deep-dive-averages { gap: 16px; }
}

/* ── Misc ───────────────────────────────────────────────────────────── */
.no-data-inline { text-align: center; padding: 16px; color: var(--ink-3); font-size: 13px; }
.report-footer {
    display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem;
    font-size: 11px; color: var(--ink-3); padding: 8px 0; padding-right: 0.5rem;
}
.report-footer .feedback-trigger-btn { margin-right: 0.25rem; }
