/* pSEO shared CSS - curated from report_styles.css (master report).
   Source of truth for the pSEO stylesheet: published as a content-hashed
   file (output/styles/pseo-<hash>.css) by utils/stylesheet_publisher.py
   and referenced from manifest entries via css_file. Fragments no longer
   embed this CSS. Mobile-first (320px-767px), desktop at 768px+. */

/* ===================================================================
   pSEO Shared CSS — curated from master_report_responsive.html
   Mobile-first (320px-767px), desktop enhancements at 768px+
   =================================================================== */

/* --- Base typography & layout (from master report) --- */
.franchise-report {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    color: #1a202c;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px;
    font-size: 16px;
}

/* --- Header (from master report) --- */
.report-header {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    color: white;
    padding: 20px 16px;
    margin-bottom: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.franchise-name {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.header-details {
    font-size: 0.9rem;
    opacity: 0.85;
    font-weight: 400;
    letter-spacing: 0.025em;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.logo-badge {
    width: 80px;
    height: 80px;
    background: #ffffff;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.logo-badge.logo-rectangular {
    width: 120px;
    height: 60px;
}

.logo-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.header-text { flex: 1; }

/* --- Sections (from master report) --- */
section {
    background: white;
    margin-bottom: 10px;
    padding: 4px 20px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
}

h2 {
    color: #2d3748;
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid #cbd5e0;
    letter-spacing: -0.025em;
}

.answer-capsule {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #2d3748;
    margin: 8px 0 16px 0;
}

/* --- Data tables (from master report) --- */
.data-table {
    width: 100%;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* --- Key metrics grid (from master report) --- */
.key-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* --- Score circles (from master report) --- */
.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.score-star {
    width: 120px;
    height: 120px;
    background: #FFB000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    clip-path: polygon(
        50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%,
        50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%
    );
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.score-gold-star { background: #FFB000; }

.score-text-slash {
    font-size: 1.6rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    line-height: 1.1;
}

.score-text-star {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 3px rgba(0,0,0,0.4);
    line-height: 1;
    z-index: 1;
}

.score-label {
    text-align: center;
    margin-top: 4px;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 0 1px #000;
}

.score-label-poor { color: #ef4444; }
.score-label-normal { color: #E6C200; }
.score-label-good { color: #38a169; }
.score-label-excellent { color: #FFB000; }

/* --- Score section containers (from master report) --- */
.score-section-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #4299e1;
}

.score-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 2px;
}

.score-circle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.score-description {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #2d3748;
}

.score-description p { margin: 0; }

/* --- Metric boxes (from Item 19 pattern) --- */
.metric-box {
    background: #f7fafc;
    border-left: 4px solid #4299e1;
    border-radius: 6px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    font-size: 0.95rem;
    color: #2d3748;
    font-weight: 500;
}

.metric-value {
    font-size: 1.1rem;
    color: #1a202c;
    font-weight: 700;
}

/* --- Pros & cons (from master report) --- */
.pros-cons .row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.pros-box, .cons-box {
    padding: 14px;
    margin-bottom: 6px;
    border-radius: 6px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.pros-box {
    background-color: #f0f9f4;
    border-left: 4px solid #38a169;
    color: #276749;
}

.cons-box {
    background-color: #fff5f5;
    border-left: 4px solid #e53e3e;
    color: #c53030;
}

/* --- FAQ (from master report) --- */
.faq-section {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
}

.faq-section h3:first-child {
    color: #2d3748;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.faq-item {
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 0;
}

.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-item h3 {
    color: #2d3748;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.faq-item p {
    color: #4a5568;
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0;
}

/* --- Footer (from master report) --- */
.report-footer {
    background: #2d3748;
    color: white;
    padding: 16px 12px;
    text-align: center;
    border-radius: 6px;
    margin-top: 24px;
    border: 1px solid #4a5568;
}

.disclaimer {
    font-size: 0.75rem;
    opacity: 0.7;
    font-style: italic;
    margin-top: 12px;
    line-height: 1.5;
}

.disclaimer p {
    margin: 4px 0;
}

/* ===================================================================
   pSEO-SPECIFIC STYLES
   =================================================================== */

/* Breadcrumb */
.pseo-breadcrumb {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 12px;
    padding: 0 4px;
}

.pseo-breadcrumb a {
    color: #4299e1;
    text-decoration: none;
}

.pseo-breadcrumb a:hover { text-decoration: underline; }

.pseo-breadcrumb .sep {
    margin: 0 6px;
    color: #a0aec0;
}

.pseo-breadcrumb .current {
    color: #4a5568;
    font-weight: 500;
}

/* Report CTA (prominent link to full report) */
.pseo-report-cta {
    background: linear-gradient(135deg, #ebf8ff 0%, #e6fffa 100%);
    border: 1px solid #bee3f8;
    border-radius: 8px;
    padding: 14px 20px;
    margin: 12px 0 16px 0;
    text-align: center;
}

.report-cta-link {
    color: #2b6cb0;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
}

.report-cta-link:hover {
    text-decoration: underline;
    color: #2c5282;
}

/* Stats grid */
.pseo-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.stat-card {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-context {
    font-size: 0.75rem;
    color: #a0aec0;
    margin-top: 4px;
}

/* Benchmark context bar */
.benchmark-context {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 0.9rem;
    color: #4a5568;
}

.benchmark-context strong { color: #2d3748; }

/* Related pages */
.pseo-related-pages {
    margin: 24px 0 16px 0;
    padding: 16px 20px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.pseo-related-pages h3 {
    color: #2d3748;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.pseo-related-pages ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pseo-related-pages li {
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
}

.pseo-related-pages li:last-child { border-bottom: none; }

.pseo-related-pages a {
    color: #4299e1;
    text-decoration: none;
    font-weight: 500;
}

.pseo-related-pages a:hover { text-decoration: underline; }

.related-desc {
    display: block;
    font-size: 0.8rem;
    color: #718096;
    margin-top: 2px;
}

/* Site CTA */
.pseo-site-cta {
    text-align: center;
    padding: 20px;
    margin: 16px 0;
}

.site-cta-link {
    display: inline-block;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    padding: 12px 28px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(66, 153, 225, 0.3);
    transition: all 0.2s ease;
}

.site-cta-link:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
    transform: translateY(-1px);
}

/* Cost breakdown — bucket groups with line items */
.cost-breakdown-table { margin: 12px 0; }

.bucket-group { margin-bottom: 4px; }

.bucket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 8px 0;
    border-bottom: 2px solid #cbd5e0;
}

.bucket-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bucket-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot-fee        { background: #4299e1; }
.dot-real_estate { background: #48bb78; }
.dot-assets     { background: #ed8936; }
.dot-training   { background: #9f7aea; }
.dot-reserves   { background: #f56565; }
.dot-other      { background: #a0aec0; }

.bucket-total {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2d3748;
    white-space: nowrap;
}

.line-item-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0 6px 22px;
    border-bottom: 1px solid #f0f4f8;
    font-size: 0.88rem;
}
.line-item-row:last-child { border-bottom: none; }

.line-item-label {
    color: #4a5568;
    flex: 1;
    padding-right: 12px;
}

.line-item-value {
    color: #2d3748;
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
}

.line-item-meta {
    font-size: 0.78rem;
    color: #a0aec0;
    margin-left: 8px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 10px 0;
    border-top: 2px solid #2d3748;
    margin-top: 4px;
    font-weight: 700;
    font-size: 1rem;
}

/* Pie chart pair layout */
.cost-pie-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

.cost-pie-chart {
    text-align: center;
}

.cost-pie-chart img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.cost-pie-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

/* Quick facts grid (for requirements pages) */
.quick-facts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 12px 0;
}

.quick-fact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f7fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.quick-fact-label {
    font-size: 0.9rem;
    color: #4a5568;
}

.quick-fact-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a202c;
}

.fact-yes { color: #38a169; }
.fact-no { color: #e53e3e; }
.fact-na { color: #a0aec0; }

/* Scores row (for reviews pages — horizontal on mobile too) */
.pseo-scores-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 16px 0;
}

.pseo-score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 100px;
}

.pseo-score-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
    text-align: center;
}

/* ===================================================================
   DESKTOP ENHANCEMENTS (768px+)
   =================================================================== */
@media (min-width: 768px) {
    .franchise-report {
        padding: 24px;
        max-width: 1100px;
    }

    .report-header {
        padding: 32px 40px;
        margin-bottom: 24px;
    }

    .franchise-name { font-size: 2.25rem; }

    .header-content {
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: 24px;
    }

    .logo-badge {
        width: 100px;
        height: 100px;
        margin-bottom: 0;
    }

    .logo-badge.logo-rectangular {
        width: 150px;
        height: 75px;
    }

    .header-text { text-align: left; }

    section {
        padding: 4px 20px;
        margin-bottom: 10px;
    }

    h2 { font-size: 1.5rem; }

    .report-footer { padding: 24px 32px; }

    .key-metrics {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }

    .data-table { font-size: 1rem; }

    .pros-cons .row {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    /* Score sections horizontal on desktop */
    .score-row {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 12px;
    }

    .score-description { text-align: left; }

    /* pSEO stats grid: 4 columns on desktop */
    .pseo-stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }

    /* Quick facts: 2 columns on desktop */
    .quick-facts-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Pie charts side by side on desktop (already grid 1fr 1fr) */
}

/* Mobile: stack pie charts and wrap long line items */
@media (max-width: 767px) {
    .cost-pie-charts {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .line-item-row {
        flex-wrap: wrap;
        padding-left: 18px;
    }

    .line-item-value {
        width: 100%;
        text-align: left;
        padding-left: 0;
        margin-top: 2px;
    }

    .line-item-meta {
        display: block;
        margin-left: 0;
        margin-top: 2px;
    }
}
