/* =========================================================
   UI STYLES (BOOTSTRAP 5 ENHANCEMENT)
   ========================================================= */
:root {
    --brand-primary: #1e3a8a;
    --brand-primary-dark: #172554;
    --brand-accent: #2563eb;
    --surface-bg: #f1f5f9;
    --border-subtle: #e2e8f0;
}

body.app-body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--surface-bg);
    color: #1e293b;
}

.navbar-legal {
    background: linear-gradient(135deg, var(--brand-primary-dark) 0%, var(--brand-primary) 100%);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.15);
}

.hero-banner {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-left: 5px solid var(--brand-primary);
    border-radius: 0.75rem;
}

.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.card-modern {
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.table-archive thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-subtle);
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.table-archive tbody td {
    vertical-align: middle;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}

.badge-status-final {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    font-weight: 600;
}

.badge-status-draft {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    font-weight: 600;
}

.nav-pills-legal .nav-link {
    color: #475569;
    font-weight: 600;
    border: 1px solid var(--border-subtle);
    background-color: #ffffff;
    margin-right: 0.5rem;
    border-radius: 0.5rem;
}

.nav-pills-legal .nav-link.active {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}

.pasal-textarea {
    font-family: 'Times New Roman', Times, serif;
    font-size: 1rem;
    line-height: 1.6;
    background-color: #fcfcfd;
}

.pasal-textarea:focus {
    background-color: #ffffff;
    border-color: var(--brand-accent);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.sticky-action-bar {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border-subtle);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
}

/* =========================================================
   DOCUMENT PREVIEW & PRINT STYLES (A4 / F4 LEGAL FORMAT)
   ========================================================= */
body.print-preview-body {
    background-color: #334155;
    margin: 0;
    padding: 0;
}

.print-toolbar {
    background-color: #0f172a;
    color: #f8fafc;
    border-bottom: 1px solid #1e293b;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.paper-wrapper {
    padding: 2rem 1rem 4rem;
    display: flex;
    justify-content: center;
}

.paper-sheet {
    background-color: #ffffff;
    color: #000000;
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
    line-height: 1.5;
    width: 210mm;
    min-height: 297mm;
    padding: 20mm 22mm;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
}

.paper-sheet.paper-f4 {
    width: 215mm;
    min-height: 330mm;
}

.print-layout-table {
    width: 100%;
    border-collapse: collapse;
}

.print-margin-top,
.print-margin-bottom {
    display: none;
}

.print-content-cell {
    padding: 0;
}

.doc-header {
    text-align: center;
    margin-bottom: 18pt;
}

.doc-title {
    font-size: 14pt;
    font-weight: bold;
    text-transform: uppercase;
    text-decoration: underline;
    letter-spacing: 0.4px;
    margin: 0 0 4pt 0;
}

.doc-number {
    font-size: 12pt;
    font-weight: bold;
    margin: 0;
}

.doc-paragraph {
    text-align: justify;
    margin-bottom: 10pt;
}

.party-block {
    margin: 8pt 0 10pt 0;
}

.party-heading {
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 4pt;
}

.party-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 6pt;
}

.party-table td {
    vertical-align: top;
    padding: 1.5pt 0;
    font-size: 12pt;
    line-height: 1.45;
}

.party-table td.label-col {
    width: 165px;
}

.party-table td.colon-col {
    width: 16px;
    text-align: center;
}

.pasal-section {
    margin-top: 12pt;
    margin-bottom: 10pt;
}

.pasal-header {
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 6pt;
    page-break-after: avoid;
    break-after: avoid;
}

.pasal-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 3pt;
    text-align: justify;
}

.pasal-num {
    width: 22px;
    flex-shrink: 0;
}

.pasal-subitem {
    display: flex;
    align-items: flex-start;
    margin-left: 22px;
    margin-bottom: 2pt;
    text-align: justify;
}

.pasal-subnum {
    width: 20px;
    flex-shrink: 0;
}

.pasal-text {
    flex: 1;
}

.pasal-plain {
    text-align: justify;
    margin: 0 0 4pt 0;
}

.signature-section {
    margin-top: 22pt;
    page-break-inside: avoid;
    break-inside: avoid;
}

.signature-date {
    text-align: left;
    margin-bottom: 12pt;
}

.signature-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.signature-table td {
    width: 50%;
    vertical-align: top;
}

.signature-role {
    font-weight: bold;
    text-transform: uppercase;
}

.signature-space {
    height: 68pt;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10pt;
    font-style: italic;
    color: #333333;
}

.signature-name {
    font-weight: bold;
}

@media print {
    html,
    body.print-preview-body {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .no-print {
        display: none !important;
    }

    .paper-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
    }

    .paper-sheet,
    .paper-sheet.paper-f4 {
        width: 100% !important;
        min-height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    .print-layout-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .print-layout-table thead {
        display: table-header-group !important;
    }

    .print-layout-table tfoot {
        display: table-footer-group !important;
    }

    .print-margin-top {
        display: block !important;
        height: 20mm !important;
    }

    .print-margin-bottom {
        display: block !important;
        height: 20mm !important;
    }

    .print-content-cell {
        padding: 0 22mm !important;
    }
}