/* ==========================================================================
   SYNSCORE ERP - Custom Styles & Print Engine
   PT. NANO SYNS TEKNOLOGI
   ========================================================================== */

/* Font Definition */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: #1e293b;
    background-color: #f8fafc;
}

[x-cloak] {
    display: none !important;
}

.font-mono-code {
    font-family: 'JetBrains Mono', monospace;
}

/* Hilangkan Stepper / Panah Up-Down pada Input Number (Manual Input Bersih) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* Mobile Touch & Responsive Optimizations */
@media screen and (max-width: 640px) {
    input, select, textarea {
        font-size: 14px !important; /* Prevents unwanted auto-zoom on mobile browsers */
    }
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==========================================================================
   A4 PRINT ENGINE - CALIBRI 11pt EXCEL MATCH PRECISE TYPOGRAPHY
   ========================================================================== */

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm 15mm 15mm 15mm;
    }

    html, body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: 'Calibri', 'Segoe UI', Tahoma, Arial, sans-serif !important;
        font-size: 11pt !important;
        line-height: 1.35 !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Sembunyikan elemen UI non-cetak */
    .no-print, header, nav, aside, .sidebar, #main-header, #main-sidebar, .toast-container, button, .btn-action {
        display: none !important;
    }

    /* Pastikan container cetak mengambil lebar penuh */
    .print-container {
        display: block !important;
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* Kop Surat Header Formal */
    .kop-surat-header {
        border-bottom: 3px double #000000;
        padding-bottom: 8px;
        margin-bottom: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .kop-surat-title {
        font-size: 16pt !important;
        font-weight: bold !important;
        letter-spacing: 0.5px;
        color: #000000 !important;
        text-transform: uppercase;
        margin: 0;
    }

    .kop-surat-sub {
        font-size: 9.5pt !important;
        line-height: 1.25 !important;
        color: #111111 !important;
        margin-top: 3px;
    }

    /* Dokumen Tabel Format Presisi Excel */
    table.print-table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 10px;
        margin-bottom: 12px;
        font-size: 10.5pt !important;
    }

    table.print-table th {
        background-color: #f2f2f2 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border: 1px solid #333333 !important;
        padding: 6px 8px !important;
        font-weight: bold !important;
        text-align: left;
    }

    table.print-table td {
        border: 1px solid #555555 !important;
        padding: 5px 8px !important;
        vertical-align: middle;
    }

    .border-top-double {
        border-top: 3px double #000000 !important;
    }

    /* Baris Tanda Tangan Formal */
    .signature-section {
        margin-top: 25px;
        page-break-inside: avoid;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }

    .sig-box {
        width: 45%;
        text-align: center;
        font-size: 11pt;
    }

    .sig-space {
        height: 65px;
        position: relative;
    }

    .sig-stamp {
        position: absolute;
        top: -10px;
        left: 20%;
        opacity: 0.85;
        width: 90px;
        pointer-events: none;
    }

    .page-break {
        page-break-before: always;
    }
}

/* Screen Preview Mode untuk Dokumen Cetak */
.document-preview-modal {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
}

.a4-paper {
    background: #ffffff;
    width: 210mm;
    min-height: 297mm;
    margin: 20px auto;
    padding: 16mm 20mm;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    font-family: 'Calibri', 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.35;
    color: #111827;
    border-radius: 2px;
    box-sizing: border-box;
}

/* Badge Status Siklus Proyek */
.badge-draft {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}
.badge-sent {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}
.badge-approved {
    background-color: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}
.badge-invoiced {
    background-color: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}
.badge-paid {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.badge-closed {
    background-color: #fef9c3;
    color: #854d0e;
    border: 1px solid #fef08a;
}

/* ============================================================== */
/* PRINT MEDIA RULES: PRATINJAU DOKUMEN CETAK A4 INLINE           */
/* ============================================================== */
@media print {
    /* Sembunyikan elemen dashboard & toolbar */
    aside, header, nav, .no-print, [no-print] {
        display: none !important;
    }
    
    body {
        background: transparent !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    main {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }

    /* Sembunyikan semua konten workspace kecuali canvas dokumen */
    body * {
        visibility: hidden;
    }

    #printable-doc-canvas, #printable-doc-canvas * {
        visibility: visible !important;
    }

    #printable-doc-canvas {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        min-height: 100% !important;
        margin: 0 !important;
        padding: 10mm 15mm !important;
        box-shadow: none !important;
        border: none !important;
        background: #ffffff !important;
    }
}


