/* Master report shared CSS. Source of truth for the report stylesheet:
   published as a content-hashed file (output/styles/report-<hash>.css)
   by utils/stylesheet_publisher.py and referenced from manifest entries
   via css_file. Fragments no longer embed this CSS. */

/* Mobile-first base styles (320px-767px) */
.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;
}

.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;
}

/* Trademark disclaimer - tiny footnote styling */
.trademark-disclaimer {
    font-size: 0.7rem;
    opacity: 0.65;
    font-style: italic;
    margin-top: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.8);
    max-width: 100%;
}

/* Logo Badge - Mobile (stacked, centered) */
.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;
}

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;
}

/* AEO answer capsule — 40-60 word direct-answer paragraph for snippet extraction */
.answer-capsule {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #2d3748;
    margin: 8px 0 16px 0;
}

/* Item 19 sales/revenue section */
.item19-section {
    padding-top: 10px;
    padding-bottom: 16px;
}

.item19-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
}

.item19-header-warning {
    background: #fff8df;
    border-left: 4px solid #ecc94b;
    border-radius: 6px;
    color: #4a3a00;
    font-size: 0.84rem;
    line-height: 1.4;
    margin: 0 0 12px 0;
    padding: 8px 10px;
}

.item19-kicker {
    color: #718096;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0;
}

.item19-value {
    color: #1a202c;
    font-size: 2.25rem;
    font-weight: 750;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.item19-description {
    color: #2d3748;
    font-size: 0.98rem;
    line-height: 1.55;
    margin: 6px 0 0 0;
    max-width: 720px;
}

.item19-note {
    border-left: 4px solid #4299e1;
    border-radius: 6px;
    color: #2d3748;
    font-size: 0.82rem;
    line-height: 1.45;
    padding: 8px 10px;
}

.item19-note-info {
    background: #eef6ff;
    border-left-color: #4299e1;
    color: #1f4b6e;
}

.item19-note-caution {
    background: #fff8df;
    border-left-color: #ecc94b;
    color: #4a3a00;
}

.item19-details-list {
    border-top: 1px solid #e2e8f0;
    display: grid;
    gap: 0;
    margin-top: 14px;
}

.item19-detail {
    border-bottom: 1px solid #e2e8f0;
    padding: 9px 0;
}

.item19-detail summary {
    color: #2d3748;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 650;
    list-style-position: outside;
}

.item19-detail p {
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.55;
    margin: 7px 0 0 18px;
}

.charts-section {
    margin: 16px 0;
}

.chart-container {
    margin: 16px 0;
    text-align: center;
    padding: 16px 12px;
    background: #fdfdfe;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.performance-chart {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* FAQ section */
.faq-section {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
}

.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;
}

.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;
}

/* Responsive tables */
.data-table {
    width: 100%;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* Two-column layouts (stacked on mobile) */
.pros-cons .row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Pros & Cons styled boxes */
.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;
}

.pros-cons h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #2d3748;
}

/* Key metrics grid */
.key-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* Score Section Containers */
.legal-risk-container,
.territory-protection-container,
.training-support-container,
.stability-score-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;
}

/* Row containing circle + text */
.legal-risk-row,
.territory-protection-row,
.training-support-row,
.stability-score-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 2px;
}

/* Circle + label wrapper */
.legal-risk-circle-container,
.territory-protection-circle-container,
.training-support-circle-container,
.stability-score-circle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

/* Score circles - CRITICAL: box-shadow adds depth */
.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 (for excellent scores >90) */
.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 number text (Inside Circle) */
.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 number text (Inside Star - for excellent scores) */
.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 (Below Circle) - Base Style */
.score-label {
    text-align: center;
    margin-top: 4px;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 0 1px #000;
}

/* Score Label Color Variants - MUST match circle background colors */
.score-label-poor {
    color: #ef4444;
}

.score-label-normal {
    color: #E6C200;
}

.score-label-good {
    color: #38a169;
}

.score-label-excellent {
    color: #FFB000;
}

/* Description Text (Right Side on Desktop) */
.score-description {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #2d3748;
}

.score-description p {
    margin: 0;
}

/* Item 19 Metrics Grid */
.item19-metrics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
}

.item19-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;
}

/* Item 19 Toggle Button */
.item19-toggle-container {
    text-align: center;
    margin: 20px 0;
}

.item19-toggle-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(66, 153, 225, 0.3);
    transition: all 0.3s ease;
}

.item19-toggle-btn:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
    transform: translateY(-1px);
}

.item19-toggle-btn:active {
    transform: translateY(0);
}

.toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.item19-toggle-btn.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Item 19 Details (collapsible content) */
.item19-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.item19-details.expanded {
    max-height: 5000px;
    transition: max-height 0.6s ease-in;
}

/* Item 7 Initial Investment — mobile-first */
.item7-section .item7-intro {
    text-align: center;
    font-size: 1rem;
    color: #2d3748;
    margin-bottom: 20px;
    font-weight: 500;
}

.item7-section .item7-subtitle {
    /* Deprecated - replaced by item7-intro */
    display: none;
}

.item7-charts-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.item7-chart-container {
    text-align: center;
    width: 100%;
}

.item7-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
    border-bottom: none;
}

.item7-total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 8px;
}

.item7-chart-container img {
    max-width: 280px;
    width: 100%;
    height: auto;
}

.item7-breakdown {
    margin-top: 12px;
    text-align: left;
    display: inline-block;
}

.item7-breakdown-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #e2e8f0;
    align-items: center;
}

.item7-breakdown-row:last-child {
    border-bottom: none;
}

.item7-breakdown-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #2d3748;
}

.item7-breakdown-empty {
    width: 20px;
}

.item7-breakdown-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a202c;
    min-width: 80px;
    text-align: right;
}

/* Item 7 Toggle Button */
.item7-toggle-container {
    text-align: center;
    margin: 20px 0;
}

.item7-toggle-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(66, 153, 225, 0.3);
    transition: all 0.3s ease;
}

.item7-toggle-btn:hover {
    background: linear-gradient(135deg, #3182ce 0%, #2c5aa0 100%);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
    transform: translateY(-1px);
}

.item7-toggle-btn:active {
    transform: translateY(0);
}

.item7-toggle-btn.expanded .toggle-icon {
    transform: rotate(180deg);
}

/* Item 7 Details (collapsible content) */
.item7-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.item7-details.expanded {
    max-height: 5000px;
    transition: max-height 0.6s ease-in;
}

/* Item 7 Breakdown Container (single column for toggle) */
.item7-breakdown-container {
    margin-bottom: 20px;
}

.item7-breakdown-container h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    text-align: center;
}

.item7-breakdown-row-single {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.item7-breakdown-row-single:last-child {
    border-bottom: none;
}

.item7-breakdown-label-single {
    flex: 1;
    font-size: 0.9rem;
    color: #2d3748;
}

.item7-breakdown-value-single {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a202c;
    min-width: 80px;
    text-align: right;
}

/* Item 7 Breakdown 3-Column Layout (for hidden section) */
.item7-breakdown-3col {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.item7-breakdown-min,
.item7-breakdown-max {
    text-align: center;
}

.item7-breakdown-min h4,
.item7-breakdown-max h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    text-align: center;
}

.item7-breakdown-empty {
    min-width: 100px;
}

/* Item 7 Analysis Section */
.item7-analysis {
    background: #f7fafc;
    border-radius: 6px;
    padding: 16px 20px;
    margin-top: 16px;
}

.item7-analysis h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
}

.item7-analysis p {
    font-size: 0.95rem;
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
}

.item7-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 20px;
    padding: 12px;
}

.item7-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #2d3748;
}

.item7-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    flex-shrink: 0;
    display: inline-block;
}

.item7-boilerplate {
    font-size: 0.8rem;
    color: #718096;
    font-style: italic;
    margin-top: 16px;
    line-height: 1.5;
    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;
    }

    /* Trademark disclaimer - desktop styling */
    .trademark-disclaimer {
        font-size: 0.75rem;
        margin-top: 16px;
    }

    /* Logo Badge - Desktop (horizontal, left-aligned) */
    .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;
    }

    .chart-container {
        padding: 20px 24px;
    }

    .report-footer {
        padding: 24px 32px;
    }

    /* Two-column layouts on desktop */
    .pros-cons .row {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    .key-metrics {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }

    .data-table {
        font-size: 1rem;
    }

    .item19-summary {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
        gap: 20px;
    }

    .item19-value {
        font-size: 3rem;
    }

    /* Score sections - desktop horizontal layout */
    .legal-risk-row,
    .territory-protection-row,
    .training-support-row,
    .stability-score-row {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        gap: 12px;
    }

    .score-description {
        text-align: left;
    }

    /* Item 19 Metrics - 3 column grid on desktop */
    .item19-metrics-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    /* Item 7 desktop: side-by-side charts with centered legend */
    .item7-charts-row {
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
        max-width: 900px;
        margin: 0 auto;
    }

    .item7-chart-container {
        flex: 1 1 0;
        min-width: 0;
        max-width: 300px;
    }

    .item7-chart-container img {
        max-width: 100%;
    }

    .item7-legend {
        flex: 0 0 auto;
        flex-direction: column;
        align-self: center;
        min-width: 160px;
        padding: 0 16px;
    }
}
