/* ============================================================
   PMS SYSTEM — MODERN THEME (FINAL MOBILE-FIRST)
   - Mobile dulu, baru desktop via @media (min-width)
   - Tanpa duplikasi margin-left
   - Sidebar aman tidak menutupi konten
   ============================================================ */

/* -------------------------
   ROOT VARIABLE
-------------------------- */
:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --gray: #64748b;
    --border: #e2e8f0;
    --bg: #f3f6f9;
    --radius: 12px;
    --shadow: 0 6px 20px rgba(15,23,42,0.1);
    --font: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* -------------------------
   GLOBAL RESET
-------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: #1f2937;
    line-height: 1.4;
}

/* Utility umum */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

/* ============================================================
   SIDEBAR MODERN — MOBILE FIRST
   Default: SIDEBAR TERSEMBUNYI (off-canvas)
   Desktop: SIDEBAR TAMPIL (fixed di kiri)
============================================================ */
.sidebar-modern {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--dark);
    padding: 18px 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 12px rgba(0,0,0,0.1);
    z-index: 999;

    /* MOBILE: hidden (off canvas) */
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

/* Saat tombol toggle diklik, tambahkan class .open via JS */
.sidebar-modern.open {
    transform: translateX(0);
}

.sidebar-title {
    font-size: 20px;
    font-weight: 700;
    padding: 12px 20px;
    color: #fff;
    margin-bottom: 8px;
}

.sidebar-menu {
    margin-top: 10px;
}

.sidebar-modern a {
    display: block;
    padding: 12px 20px;
    color: #e5e7eb;
    font-size: 15px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.sidebar-modern a:hover {
    background: rgba(255,255,255,0.08);
}

.sidebar-modern a.active {
    background: var(--primary);
    color: #fff;
}

/* Jika pakai <details> di sidebar */
.sidebar-modern details summary {
    list-style: none;
    cursor: pointer;
    padding: 10px 20px;
    color: #e5e7eb;
}
.sidebar-modern details[open] summary {
    background: rgba(255,255,255,0.06);
}
.sidebar-modern details a {
    padding-left: 40px;
}

/* ============================================================
   TOGGLE SIDEBAR (ICON ☰) — MOBILE
============================================================ */
.sidebar-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    font-size: 20px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   PAGE WRAPPER / MAIN CONTENT — MOBILE FIRST
   Default: full width (tanpa margin-left)
============================================================ */
.page-wrapper,
.content,
.content-with-sidebar,
.main-content,
.dashboard-container {
    min-height: 100vh;
    padding: 16px;
    margin-left: 0;       /* MOBILE: tidak geser */
    transition: margin-left 0.3s ease, padding 0.3s ease;
}

/* Untuk merapikan layout di layar besar */
.layout-wide {
    max-width: 1280px;
    margin: 0 auto;
}

/* ============================================================
   DESKTOP / TABLET: >= 821px
   - Sidebar selalu terlihat
   - Konten bergeser 260px
============================================================ */
@media (min-width: 821px) {
    .sidebar-modern {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: none;
    }

    .page-wrapper,
    .content,
    .content-with-sidebar,
    .main-content,
    .dashboard-container {
        margin-left: 260px;    /* geser mengikuti lebar sidebar */
        padding: 24px;
    }
}

/* ============================================================
   CARD
============================================================ */
.card {
    background: #fff;
    padding: 20px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* Header card kecil */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
}
.card-subtitle {
    font-size: 13px;
    color: var(--gray);
}

/* ============================================================
   FORM ELEMENTS
============================================================ */
input,
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    transition: 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.25);
    outline: none;
}

label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    font-size: 14px;
}

.form-group {
    margin-bottom: 14px;
}

/* GRID FORM (2 kolom di desktop, 1 kolom di mobile) */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;  /* MOBILE: 1 kolom */
    gap: 16px;
}

@media (min-width: 821px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;  /* DESKTOP: 2 kolom */
    }
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-block;
    border: none;
    text-align: center;
    text-decoration: none;
}

/* Di mobile, tombol cenderung full width kalau perlu */
.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--dark);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: #f1f5f9;
}

/* ============================================================
   TABLES — MOBILE FIRST
   - Gunakan .table-responsive untuk scroll horizontal di HP
============================================================ */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px; /* biar rapi, sisanya bisa di-scroll di HP */
}

thead th {
    background: #f1f5f9;
    padding: 10px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: #f9fafb;
}

/* ============================================================
   PROGRESS BAR
============================================================ */
.progbar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.progfill {
    height: 100%;
    background: var(--primary);
}

/* ============================================================
   BADGES (STATUS)
============================================================ */
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    display: inline-block;
}

.badge-waiting { background: #6b7280; }
.badge-ongoing { background: #0ea5e9; }
.badge-hold    { background: #f59e0b; }
.badge-close   { background: #10b981; }
.badge-qc-ok   { background: #16a34a; }
.badge-qc-ng   { background: #ef4444; }

/* ============================================================
   TOAST NOTIFICATION
============================================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--dark);
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    opacity: 1;
    transition: opacity 0.4s, transform 0.4s;
    transform: translateY(0);
    z-index: 2000;
}

.toast.hide {
    opacity: 0;
    transform: translateY(-10px);
}

/* ============================================================
   RESPONSIVE SMALL TWEAKS
============================================================ */
@media (max-width: 480px) {
    .card {
        padding: 16px 14px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .btn {
        font-size: 13px;
        padding: 9px 12px;
    }
}

/* === FIX SIDEBAR WARNA AGAR SAMA DI DESKTOP & MOBILE === */
.sidebar,
.sidebar-modern {
    background:#ffffff !important;
    border-right:1px solid #e5e7eb !important;
}

/* Warna text sidebar */
.sidebar a,
.sidebar-modern a {
    color:#0f172a !important;
}

/* Hover & active */
.sidebar a:hover,
.sidebar-modern a:hover {
    background:#f1f5f9 !important;
}
/* === FORCE SIDEBAR WARNA PUTIH DI SEMUA MODE === */
.sidebar-modern {
    background: #ffffff !important;
    border-right: 1px solid #e5e7eb !important;
}

/* Icon dan teks sidebar agar tetap terlihat */
.sidebar-modern a,
/* --- PERBAIKAN MENU INDUK --- */
.sidebar-modern .menu-item.parent > a {
    color: #000 !important;       /* teks hitam */
    font-weight: 600 !important;  /* bold */
    opacity: 1 !important;        /* hilangkan kesan samar */
}


.sidebar-modern .menu-item:hover {
    background: #eaf3ff !important;
}

