/* ================================================================
   GAYA Advisory — Report page (template-report.php)
   Loaded only on the report template (see inc/wc-report.php).
   ================================================================ */

/* ─── Page chrome (outside the PDF area) ────────────────────────── */
.report-page-wrap {
    background: var(--cream);
    padding-bottom: 96px;
    min-height: calc(100vh - 200px);
}
.report-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ─── Action bar (Report ID + Download button) ─────────────────── */
.report-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 2px rgba(11, 34, 64, 0.04), 0 8px 24px -16px rgba(11, 34, 64, 0.08);
}
.report-actions-meta { flex: 1; min-width: 0; }
.report-id-line {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 4px;
    font-family: 'DM Sans', system-ui, sans-serif;
}
.report-id-label {
    font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--gray-500);
}
.report-id-value {
    font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 14px; font-weight: 600;
    color: var(--navy);
    background: var(--gray-50);
    padding: 4px 10px;
    border-radius: 6px;
}
.report-intro {
    margin: 0;
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.55;
}
.report-download {
    appearance: none; border: 0; cursor: pointer;
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 24px;
    border-radius: 12px;
    background: var(--blue);
    color: #fff;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 15px; font-weight: 600;
    box-shadow: 0 8px 24px -8px rgba(61, 130, 232, 0.5);
    transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
    white-space: nowrap;
}
.report-download:hover {
    background: #2D6FCC;
    transform: translateY(-1px);
    box-shadow: 0 12px 28px -10px rgba(61, 130, 232, 0.6);
}
.report-download:disabled { background: var(--gray-300); cursor: wait; transform: none; box-shadow: none; }
.report-download i { font-size: 16px; }
.report-download-busy { display: inline-flex; align-items: center; gap: 8px; }
.report-download [hidden] { display: none !important; }

/* ─── Report itself ─────────────────────────────────────────────── */
.report {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(11, 34, 64, 0.04), 0 8px 24px -16px rgba(11, 34, 64, 0.08);
}

/* Each .report-page renders as one A4 page in the PDF.
   On screen the pages stack vertically with a divider; in PDF mode
   they each get a hard page break. */
.report-page {
    position: relative;
    background: #fff;
    padding: 56px 56px 64px;
    width: 210mm;            /* A4 width — keep html2canvas in sync */
    height: 295mm;           /* slightly under A4 height so pagination lands cleanly */
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
    color: var(--navy);
    box-sizing: border-box;
}
.report-page,
.report-page * { box-sizing: border-box; }
.report-page + .report-page {
    border-top: 8px solid var(--cream);
    page-break-before: always;
    break-before: page;
}

/* ─── Watermark layer (per page) ────────────────────────────────── */
.page-watermark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.page-watermark span {
    position: absolute;
    left: -10%;
    width: 200%;
    transform: rotate(-28deg);
    transform-origin: center;
    text-align: center;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(11, 34, 64, 0.05);
    text-transform: uppercase;
    white-space: nowrap;
}
.page-watermark span:nth-child(1) { top: 8%; }
.page-watermark span:nth-child(2) { top: 22%; }
.page-watermark span:nth-child(3) { top: 38%; }
.page-watermark span:nth-child(4) { top: 54%; }
.page-watermark span:nth-child(5) { top: 70%; }
.page-watermark span:nth-child(6) { top: 86%; }

/* All page content sits above the watermark */
.report-page > *:not(.page-watermark) { position: relative; z-index: 1; }

/* ─── Footer row at the bottom of each page ─────────────────────── */
.page-footer-row {
    position: absolute;
    left: 56px; right: 56px; bottom: 24px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 11px;
    color: var(--gray-500);
    text-align: center;
    letter-spacing: 0.04em;
}

/* ─── Cover page ────────────────────────────────────────────────── */
.report-cover {
    background: linear-gradient(180deg, #0B2240 0%, #0E2A52 100%);
    color: #fff;
}
.report-cover * { color: #fff; }
.report-cover .page-watermark span { color: rgba(255, 255, 255, 0.04); }
.cover-inner {
    height: 100%; min-height: 250mm;
    display: flex; flex-direction: column; justify-content: center;
    text-align: left;
    max-width: 75%;
}
.cover-kicker {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 12px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--teal);
    margin: 0 0 32px;
    font-weight: 700;
}
.cover-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 56px;
    font-weight: 700;
    line-height: 1.1;
    margin: 0 0 24px;
    color: #fff;
}
.cover-subtitle {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 18px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 48px;
}
.cover-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 600px;
}
.cover-meta-label {
    display: block;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 4px;
}
.cover-meta-value {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #fff;
}

.report-cover .page-footer-row { color: rgba(255, 255, 255, 0.5); }

/* ─── Page header (sections 2-5) ────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}
.page-num {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 56px;
    font-weight: 600;
    color: var(--gray-200);
    line-height: 1;
}
.page-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--navy);
    margin: 0;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.page-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--gray-200), transparent);
}

/* ─── Section 2: Executive summary ──────────────────────────────── */
.exec-intro {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.65;
    color: var(--gray-700);
    margin: 0 0 28px;
}
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 32px;
}
.kpi-row--compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: 10px;
    padding: 16px 14px;
    text-align: left;
}
.kpi-label {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gray-500);
    margin-bottom: 6px;
}
.kpi-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 22px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.2;
}
.kpi-value--sm { font-size: 15px; font-family: 'DM Sans', system-ui, sans-serif; font-weight: 600; }

.key-findings { margin: 0 0 28px; }
.key-findings h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 12px;
}
.key-findings ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.key-findings li {
    position: relative;
    padding: 8px 0 8px 20px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
}
.key-findings li::before {
    content: '';
    position: absolute;
    left: 0; top: 16px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--teal);
}

/* Preliminary / Recommendation box — colour-coded by outcome ── */
.preliminary-view, .recommendation-box {
    padding: 20px 24px;
    border-radius: 12px;
    border-left: 4px solid var(--blue);
    background: rgba(61, 130, 232, 0.06);
}
.preliminary-view h4, .recommendation-box h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 8px;
}
.preliminary-view p, .recommendation-box p {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-700);
    margin: 0;
}
.preliminary-view--positive, .rec--positive {
    background: rgba(20, 184, 166, 0.08);
    border-left-color: var(--teal);
}
.preliminary-view--negative, .rec--negative {
    background: rgba(220, 38, 38, 0.06);
    border-left-color: #DC2626;
}

/* ─── Section 3: Financial analysis ─────────────────────────────── */
.fin-split {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 28px;
    margin-bottom: 28px;
}
.fin-left h3, .fin-right h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 12px;
}
.inv-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
}
.inv-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.inv-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.inv-table tr.inv-highlight td {
    font-weight: 700;
    color: var(--navy);
    background: var(--gray-50);
    padding-left: 8px; padding-right: 8px;
}
.chart-wrap {
    height: 240px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 10px;
}
.fin-bottom {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 28px;
    align-items: start;
}
.risk-summary h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 10px;
}
.risk-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.risk-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--gray-50);
    border-radius: 8px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
}
.risk-label { color: var(--gray-700); }
.risk-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.risk-badge--low    { background: rgba(20, 184, 166, 0.12); color: #0F8A7A; }
.risk-badge--medium { background: rgba(217, 119, 6, 0.12);  color: #B65A00; }
.risk-badge--high   { background: rgba(220, 38, 38, 0.10);  color: #B91C1C; }

/* ─── Section 4: Projection detail ──────────────────────────────── */
.projection-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px;
    margin-bottom: 24px;
}
.projection-detail-table th {
    text-align: left;
    font-weight: 700;
    color: var(--navy);
    background: var(--gray-50);
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.projection-detail-table th:not(:first-child),
.projection-detail-table td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.projection-detail-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.projection-detail-table tr:last-child td {
    background: var(--gray-50);
    font-weight: 700;
    color: var(--navy);
}
.projection-summary {
    background: var(--cream);
    border-radius: 12px;
    padding: 20px 24px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.65;
    color: var(--gray-700);
}
.projection-summary p { margin: 0 0 8px; }
.projection-summary p:last-child { margin: 0; }
.projection-summary strong { color: var(--navy); font-weight: 600; }

/* ─── Section 5: Conclusion ─────────────────────────────────────── */
.next-steps { margin-top: 32px; }
.next-steps h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin: 0 0 14px;
}
.steps-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
.step-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: var(--gray-50);
    border-radius: 10px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-700);
}
.step-num {
    flex: 0 0 28px;
    width: 28px; height: 28px;
    background: var(--navy);
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.report-disclaimer {
    margin-top: 28px;
    padding: 18px 22px;
    background: var(--gray-50);
    border-radius: 10px;
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 12px;
    line-height: 1.6;
    color: var(--gray-600);
}
.report-disclaimer p { margin: 0; }

/* ─── PDF mode (body.pdf-mode) — hide page chrome ───────────────── */
body.pdf-mode .checkout-page-header,
body.pdf-mode .report-actions,
body.pdf-mode .site-footer,
body.pdf-mode .top-bar { display: none !important; }
body.pdf-mode .report-page-wrap { padding-bottom: 0; }
body.pdf-mode .report {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
body.pdf-mode .report-page + .report-page { border-top: 0; }
body.pdf-mode .report-page {
    padding: 18mm 14mm 18mm;
    page-break-after: always;
    break-after: page;
}

/* ─── Responsive (on-screen view only) ─────────────────────────── */
@media (max-width: 1080px) {
    .report-page { width: auto; min-height: 0; padding: 40px 36px 56px; }
    .fin-split, .fin-bottom { grid-template-columns: 1fr; }
    .cover-inner { max-width: 100%; }
    .cover-title { font-size: 40px; }
}
@media (max-width: 720px) {
    .report-inner { padding: 0 16px; }
    .report-actions { flex-direction: column; align-items: stretch; gap: 16px; padding: 20px; }
    .report-download { justify-content: center; }
    .report-page { padding: 28px 22px 40px; }
    .cover-title { font-size: 32px; }
    .cover-meta { grid-template-columns: 1fr; }
    .kpi-row, .kpi-row--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-num { font-size: 36px; }
    .page-title { font-size: 22px; }
    .page-footer-row { left: 22px; right: 22px; }
}
