/* ============================================================
   PRINT STYLESHEET — Radius Wealth Management Financial Plan
   Generates clean, professional PDF via browser print (Cmd+P)
   ============================================================ */

@page {
    size: letter;
    margin: 0.75in 0.85in 1in 0.85in;

    @bottom-center {
        content: "Radius Wealth Management · Independent, Fee-Only · Schwab Custody · (617) 765-2200";
        font-family: 'Inter', -apple-system, sans-serif;
        font-size: 7.5pt;
        color: #718096;
        border-top: 0.5pt solid #e2e8f0;
        padding-top: 8pt;
    }

    @bottom-right {
        content: counter(page);
        font-family: 'Inter', -apple-system, sans-serif;
        font-size: 7.5pt;
        color: #a0aec0;
    }
}

@media print {

    /* ── Reset & Base ────────────────────────────────────── */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    html, body {
        background: white !important;
        color: #1a202c !important;
        font-family: 'Inter', -apple-system, Helvetica, Arial, sans-serif !important;
        font-size: 10pt !important;
        line-height: 1.5 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* ── Hide non-print elements ─────────────────────────── */
    nav,
    .nav,
    .hero,
    .hero-sub,
    .progress-bar,
    .progress-fill,
    #progressWrap,
    .step:not(#stepResults),
    .chat-widget,
    .chat-toggle,
    .availability-badge,
    .schwab-row,
    .btn,
    .btn-gold,
    .btn-navy,
    .plan-cta button,
    .plan-cta .btn,
    .cc-cta-btns,
    .cc-cta-section button,
    .cc-cta-section a,
    .cc-tool-btn,
    .cc-btn-cta,
    .cc-toolbar-actions,
    .cc-mobile-nav,
    .cc-sb-footer a,
    .cc-powered,
    .tier-card,
    .tier-selector,
    .step-nav,
    footer,
    .chat-widget-container,
    [onclick*="window.print"],
    [onclick*="shareWithSpouse"],
    [onclick*="window.open"],
    [onclick*="book"],
    #print-hide,
    .no-print,
    .cc-nav-items,
    .cc-sidebar,
    .cc-ring-wrap,
    .cc-ring-label,
    canvas {
        display: none !important;
    }

    /* ── Print Header (injected by JS) ───────────────────── */
    #print-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 16pt;
        margin-bottom: 16pt;
        border-bottom: 2pt solid #0f1d36;
        page-break-after: avoid;
    }

    #print-header .print-brand {
        display: flex;
        align-items: center;
        gap: 12pt;
    }

    #print-header .print-brand img {
        height: 44pt;
        width: auto;
        border-radius: 4pt;
    }

    #print-header .print-brand-text {
        font-family: 'Playfair Display', Georgia, serif;
        font-size: 16pt;
        font-weight: 700;
        color: #0f1d36;
    }

    #print-header .print-brand-sub {
        font-family: 'Inter', sans-serif;
        font-size: 8pt;
        color: #718096;
        margin-top: 2pt;
    }

    #print-header .print-prepared {
        text-align: right;
        font-size: 9pt;
        color: #4a5568;
    }

    #print-header .print-prepared strong {
        display: block;
        font-size: 11pt;
        color: #0f1d36;
    }

    /* ── Score Display (text replacement for canvas ring) ── */
    #print-score-display {
        display: flex !important;
        align-items: center;
        justify-content: center;
        gap: 16pt;
        margin: 12pt 0 20pt;
        page-break-after: avoid;
    }

    #print-score-display .score-circle {
        width: 72pt;
        height: 72pt;
        border-radius: 50%;
        border: 4pt solid #d69e2e;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }

    #print-score-display .score-number {
        font-family: 'Inter', sans-serif;
        font-size: 28pt;
        font-weight: 800;
        color: #0f1d36;
        line-height: 1;
    }

    #print-score-display .score-of {
        font-size: 8pt;
        color: #718096;
    }

    #print-score-display .score-label {
        font-family: 'Playfair Display', Georgia, serif;
        font-size: 14pt;
        color: #0f1d36;
    }

    #print-score-display .score-sublabel {
        font-size: 9pt;
        color: #718096;
    }

    /* ── Layout Reset ────────────────────────────────────── */
    .cc-wrapper {
        display: block !important;
        grid-template-columns: none !important;
    }

    .cc-main {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    .cc-content {
        padding: 0 !important;
        max-width: 100% !important;
    }

    .cc-toolbar {
        display: none !important;
    }

    /* ── Show ALL panels (not just active) ───────────────── */
    .cc-panel {
        display: block !important;
        opacity: 1 !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ── Section Styling ─────────────────────────────────── */
    .cc-panel {
        page-break-before: auto;
        page-break-inside: avoid;
        margin-bottom: 16pt !important;
    }

    /* Major sections get page breaks */
    #cc-panel-retirement,
    #cc-panel-tax,
    #cc-panel-insurance,
    #cc-panel-estate,
    #cc-panel-scenarios {
        page-break-before: always;
    }

    .cc-card {
        background: white !important;
        border: 1pt solid #e2e8f0 !important;
        border-radius: 6pt !important;
        margin-bottom: 12pt !important;
        page-break-inside: avoid;
        box-shadow: none !important;
    }

    .cc-card-header {
        background: #f7fafc !important;
        color: #0f1d36 !important;
        font-size: 11pt !important;
        font-weight: 700 !important;
        padding: 8pt 12pt !important;
        border-bottom: 1pt solid #e2e8f0 !important;
        border-radius: 6pt 6pt 0 0 !important;
    }

    .cc-card-body {
        padding: 12pt !important;
        color: #2d3748 !important;
        font-size: 9.5pt !important;
    }

    /* ── Metrics Grid ────────────────────────────────────── */
    .cc-metrics {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10pt !important;
        margin-bottom: 16pt !important;
    }

    .cc-metric {
        background: #f7fafc !important;
        border: 1pt solid #e2e8f0 !important;
        border-radius: 6pt !important;
        padding: 10pt !important;
        text-align: center !important;
        page-break-inside: avoid;
    }

    .cc-label {
        font-size: 7.5pt !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5pt !important;
        color: #718096 !important;
        margin-bottom: 4pt !important;
    }

    .cc-val {
        font-size: 16pt !important;
        font-weight: 800 !important;
        color: #0f1d36 !important;
    }

    .cc-sub {
        font-size: 7.5pt !important;
        color: #a0aec0 !important;
    }

    /* ── Split Layout ────────────────────────────────────── */
    .cc-split {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12pt !important;
        margin-bottom: 12pt !important;
    }

    /* ── Data Rows & Tables ──────────────────────────────── */
    .cc-row {
        padding: 6pt 10pt !important;
        border-bottom: 0.5pt solid #edf2f7 !important;
        font-size: 9pt !important;
        color: #2d3748 !important;
        page-break-inside: avoid;
    }

    .cc-row:last-child {
        border-bottom: none !important;
    }

    .cc-badge {
        background: #d69e2e !important;
        color: white !important;
        padding: 1pt 6pt !important;
        border-radius: 3pt !important;
        font-size: 7pt !important;
        font-weight: 700 !important;
    }

    .cc-badge-red {
        background: #e53e3e !important;
    }

    .cc-tag {
        font-size: 7pt !important;
        padding: 1pt 5pt !important;
        border-radius: 3pt !important;
    }

    .cc-tag-gold {
        background: #fefcbf !important;
        color: #744210 !important;
    }

    .cc-tag-green {
        background: #c6f6d5 !important;
        color: #22543d !important;
    }

    .cc-tag-red {
        background: #fed7d7 !important;
        color: #742a2a !important;
    }

    /* ── Quick Plan Sections ─────────────────────────────── */
    .plan-output {
        background: white !important;
        color: #1a202c !important;
        padding: 0 !important;
    }

    .section {
        margin-bottom: 14pt !important;
        page-break-inside: avoid;
    }

    .section-title {
        font-family: 'Playfair Display', Georgia, serif !important;
        font-size: 13pt !important;
        font-weight: 700 !important;
        color: #0f1d36 !important;
        margin-bottom: 8pt !important;
        padding-bottom: 4pt !important;
        border-bottom: 1.5pt solid #d69e2e !important;
    }

    .section-title .emoji {
        margin-right: 4pt !important;
    }

    .insight-card {
        background: #f7fafc !important;
        border: 1pt solid #e2e8f0 !important;
        border-radius: 6pt !important;
        padding: 10pt 12pt !important;
        color: #2d3748 !important;
        font-size: 9.5pt !important;
        page-break-inside: avoid;
    }

    .risk-card {
        background: #fff5f5 !important;
        border: 1pt solid #fed7d7 !important;
        border-radius: 6pt !important;
        padding: 10pt 12pt !important;
        color: #2d3748 !important;
        page-break-inside: avoid;
    }

    .risk-card h4 {
        color: #e53e3e !important;
        font-size: 10pt !important;
    }

    /* ── Score Section (quick plan) ──────────────────────── */
    .plan-score {
        text-align: center !important;
        margin-bottom: 16pt !important;
        page-break-after: avoid;
    }

    .plan-score h2 {
        font-family: 'Playfair Display', Georgia, serif !important;
        font-size: 16pt !important;
        color: #0f1d36 !important;
    }

    .score-display {
        font-size: 36pt !important;
        font-weight: 800 !important;
        color: #d69e2e !important;
    }

    /* ── CTA Section → becomes "Next Steps" ──────────────── */
    .plan-cta {
        background: #f7fafc !important;
        border: 1.5pt solid #0f1d36 !important;
        border-radius: 6pt !important;
        padding: 14pt !important;
        text-align: center !important;
        page-break-inside: avoid;
        margin-top: 16pt !important;
    }

    .plan-cta h3 {
        font-family: 'Playfair Display', Georgia, serif !important;
        font-size: 13pt !important;
        color: #0f1d36 !important;
        margin-bottom: 6pt !important;
    }

    .plan-cta p {
        font-size: 9pt !important;
        color: #4a5568 !important;
    }

    .cc-cta-section {
        background: #f7fafc !important;
        border: 1.5pt solid #0f1d36 !important;
        border-radius: 6pt !important;
        padding: 14pt !important;
        text-align: center !important;
        page-break-inside: avoid;
        margin-top: 16pt !important;
    }

    .cc-cta-section h3 {
        font-family: 'Playfair Display', Georgia, serif !important;
        font-size: 13pt !important;
        color: #0f1d36 !important;
        margin-bottom: 6pt !important;
    }

    .cc-cta-section p {
        font-size: 9pt !important;
        color: #4a5568 !important;
    }

    /* ── Disclaimer ──────────────────────────────────────── */
    .disclaimer,
    .cc-disclaimer {
        font-size: 7pt !important;
        color: #a0aec0 !important;
        border-top: 0.5pt solid #e2e8f0 !important;
        padding-top: 10pt !important;
        margin-top: 20pt !important;
        line-height: 1.4 !important;
        page-break-before: auto;
    }

    /* ── Print Footer Section (injected by JS) ───────────── */
    #print-footer {
        display: block !important;
        margin-top: 24pt;
        padding-top: 12pt;
        border-top: 1pt solid #e2e8f0;
        text-align: center;
        page-break-before: auto;
    }

    #print-footer .print-contact {
        font-size: 10pt;
        color: #0f1d36;
        font-weight: 600;
        margin-bottom: 4pt;
    }

    #print-footer .print-url {
        font-size: 8pt;
        color: #718096;
        margin-bottom: 8pt;
    }

    #print-footer .print-advisor {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10pt;
        margin-top: 10pt;
    }

    #print-footer .print-advisor img {
        width: 48pt;
        height: 48pt;
        border-radius: 50%;
        object-fit: cover;
        border: 2pt solid #d69e2e;
    }

    #print-footer .print-advisor-info {
        text-align: left;
        font-size: 8.5pt;
        color: #4a5568;
    }

    #print-footer .print-advisor-info strong {
        display: block;
        font-size: 10pt;
        color: #0f1d36;
    }

    /* ── Typography Overrides ────────────────────────────── */
    h1, h2, h3 {
        font-family: 'Playfair Display', Georgia, serif !important;
        color: #0f1d36 !important;
    }

    h2 {
        font-size: 14pt !important;
    }

    h3 {
        font-size: 12pt !important;
    }

    a {
        color: #2c5282 !important;
        text-decoration: none !important;
    }

    /* ── Ensure inline styles with dark backgrounds print well ── */
    [style*="background:rgba"],
    [style*="background:linear-gradient"],
    [style*="background:#0"] {
        background: #f7fafc !important;
        color: #1a202c !important;
    }

    [style*="color:white"],
    [style*="color:#e2e8f0"],
    [style*="color:#cbd5e0"] {
        color: #1a202c !important;
    }

    [style*="color:#d69e2e"],
    [style*="color:#ecc94b"] {
        color: #b7791f !important;
    }

    [style*="color:#48bb78"],
    [style*="color:#38a169"] {
        color: #276749 !important;
    }

    [style*="color:#fc8181"],
    [style*="color:#e53e3e"] {
        color: #c53030 !important;
    }

    [style*="color:#4299e1"],
    [style*="color:#90cdf4"] {
        color: #2b6cb0 !important;
    }

    /* Mono values stay bold */
    .mono, [style*="JetBrains"] {
        font-family: 'Inter', monospace !important;
        font-weight: 800 !important;
    }

    /* ── Utility ─────────────────────────────────────────── */
    .page-break-before {
        page-break-before: always;
    }

    .no-break {
        page-break-inside: avoid;
    }

    /* Hide screen-only elements explicitly */
    .screen-only {
        display: none !important;
    }
}
