/* ==========================================================================
   ERP Mini Pro — Custom Design System
   Diekstrak dari app.html (Phase 1 Refactoring)
   ========================================================================== */

/* --- TEMA MODERN PREMIUM (ZINC DARK MODE) --- */
html {
    background-color: #09090b;
    /* Zinc 950 - Lebih lembut di mata dibanding hitam pekat */
    min-height: 100dvh;
}

body {
    background-color: #09090b;
    background-image: radial-gradient(circle at 50% 0%, rgba(39, 39, 42, 0.4), transparent 75%);
    color: #e4e4e7;
    /* Zinc 200 */
    font-family: 'Inter', sans-serif;
    /* Menggunakan font premium */
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Efek Kaca (Glassmorphism) yang Lebih Elegan & Tipis */
.glass-panel {
    background: rgba(24, 24, 27, 0.6);
    /* Zinc 900 */
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    /* PERF: Turun dari 12px → 8px */
    -webkit-backdrop-filter: blur(8px);
    /* PERF: Ganti 'all' (mahal) ke property spesifik */
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 768px) {
    .glass-panel:hover {
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.6);
    }
}

/* --- UI 3D WIDGETS (DIPERHALUS MENJADI FLAT DESIGN) --- */
.widget-3d {
    background: rgba(24, 24, 27, 0.8);
    border-radius: 20px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    /* PERF: Ganti 'all' ke property spesifik */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        border-color 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

@media (min-width: 768px) {
    .widget-3d:hover {
        transform: translateY(-4px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.5);
    }
}

.widget-icon-bg {
    position: absolute;
    right: -15px;
    bottom: -20px;
    font-size: 7rem;
    opacity: 0.03;
    transform: rotate(-15deg);
    transition: all 0.5s ease;
    z-index: -1;
}

.widget-3d:hover .widget-icon-bg {
    transform: rotate(0deg) scale(1.1) translateY(-5px);
    opacity: 0.06;
}

/* Sidebar Nav Styles (SaaS Premium Upgrade) */
.nav-btn {
    position: relative;
    width: 100%;
    text-align: left;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    /* 12px untuk kesan modern pill */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    color: #a1a1aa;
    /* Zinc 400 */
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 2px;
    border: 1px solid transparent;
    overflow: hidden;
}

/* Indikator Garis Kiri (Animasi Skala) */
.nav-btn::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 4px;
    height: 50%;
    background: #3b82f6;
    border-radius: 0 4px 4px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

.nav-btn i {
    width: 22px;
    text-align: center;
    font-size: 1.15rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Efek memantul */
    opacity: 0.7;
}

/* Efek Melayang saat Hover */
.nav-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #f4f4f5;
    transform: translateX(4px);
}

.nav-btn:hover::before {
    opacity: 0.3;
    transform: translateY(-50%) scaleY(0.4);
    background: #fff;
}

@media (min-width: 768px) {
    .nav-btn:hover i {
        transform: scale(1.2) rotate(5deg);
        opacity: 1;
    }
}

/* State Menu Aktif (Neon Glow) */
.nav-btn.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.12) 0%, transparent 100%);
    color: #fff;
    border-top: 1px solid rgba(59, 130, 246, 0.1);
    border-left: 1px solid rgba(59, 130, 246, 0.25);
}

.nav-btn.active::before {
    transform: translateY(-50%) scaleY(1);
    opacity: 1;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
    /* Pendaran garis kiri */
}

.nav-btn.active i {
    color: #60a5fa !important;
    opacity: 1;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.6));
    /* Pendaran ikon */
}

/* Styling Judul Sub-Menu Modern */
.sidebar-section-title {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 900;
    color: #52525b;
    /* Zinc 500 */
    letter-spacing: 0.25em;
    padding: 0 0.75rem;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0%, transparent 100%);
}

/* Inputs (Clean & Sleek Form Fields) */
.input-3d {
    background: #09090b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 8px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.input-3d:focus {
    outline: none;
    background: #09090b;
    border-color: #3b82f6;
    /* Blue glow focus */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #09090b inset !important;
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Buttons (Premium Flat dengan Efek Kaca di Tepi) */
.btn-3d {
    /* Dihapus: background linear-gradient yang meng-override warna warni dari tailwind */
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    letter-spacing: 0.025em;
}

.btn-3d:hover:not(:disabled) {
    filter: brightness(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-3d:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Freeze Panes & Scrollables */
.table-container {
    max-height: 450px;
    overflow: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    -webkit-overflow-scrolling: touch;
}

.flex.flex-col>.table-container.flex-1 {
    min-height: 0;
}

.table-container th {
    position: sticky;
    top: 0;
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(8px);
    z-index: 10;
    font-weight: 600;
    letter-spacing: 0.05em;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.table-container table {
    min-width: 0;
    width: 100%;
    table-layout: auto;
}

/* Empty detail tables (Picking / BoM): hide gray column headers until data loaded */
.table-container.is-empty thead {
    display: none;
}

.table-container.is-empty table {
    height: 100%;
}

.table-container.is-empty tbody tr td {
    border-bottom: none;
    background: transparent;
    vertical-align: middle !important;
}

.table-container.is-empty .table-empty-hint {
    color: rgba(161, 161, 170, 0.85);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
}

td,
th {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left;
    font-size: 13px;
}

th {
    font-size: 11px;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* --- PERBAIKAN UI RESPONSIVITAS KOLOM NOMINAL (MOBILE) --- */
.table-container td.text-right,
.table-container tfoot th.text-right,
.total-td,
.out-total-td,
.out-price-td,
.rma-val-display,
.table-container td:has(> .font-bold),
[class*="text-right"] {
    white-space: nowrap !important;
}

/* Kolom nominal keuangan selalu nowrap agar tidak terpotong */
.table-container td {
    white-space: nowrap;
}

/* Kolom deskripsi/nama boleh wrap */
.table-container td.wrap-text,
.table-container td:nth-child(3):not(.nowrap) {
    white-space: normal !important;
}

.table-container td input.price-in {
    min-width: 110px !important;
}

/* Scrollbars (Modern Thin) */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Loader */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* L5: Skeleton Loading Animation */
@keyframes skeleton-pulse {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            rgba(39, 39, 42, 0.6) 25%,
            rgba(63, 63, 70, 0.8) 50%,
            rgba(39, 39, 42, 0.6) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.6s ease-in-out infinite;
    border-radius: 6px;
    color: transparent !important;
}

.skeleton * {
    visibility: hidden !important;
}

/* L5: Animate Fade-In Page Transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.25s ease-out both;
}

/* L5: Toast container */
#toast-container {
    pointer-events: none;
}

#toast-container>div {
    pointer-events: auto;
}

.tree-container>.relative>.child-line {
    display: none;
}

.tree-children>.relative>.child-line {
    display: block;
}

/* --- PERBAIKAN UI TABEL FORM TRANSAKSI (AUTO-CENTERING KOTAK ANGKA) --- */
.table-container td {
    vertical-align: middle !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
}

.table-container td input.wo-qty,
.table-container td input.qty-in,
.table-container td input.out-qty,
.table-container td input.inc-qty,
.table-container td input.rma-qty,
.table-container td input.phys-qty {
    max-width: 90px !important;
    margin: 0 auto !important;
    display: block !important;
    text-align: center !important;
}

/* Menghilangkan tombol panah (spinner) bawaan browser pada input angka */
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;
    appearance: textfield;
    /* Standard property untuk kompatibilitas lintas browser */
}

/* ==========================================================================
   RESPONSIVE FIXES — Mobile / Tablet / Desktop
   ========================================================================== */

/* ── Global: prevent any horizontal overflow on the body ── */
html,
body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* ── Main Content Area: ensure full width on mobile ── */
#main-content {
    box-sizing: border-box;
}

@media (max-width: 767px) {

    /* Main content: remove left padding that causes cut-off, add safe padding */
    #main-content {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        padding-top: 0.5rem !important;
    }

    /* Header bar: stack items vertically for narrow screens */
    #main-content>.glass-panel:first-child {
        padding: 0.75rem !important;
        gap: 0.5rem !important;
        border-radius: 12px !important;
    }

    /* Page title: smaller on mobile */
    #page-title {
        font-size: 1.1rem !important;
    }

    /* Global search: full-width on mobile */
    #global-search {
        width: 100% !important;
        font-size: 13px !important;
    }

    /* Sidebar: full screen overlay on mobile with safe area */
    #sidebar {
        width: 85vw !important;
        max-width: 320px !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }

    /* Dashboard greeting: compact on mobile */
    .view-section h3.text-2xl {
        font-size: 1.25rem !important;
    }

    /* Dashboard widget cards: ensure content doesn't overflow */
    .widget-3d {
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    /* Finance cards: stack numbers properly */
    .widget-3d h2[id^="dash-"] {
        font-size: 1.75rem !important;
    }

    /* Table containers: mobile max-height */
    .table-container {
        max-height: 60vh !important;
        position: relative;
        -webkit-overflow-scrolling: touch;
    }

    /* Modals: full-width on mobile with safe padding */
    #custom-modal>div,
    #delete-action-modal>div,
    #edit-sku-modal>div,
    #user-modal>div {
        max-width: calc(100vw - 2rem) !important;
        max-height: 85vh !important;
        margin: auto !important;
    }

    /* Approval modal: scrollable on mobile */
    #approval-modal>div {
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    /* Trace modal: full width */
    #trace-modal>div {
        width: calc(100vw - 1rem) !important;
        max-width: 100% !important;
    }

    /* Form grid: single column on mobile */
    .grid.grid-cols-2.md\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* AR/AP Overdue widgets: stack on very small screens */
    .grid.grid-cols-2>.widget-3d {
        min-width: 0 !important;
    }

    /* Pagination controls: compact on mobile */
    .pagination-controls {
        padding: 0.5rem !important;
        gap: 0.5rem !important;
    }

    .pagination-controls button {
        padding: 0.4rem 0.75rem !important;
        font-size: 10px !important;
    }

    /* Toast: fit within mobile width */
    #toast-container {
        left: 0.5rem !important;
        right: 0.5rem !important;
        bottom: 1rem !important;
    }

    #toast-container>div {
        max-width: 100% !important;
        font-size: 12px !important;
    }

    /* Login screen: ensure form fits */
    #login-screen>div {
        max-width: calc(100vw - 2rem) !important;
        padding: 1.5rem !important;
    }

    #login-screen img {
        width: 180px !important;
    }

    /* Stock card modal: full width */
    #stock-card-modal>div {
        width: calc(100vw - 1rem) !important;
        max-width: 100% !important;
    }
}

/* ── Tablet (768px - 1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {

    /* Main content: moderate padding */
    #main-content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Dashboard cards: 2 columns on tablet */
    .grid.grid-cols-1.sm\\:grid-cols-2.lg\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Table container: more height on tablet */
    .table-container {
        max-height: 55vh !important;
    }

    /* Chart container: appropriate height */
    .widget-3d canvas {
        max-height: 220px !important;
    }
}

/* ── Desktop (1024px+) ── */
@media (min-width: 1024px) {

    /* Sidebar: proper sticky positioning */
    #sidebar {
        position: sticky !important;
        top: 1rem !important;
        flex-shrink: 0 !important;
    }

    /* Main content: proper overflow handling */
    #main-content {
        min-width: 0;
        /* Prevent flex children from overflowing */
    }
}

/* ── Large Desktop (1440px+) ── */
@media (min-width: 1440px) {
    .table-container {
        max-height: 550px !important;
    }
}

/* ── Universal: prevent table layout from breaking on any screen ── */
table {
    table-layout: auto;
}

.table-container {
    overflow-x: auto;
    overflow-y: auto;
}

/* ── Scrollbar visibility fix for mobile browsers ── */
@media (max-width: 767px) {
    .table-container::-webkit-scrollbar {
        height: 4px;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: rgba(59, 130, 246, 0.4);
        border-radius: 4px;
    }
}

/* ==========================================================================
   PERF: Mobile GPU Optimization — Nonaktifkan backdrop-filter di layar kecil
   backdrop-filter: blur() memaksa GPU untuk off-screen compositing setiap frame.
   Di mobile low-end, ini adalah penyebab utama lag scroll & animasi patah-patah.
   Kompensasi: background dibuat lebih opaque agar tetap terlihat premium.
   ========================================================================== */
@media (max-width: 767px) {
    .glass-panel {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(18, 18, 21, 0.97);
        /* Lebih opaque sebagai kompensasi */
    }

    .table-container th {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(18, 18, 21, 1);
    }

    #loader {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    /* Disable hover transform pada mobile (tidak ada hover di touchscreen) */
    .widget-3d:hover {
        transform: none !important;
    }

    .nav-btn:hover {
        transform: none !important;
    }

    .btn-3d:hover:not(:disabled) {
        transform: none !important;
    }
}

/* ── Form sections: prevent input overflow ── */
.input-3d,
select.input-3d {
    max-width: 100%;
    box-sizing: border-box;
}

/* ── View sections: prevent content overflow ── */
.view-section {
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ── Finance view cards: responsive text ── */
@media (max-width: 767px) {
    [id^="fin-"] {
        font-size: 1.1rem !important;
    }
}

/* Print Formatting */
@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    body {
        display: block !important;
        background: white !important;
        color: black !important;
        font-family: Arial, sans-serif !important;
        font-size: 9pt;
        margin: 0 !important;
        padding: 0 !important;
    }

    body>*:not(#print-area) {
        display: none !important;
    }

    #print-area {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        visibility: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    #print-area * {
        visibility: visible !important;
        color: black !important;
        box-sizing: border-box !important;
    }

    .glass-panel {
        background: none !important;
        box-shadow: none !important;
        border: none !important;
    }

    table {
        border-collapse: collapse !important;
        width: 100% !important;
        max-width: 100% !important;
        table-layout: auto !important;
        min-width: unset !important;
    }

    table td,
    table th {
        border: 1px solid #000 !important;
        padding: 5px 6px !important;
        color: black !important;
        font-size: 8.5pt !important;
        word-wrap: break-word !important;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .bg-gray-200 {
        background-color: #e5e7eb !important;
    }

    .bg-gray-100 {
        background-color: #f3f4f6 !important;
    }

    .mb-16 {
        margin-bottom: 2.5rem !important;
    }

    .mt-16 {
        margin-top: 1rem !important;
    }

    .print-terms {
        font-size: 7.5pt;
        line-height: 1.3;
        color: #000 !important;
        margin-top: 8px;
        border-top: 1px dashed #000;
        padding-top: 8px;
    }
}

/* ==========================================================================
   PERF: Layout Containment & GPU Hints
   Mencegah layout recalc global saat refreshActiveUI() re-render tabel.
   CSS Contain API membatasi scope layout ke dalam element itu saja.
   ========================================================================== */

/* ── View sections: layout isolation ─────────────────────────────────────── */
/* contain: layout style → perubahan di dalam section tidak memicu
   reflow global ke seluruh halaman. Ini mengurangi biaya re-render
   secara drastis saat realtime update terjadi. */
.view-section {
    contain: style;
}

/* ── Table containers: scroll chaining ───────────────────────────────────── */
/* X contained (horizontal tidak bocor); Y auto agar scroll vertikal lanjut ke #main-content */
.table-container {
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
}

/* ── Modals: complete layout isolation ───────────────────────────────────── */
/* Modal adalah overlay independen — isolasi total dari layout utama. */
#custom-modal,
#delete-action-modal,
#edit-sku-modal,
#user-modal,
#journal-modal,
#archive-modal,
#aggregation-modal,
#approval-modal,
#payroll-detail-modal,
#trace-modal,
#stock-card-modal,
#stock-history-modal {
    contain: layout style;
    isolation: isolate;
}

/* ── Sidebar: independent scroll context ─────────────────────────────────── */
#sidebar {
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    isolation: isolate;
}

/* ── Table text rendering: prioritas kecepatan untuk data padat ──────────── */
/* optimizeSpeed → skip hint-based anti-aliasing per-karakter di tabel data.
   Tidak terlihat di mata, tapi mengurangi render cost untuk banyak baris. */
td,
th {
    text-rendering: optimizeSpeed;
}

/* ── Loader: isolated fixed layer ────────────────────────────────────────── */
#loader {
    isolation: isolate;
}

/* ── Autocomplete dropdown: isolated floating layer ──────────────────────── */
#inline-autocomplete {
    isolation: isolate;
    contain: layout style;
}

/* ==========================================================================
   PERF: Interaction Responsiveness
   Mengurangi delay antara user input dan visual feedback.
   ========================================================================== */

/* Semua button & link: hapus 300ms tap delay bawaan browser mobile */
button,
a,
[role="button"] {
    touch-action: manipulation;
}

/* Input: prevent iOS zoom (font-size < 16px memicu auto-zoom di Safari) */
@media (max-width: 767px) {

    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ── Active state feedback instan untuk button ───────────────────────────── */
/* :active state muncul langsung saat disentuh (sebelum debounce 300ms hilang) */
.btn-3d:active:not(:disabled),
.nav-btn:active {
    opacity: 0.75;
    transition: opacity 0ms !important;
    /* instant feedback */
}

/* ==========================================================================
   PERF: Scroll Performance
   GPU-accelerated scroll untuk container dengan banyak konten.
   ========================================================================== */

/* Sidebar menu scroll area */
#sidebar>div.overflow-y-auto {
    scroll-behavior: auto;
}

/* Table: hardware-accelerated horizontal scroll */
.table-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
    /* auto lebih cepat dari smooth untuk tabel data */
}

/* Interactive menu walkthrough (spotlight) */
#menu-walkthrough-root {
    position: fixed;
    inset: 0;
    z-index: 10001;
    pointer-events: none;
}

/* 
#menu-walkthrough-root:not(.hidden) {
    pointer-events: auto; removed to allow click-through
} 
*/

.walkthrough-active {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.wt-block {
    position: fixed;
    background: rgba(0, 0, 0, 0.65);
    pointer-events: auto;
}

.wt-spotlight {
    position: fixed;
    border: 2px solid #3b82f6;
    border-radius: 10px;
    box-shadow:
        0 0 0 2px rgba(59, 130, 246, 0.35),
        0 0 24px rgba(59, 130, 246, 0.45);
    pointer-events: none;
    animation: wt-pulse 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes wt-pulse {

    0%,
    100% {
        box-shadow:
            0 0 0 2px rgba(59, 130, 246, 0.35),
            0 0 18px rgba(59, 130, 246, 0.35);
    }

    50% {
        box-shadow:
            0 0 0 3px rgba(249, 115, 22, 0.45),
            0 0 28px rgba(249, 115, 22, 0.4);
    }
}

.walkthrough-target-boost {
    position: relative;
    z-index: 10002 !important;
}

.wt-tooltip {
    position: fixed;
    z-index: 2;
    width: min(22rem, calc(100vw - 1.5rem));
    padding: 1rem 1.1rem;
    border-radius: 0.875rem;
    background: #18181b;
    border: 1px solid rgba(59, 130, 246, 0.35);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    pointer-events: auto;
}

.wt-progress {
    margin: 0 0 0.35rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #71717a;
}

.wt-title {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fafafa;
    line-height: 1.3;
}

.wt-text {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: #a1a1aa;
}

.wt-dismiss-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.85rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.75rem;
    color: #71717a;
}

.wt-dismiss-cb {
    border-radius: 0.25rem;
    border-color: #52525b;
    background: #27272a;
    color: #3b82f6;
}

.wt-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.wt-actions-main {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.wt-btn {
    border: 1px solid #3f3f46;
    background: #27272a;
    color: #e4e4e7;
    border-radius: 0.65rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.wt-btn:hover:not(:disabled) {
    background: #3f3f46;
}

.wt-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wt-btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.wt-btn-primary:hover:not(:disabled) {
    background: #3b82f6;
}

.wt-btn-skip {
    background: transparent;
    border-color: transparent;
    color: #71717a;
    padding-left: 0;
}

.wt-btn-skip:hover:not(:disabled) {
    color: #a1a1aa;
    background: transparent;
}