/* ==========================================================================
   STYLE CUSTOM - RAB OTOMATIS AI
   Desain Clean, Profesional & Performa Tinggi (Tanpa Efek AI/Glowing)
   ========================================================================== */

/* Menghapus panah (spinner) pada input type number agar tampilan bersih */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
}

/* Memastikan sel tabel tidak terlalu lebar dan teks rapi */
table {
    table-layout: auto;
    width: 100%;
}
td, th {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 300px; /* Batasi lebar kolom panjang seperti uraian pekerjaan */
}
/* Khusus untuk kolom uraian pekerjaan agar teks bisa membungkus ke bawah jika perlu */
.td-wrap {
    white-space: normal;
    min-width: 200px;
}

/* ==========================================================================
   CUSTOM SCROLLBAR (Minimalis & Elegan)
   ========================================================================== */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1; /* slate-300 */
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8; /* slate-400 */
}

/* Scrollbar khusus untuk tabel data besar */
.overflow-x-auto::-webkit-scrollbar {
    height: 6px;
}
.overflow-x-auto::-webkit-scrollbar-track {
    background: #f8fafc;
}
.overflow-x-auto::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* ==========================================================================
   TABLE STICKY HEADERS
   ========================================================================== */
th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #ffffff !important;
    /* Memberikan bayangan halus di bawah header saat di-scroll */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); 
}

/* Memastikan latar belakang tab aktif memiliki kontras bersih */
.active-subtab {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   ANIMASI & TRANSISI (Halus, Tanpa Delay Berat)
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        transform: translateX(15px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(20px);
        opacity: 0;
    }
}

/* Kelas utilitas untuk dipanggil via JavaScript (app-core.js) */
.fade-in {
    animation: fadeIn 0.25s ease-out forwards;
}

.slide-in-right {
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-down {
    animation: slideDown 0.2s ease-out forwards;
}

/* Animasi khusus sistem Notifikasi (Toast) */
.toast-enter {
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.toast-leave {
    animation: fadeOutRight 0.3s ease-in forwards;
}

/* Efek sentuhan halus untuk tombol (Klik) */
button:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

/* Mengamankan elemen chart agar tidak overflow */
canvas {
    max-width: 100%;
}

/* Tinggi layar yang benar di HP (memperhitungkan bilah alamat browser) */
@supports (height: 100dvh) {
    .h-screen { height: 100dvh; }
}

/* ==========================================================================
   LEMBAR KERJA HITUNG RAB (tabel berjenjang): teks uraian membungkus, kepala biru
   ========================================================================== */
.lk-tabel { table-layout: fixed; }
.lk-tabel td, .lk-tabel th {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    max-width: none;
}
.lk-tabel td.whitespace-nowrap, .lk-tabel th.whitespace-nowrap { white-space: nowrap; }
/* Tabel Admin WBS: teks membungkus (aturan ukur panjang) */
.wbs-tabel td, .wbs-tabel th { white-space: normal; overflow: visible; text-overflow: clip; max-width: none; }
.lk-tabel thead th {
    background-color: #1B4F72 !important;
    color: #ffffff;
    box-shadow: none;
}
/* Tabel Analisa (Produktivitas, Borongan, Waste): kepala biru (aturan th umum memaksa putih) */
.an-tabel thead th { background-color: #1B4F72 !important; color: #ffffff; }
/* Rekap RAP dan tabel surat penawaran (pratinjau): kepala biru */
#rap-tabel thead th, .dok-tabel thead th { background-color: #1B4F72 !important; color: #ffffff; }

/* HP: menu Hitung RAB tanpa header (ui/header-mobile.js menambah kelas hide-header-m pada body saat layar pilih metode tampil). */
#btn-menu-bulat { display: none; }
@media (max-width: 1023px) {
    body.hide-header-m #app-header { display: none; }
    body.hide-header-m #btn-menu-bulat { display: flex; }
    body.hide-header-m #spa-view-container { padding-top: 72px; }
}
