﻿:root {
    --primary: #2563EB; /* Royal Blue */
    --secondary: #64748B;
    --bg-page: #E5E7EB;
    --bg-slide: #FFFFFF;
    --text-main: #1F2937;
    --text-light: #6B7280;
    --success: #10B981;
    --danger: #EF4444;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    
    /* Slide size for screen view (close to A4) */
    --slide-width: 1000px; 
    --slide-aspect: 1.414; /* A4 aspect ratio (approximate) */
    --slide-min-height: 700px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Navigation */
.no-print {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: white;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1rem 0;
}

.print-mode .no-print {
    display: none !important;
}

.nav-container {
    width: var(--slide-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    margin-right: 20px;
    font-size: 0.9rem;
}

.btn-print {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

.btn-print-main {
    background: var(--primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-export {
    background: #334155;
}

.export-more {
    position: relative;
}

.export-more summary {
    list-style: none;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    background: #F8FAFC;
}

.export-more summary::-webkit-details-marker {
    display: none;
}

.export-more-content {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 300px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    background: white;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 120;
}

.btn-print:disabled {
    opacity: 0.7;
    cursor: wait;
}

.export-status {
    min-width: 180px;
    font-size: 12px;
    color: var(--text-light);
}

.export-status a {
    color: inherit;
    font-weight: 700;
    margin-left: 4px;
}

.export-status.ok { color: var(--success); }
.export-status.err { color: var(--danger); }

.report-container {
    margin-top: 80px; /* Offset for fixed navbar */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding-bottom: 80px;
}

/* Slide */
.slide {
    width: var(--slide-width);
    min-height: var(--slide-min-height);
    background: var(--bg-slide);
    padding: 40px 50px;
    box-shadow: var(--shadow);
    position: relative;
    border-radius: 2px; /* Slight rounding for screen view */
}

/* Header inside slide */
.slide-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.slide-header h1 {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-main);
}

.subtitle {
    display: block;
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 500;
}

.header-right {
    text-align: right;
    font-size: 12px;
    color: var(--secondary);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* Content */
.slide-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Grids */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.kpi-grid-small {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.kpi-card {
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    background: #FAFAFA;
}

.kpi-label {
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 800;
    margin: 8px 0;
    color: var(--primary);
}

.kpi-delta {
    font-size: 12px;
    font-weight: 600;
}

.delta-positive { color: var(--success); }
.delta-negative { color: var(--danger); }

/* Charts */
.charts-row {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.chart-card {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

.chart-card.full-width { width: 100%; }
.chart-card.half { flex: 0.5; }

.chart-card h3 {
    font-size: 16px;
    margin-bottom: 15px;
}

.chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}

.chart-wrapper-circle {
    position: relative;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.h-200 { height: 200px; }

/* Funnel */
.funnel-container {
    padding: 20px 0;
}

.funnel-step {
    margin-bottom: 10px;
}

.step-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.bar {
    background: var(--primary);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    min-width: 50px;
}

.bar.success { background: var(--success); }

.conversion-arrow {
    font-size: 12px;
    color: var(--secondary);
    margin: 5px 0 15px 20px;
    padding-left: 10px;
    border-left: 2px solid var(--border);
}

/* Tables */
.table-container {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.simple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.simple-table th {
    background: #F8FAFC;
    text-align: left;
    padding: 12px;
    color: var(--text-light);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.simple-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.simple-table tr:last-child td { border-bottom: none; }
.simple-table td[colspan] { text-align: center; color: var(--text-light); }

.chart-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 14px;
}

/* Specific layouts */
.grid-2-1 {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

.flex-row { display: flex; }
.gap-20 { gap: 20px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

.text-block {
    background: #F8FAFC;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.text-block h3 {
    font-size: 16px;
    margin-bottom: 10px;
}
.text-block p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
}
.danger-text { color: var(--danger); }

/* Checklists and lists */
.lists-container {
    display: flex;
    gap: 30px;
}
.list-box { flex: 1; }
.list-box ul, .checklist {
    list-style: none;
    margin-top: 15px;
}
.list-box ul li, .checklist li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.5;
}
.list-box ul li::before, .checklist li::before {
    content: "\2022";
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.final-conclusion {
    margin-top: 30px;
    background: var(--text-main);
    color: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}
.final-conclusion h3 { margin-bottom: 10px; font-size: 20px; }
.final-conclusion p { font-size: 18px; font-weight: 300; }

/* Grid cards (seasonality/competitors) */
.prediction-cards, .competitors-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}
.info-card {
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 6px;
}
.info-card h4 { font-size: 14px; margin-bottom: 5px; }
.info-card .val { font-size: 18px; font-weight: bold; color: var(--primary); }
.highlight { background: #ECFDF5; border-color: var(--success); }
.big-stat { font-size: 24px; font-weight: 800; color: var(--success); margin: 10px 0; }

.row-donuts { display: flex; gap: 20px; }

/* --- PRINT --- */
@media print {
    @page {
        size: A4;
        margin: 0;
    }

    html, body {
        width: 210mm;
        margin: 0;
        padding: 0;
    }

    body {
        background: white;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 12px;
    }

    .no-print,
    .btn-print,
    nav {
        display: none !important;
    }

    .report-container {
        margin: 0;
        padding: 0;
        gap: 0;
        display: block;
    }

    .slide {
        box-sizing: border-box;
        width: 210mm;
        min-height: 297mm;
        margin: 0;
        padding: 8mm 10mm;
        box-shadow: none;
        border: none;
        border-radius: 0;
        page-break-before: always;
        page-break-after: always;
        page-break-inside: avoid;
        break-before: page;
        break-after: page;
        break-inside: avoid-page;
    }

    .slide:first-child {
        page-break-before: auto;
        break-before: auto;
    }

    .slide-header {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .slide-header h1 {
        font-size: 22px;
    }

    .subtitle,
    .header-right {
        font-size: 11px;
    }

    .slide-content {
        gap: 12px;
    }

    .kpi-grid,
    .kpi-grid-small,
    .prediction-cards,
    .competitors-grid {
        gap: 10px;
    }

    .kpi-card,
    .chart-card,
    .text-block,
    .info-card,
    .table-container {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .kpi-card {
        padding: 10px;
    }

    .kpi-value {
        font-size: 20px;
    }

    .chart-card {
        padding: 12px;
    }

    .chart-card h3 {
        margin-bottom: 8px;
        font-size: 14px;
    }

    .chart-wrapper {
        height: 150px;
    }

    .chart-wrapper-circle {
        height: 135px;
    }

    .chart-wrapper canvas,
    .chart-wrapper-circle canvas {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        display: block !important;
    }

    .h-200 {
        height: 150px;
    }

    .text-block {
        padding: 12px;
    }

    .text-block p,
    .simple-table,
    .list-box ul li,
    .checklist li {
        font-size: 12px;
        line-height: 1.35;
    }

    .simple-table thead {
        display: table-header-group;
    }

    .simple-table tfoot {
        display: table-footer-group;
    }

    .simple-table tr,
    .simple-table td,
    .simple-table th {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .simple-table th,
    .simple-table td {
        padding: 6px 8px;
        vertical-align: top;
        word-break: break-word;
    }

    .lists-container,
    .row-donuts,
    .charts-row,
    .flex-row {
        gap: 10px;
    }

    .final-conclusion {
        margin-top: 12px;
        padding: 14px;
    }

    .final-conclusion p {
        font-size: 14px;
    }
}

@media print and (orientation: landscape) {
    html, body {
        width: 297mm;
    }

    .slide {
        width: 297mm;
        min-height: 210mm;
        padding: 6mm 8mm;
    }

    .slide-header h1 {
        font-size: 20px;
    }

    .chart-wrapper {
        height: 125px;
    }

    .chart-wrapper-circle {
        height: 110px;
    }

    .h-200 {
        height: 125px;
    }
}

@media print and (orientation: portrait) {
    html, body {
        width: 210mm;
    }

    .slide {
        width: 210mm;
        min-height: 297mm;
        padding: 8mm 10mm;
    }

    .slide-header h1 {
        font-size: 18px;
    }

    .chart-wrapper {
        height: 145px;
    }

    .chart-wrapper-circle {
        height: 128px;
    }

    .h-200 {
        height: 145px;
    }

    .kpi-value {
        font-size: 17px;
    }

    .kpi-label,
    .kpi-delta,
    .simple-table,
    .text-block p {
        font-size: 11px;
    }
}
