/* =====================================================================
   Transport Command Center V2 — Modul Laporan & Repositori Eksekutif
   Styles & Print Architecture
   BPTD Kelas I Jawa Barat — Kementerian Perhubungan RI
   ===================================================================== */

/* Toolbar & Filter Styling */
.report-toolbar-card {
    padding: var(--space-4, 1rem) var(--space-5, 1.25rem);
    margin-bottom: var(--space-6, 1.5rem);
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: var(--radius-lg, 0.75rem);
}

.report-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-4, 1rem);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 170px;
    flex: 1 1 180px;
}

.filter-group.filter-search-wrap {
    flex: 2 1 240px;
    min-width: 220px;
}

.filter-group.filter-actions-wrap {
    flex: 0 0 auto;
    min-width: auto;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted, #64748b);
}

.form-select,
.form-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-primary, #0f172a);
    background-color: var(--surface-input, #f8fafc);
    border: 1px solid var(--border-medium, #cbd5e1);
    border-radius: var(--radius-md, 0.5rem);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--brand-primary, #0284c7);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    background-color: #ffffff;
}

.search-input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-box .search-icon {
    position: absolute;
    left: 0.75rem;
    pointer-events: none;
    color: var(--text-muted, #94a3b8);
}

.search-input-box .form-input {
    padding-left: 2.25rem;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Analytics Card & Tab Headers */
.report-analytics-card {
    padding: 0;
    overflow: hidden;
    background: var(--surface-card, #ffffff);
    border: 1px solid var(--border-subtle, #e2e8f0);
    border-radius: var(--radius-lg, 0.75rem);
    margin-bottom: var(--space-8, 2rem);
}

.report-tabs-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle, #e2e8f0);
    background: #f8fafc;
}

.report-tabs-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    margin: 0;
}

.report-tabs-sub {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    margin: 0.2rem 0 0 0;
}

.report-tablist {
    display: flex;
    gap: 0.35rem;
    background: #e2e8f0;
    padding: 0.25rem;
    border-radius: var(--radius-md, 0.5rem);
}

.report-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary, #475569);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 0.375rem);
    cursor: pointer;
    transition: all 0.15s ease;
}

.report-tab-btn:hover {
    color: var(--text-primary, #0f172a);
    background: rgba(255, 255, 255, 0.5);
}

.report-tab-btn.is-active {
    color: #0284c7;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.report-tabpanel {
    padding: 1.5rem;
}

.report-tabpanel[hidden] {
    display: none !important;
}

.panel-meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.6rem 1rem;
    background: #f1f5f9;
    border-radius: var(--radius-md, 0.5rem);
}

.catalog-count-info {
    font-size: 0.825rem;
    font-weight: 600;
    color: #0f172a;
}

.catalog-tip {
    font-size: 0.75rem;
    color: #64748b;
}

/* Catalog 8 Grid */
.report-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.25rem;
}

.report-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--border-medium, #cbd5e1);
    border-radius: var(--radius-lg, 0.75rem);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    border-color: #93c5fd;
}

.report-card-header {
    padding: 1rem 1.25rem 0.75rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.report-card-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.category-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.675rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-cat-eksekutif { background: #e0f2fe; color: #0369a1; }
.badge-cat-terminal { background: #dbeafe; color: #1d4ed8; }
.badge-cat-uppkb { background: #ffedd5; color: #c2410c; }
.badge-cat-perintis { background: #dcfce7; color: #15803d; }
.badge-cat-od { background: #f3e8ff; color: #7e22ce; }
.badge-cat-konektivitas { background: #ccfbf1; color: #0f766e; }
.badge-cat-early-warning { background: #fee2e2; color: #b91c1c; }
.badge-cat-program { background: #fef3c7; color: #b45309; }

.code-pill {
    font-family: monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: #475569;
    background: #e2e8f0;
    padding: 0.15rem 0.45rem;
    border-radius: 0.25rem;
}

.freq-badge {
    margin-left: auto;
    font-size: 0.675rem;
    color: #64748b;
    font-weight: 500;
}

.report-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
    color: #0f172a;
    margin: 0 0 0.25rem 0;
}

.report-card-unit {
    font-size: 0.75rem;
    color: #64748b;
    margin: 0;
}

.report-card-body {
    padding: 1rem 1.25rem;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.report-card-desc {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #334155;
    margin: 0 0 1rem 0;
}

.report-card-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: auto;
    margin-bottom: 0.5rem;
}

.metric-mini-chip {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm, 0.375rem);
    padding: 0.4rem 0.5rem;
}

.metric-mini-label {
    font-size: 0.65rem;
    color: #64748b;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-mini-val {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0f172a;
    display: block;
}

.report-card-footer {
    padding: 0.75rem 1.25rem;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-action-row-primary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.card-action-row-secondary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.btn-card-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-md, 0.5rem);
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.btn-act-preview {
    background: #0284c7;
    color: #ffffff;
}
.btn-act-preview:hover {
    background: #0369a1;
}

.btn-act-print {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}
.btn-act-print:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.btn-act-csv {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}
.btn-act-csv:hover {
    background: #dcfce7;
}

.btn-act-json {
    background: #faf5ff;
    color: #6b21a8;
    border-color: #e9d5ff;
}
.btn-act-json:hover {
    background: #f3e8ff;
}

/* Preview Tab Styling */
.preview-control-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg, 0.75rem);
    margin-bottom: 1.5rem;
}

.preview-select-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 320px;
}

.preview-select-label {
    font-size: 0.825rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}

.preview-doc-select {
    flex: 1 1 auto;
    font-weight: 600;
}

.preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Formal Sheet On Screen (Official Paper View) */
.official-doc-sheet {
    background: #ffffff;
    color: #111827;
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 3rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-lg, 0.75rem);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

.doc-kop-surat {
    text-align: center;
    position: relative;
    padding-bottom: 0.5rem;
}

.doc-kop-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.doc-kop-instansi {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #000000;
    margin: 0;
    text-transform: uppercase;
}

.doc-kop-ditjen {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #000000;
    margin: 0.15rem 0 0 0;
    text-transform: uppercase;
}

.doc-kop-bptd {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    color: #000000;
    margin: 0.2rem 0 0 0;
    text-transform: uppercase;
}

.doc-kop-alamat {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 0.725rem;
    color: #374151;
    margin: 0.4rem 0 0 0;
    line-height: 1.35;
}

.doc-kop-divider {
    border-top: 2px solid #000000;
    border-bottom: 1px solid #000000;
    height: 4px;
    margin: 0.75rem 0 1.5rem 0;
}

.doc-title-block {
    text-align: center;
    margin-bottom: 1.5rem;
}

.doc-main-title {
    font-size: 1.15rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #000000;
    margin: 0 0 0.35rem 0;
    text-decoration: underline;
}

.doc-meta-sub {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin: 0.15rem 0;
}

.doc-section {
    margin-bottom: 1.5rem;
}

.doc-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #000000;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.35rem;
    margin: 0 0 0.75rem 0;
}

.doc-summary-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #1f2937;
    text-align: justify;
    margin: 0;
    background: #f9fafb;
    padding: 0.85rem 1rem;
    border-left: 3px solid #0284c7;
    border-radius: 0 0.375rem 0.375rem 0;
}

.doc-metrics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.doc-metric-box {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0.375rem;
    padding: 0.65rem 0.85rem;
}

.doc-metric-box-label {
    font-size: 0.7rem;
    color: #4b5563;
    display: block;
    margin-bottom: 0.2rem;
}

.doc-metric-box-val {
    font-size: 1rem;
    font-weight: 800;
    color: #000000;
    display: block;
}

.doc-metric-box-sub {
    font-size: 0.7rem;
    color: #6b7280;
    display: block;
    margin-top: 0.15rem;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-medium, #cbd5e1);
    border-radius: var(--radius-md, 0.5rem);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.report-table th,
.report-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid #e2e8f0;
}

.report-table th {
    background: #f1f5f9;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
}

.report-table tbody tr:hover {
    background: #f8fafc;
}

.report-table .text-right {
    text-align: right;
}

.report-table .text-center {
    text-align: center;
}

/* Formal Document Signature Block */
.doc-signature-block {
    margin-top: 2.5rem;
    display: flex;
    justify-content: flex-end;
    page-break-inside: avoid;
}

.signature-box {
    width: 320px;
    text-align: center;
}

.sig-date {
    font-size: 0.825rem;
    color: #111827;
    margin-bottom: 0.25rem;
}

.sig-title {
    font-size: 0.825rem;
    font-weight: 700;
    color: #000000;
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.sig-stamp-area {
    height: 75px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.sig-qr-box {
    border: 1px dashed #9ca3af;
    background: #f9fafb;
    padding: 0.35rem 0.75rem;
    font-size: 0.65rem;
    color: #4b5563;
    border-radius: 0.25rem;
    font-family: monospace;
}

.sig-name {
    font-size: 0.875rem;
    font-weight: 800;
    color: #000000;
    text-decoration: underline;
    margin: 0;
}

.sig-nip {
    font-size: 0.75rem;
    color: #374151;
    margin: 0.15rem 0 0 0;
}

.doc-legal-note {
    font-size: 0.675rem;
    color: #6b7280;
    margin-top: 2rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
    font-style: italic;
}

/* Modal Dialog Specifics */
.report-modal-dialog {
    max-width: 900px;
    width: 92%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.report-modal-dialog .modal-body {
    overflow-y: auto;
    padding: 1.25rem 1.5rem;
}

.modal-table-wrap {
    max-height: 280px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.modal-footer-left {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Dedicated Print Container (Hidden on Screen) */
.printable-report-sheet {
    display: none;
}

/* =====================================================================
   PRINT MEDIA ARCHITECTURE (@media print)
   Standar Dokumen Resmi Kementerian Perhubungan RI
   ===================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin: 15mm 15mm 15mm 15mm;
    }

    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
        font-size: 9.5pt !important;
        line-height: 1.35 !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Hide entire app shell, sidebars, header, navigation, and modal chrome */
    .app-shell,
    .app-sidebar,
    .sidebar-overlay,
    .app-header,
    .dash-head,
    .kpi-grid,
    .report-toolbar-card,
    .report-analytics-card,
    .modal-backdrop,
    .modal-dialog {
        display: none !important;
    }

    /* Expose only the dedicated printable container */
    #printableReportSheet {
        display: block !important;
        visibility: visible !important;
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
    }

    #printableReportSheet * {
        visibility: visible !important;
        color: #000000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Print Kop Surat */
    .print-kop {
        text-align: center !important;
        margin-bottom: 6px !important;
    }

    .print-kop-kemenhub {
        font-size: 11pt !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.05em !important;
        margin: 0 !important;
    }

    .print-kop-hubdat {
        font-size: 12pt !important;
        font-weight: 800 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.04em !important;
        margin: 1px 0 !important;
    }

    .print-kop-bptd {
        font-size: 13pt !important;
        font-weight: 900 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.03em !important;
        margin: 2px 0 !important;
    }

    .print-kop-address {
        font-size: 7.5pt !important;
        color: #111827 !important;
        margin: 3px 0 0 0 !important;
    }

    .print-kop-divider {
        border-top: 2px solid #000000 !important;
        border-bottom: 1px solid #000000 !important;
        height: 3px !important;
        margin: 6px 0 14px 0 !important;
    }

    /* Print Document Title */
    .print-title-block {
        text-align: center !important;
        margin-bottom: 12px !important;
    }

    .print-title {
        font-size: 11.5pt !important;
        font-weight: 800 !important;
        text-decoration: underline !important;
        text-transform: uppercase !important;
        margin: 0 0 3px 0 !important;
    }

    .print-meta-sub {
        font-size: 8.5pt !important;
        font-weight: 600 !important;
        margin: 1px 0 !important;
    }

    /* Print Summary Section */
    .print-section {
        margin-bottom: 12px !important;
    }

    .print-section-title {
        font-size: 9.5pt !important;
        font-weight: 700 !important;
        text-transform: uppercase !important;
        border-bottom: 1px solid #000000 !important;
        padding-bottom: 2px !important;
        margin: 0 0 6px 0 !important;
    }

    .print-summary-box {
        font-size: 8.5pt !important;
        line-height: 1.4 !important;
        text-align: justify !important;
        margin: 0 !important;
        padding: 4px 6px !important;
        border: 1px solid #9ca3af !important;
    }

    /* Print Metrics Grid */
    .print-metrics-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        margin-bottom: 10px !important;
    }

    .print-metric-chip {
        border: 1px solid #000000 !important;
        padding: 4px 6px !important;
        text-align: center !important;
    }

    .print-metric-chip-label {
        font-size: 7pt !important;
        display: block !important;
    }

    .print-metric-chip-val {
        font-size: 9pt !important;
        font-weight: 800 !important;
        display: block !important;
    }

    /* Print Data Table */
    .print-table {
        width: 100% !important;
        border-collapse: collapse !important;
        font-size: 8pt !important;
        margin: 8px 0 !important;
        page-break-inside: auto !important;
    }

    .print-table th,
    .print-table td {
        border: 1px solid #000000 !important;
        padding: 4px 6px !important;
    }

    .print-table th {
        background-color: #f3f4f6 !important;
        font-weight: 700 !important;
        text-align: center !important;
    }

    .print-table tr {
        page-break-inside: avoid !important;
    }

    /* Print Signature Block */
    .print-signature-section {
        page-break-inside: avoid !important;
        margin-top: 18px !important;
        display: flex !important;
        justify-content: flex-end !important;
    }

    .print-signature-box {
        width: 280px !important;
        text-align: center !important;
    }

    .print-sig-date {
        font-size: 8.5pt !important;
        margin-bottom: 2px !important;
    }

    .print-sig-title {
        font-size: 8.5pt !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
        margin-bottom: 4px !important;
    }

    .print-sig-space {
        height: 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .print-sig-qr {
        border: 1px dashed #4b5563 !important;
        padding: 2px 6px !important;
        font-size: 6.5pt !important;
        font-family: monospace !important;
    }

    .print-sig-name {
        font-size: 9pt !important;
        font-weight: 800 !important;
        text-decoration: underline !important;
        margin: 0 !important;
    }

    .print-sig-nip {
        font-size: 8pt !important;
        margin: 1px 0 0 0 !important;
    }

    .print-footer-notice {
        font-size: 6.5pt !important;
        color: #4b5563 !important;
        text-align: center !important;
        margin-top: 14px !important;
        border-top: 0.5px solid #9ca3af !important;
        padding-top: 4px !important;
        font-style: italic !important;
    }
}
