/* assets/style.css - Clean White Admin Dashboard Theme */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #f4f6f9;
    --bg-white: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #10b981;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --text-sidebar: #cbd5e1;
    --border-light: #e2e8f0;
    
    /* Colors matching screenshot */
    --color-green: #10b981;
    --color-green-dark: #047857;
    --color-excel: #16a34a;
    --color-blue: #2563eb;
    --color-orange: #f59e0b;
    --color-red: #dc2626;
    --color-purple: #8b5cf6;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.4;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* APP LAYOUT WRAPPER */
.app-wrapper {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 20px 18px 14px 18px;
}

.sidebar-brand {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
    line-height: 1.2;
    word-break: break-word;
}

.sidebar-subbrand {
    font-size: 0.82rem;
    color: var(--color-green);
    margin-top: 4px;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.8px;
    padding: 16px 12px 6px 12px;
    white-space: nowrap;
    width: 100%;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    width: 100%;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 2;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar-link.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sidebar-link.active svg {
    stroke: #ffffff;
}

/* MAIN CONTENT AREA */
.main-content {
    flex: 1;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Header Bar */
.top-bar {
    background-color: var(--bg-white);
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    padding: 4px;
}

.top-bar-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-dark);
}

.page-container {
    padding: 20px;
    flex: 1;
    max-width: 1400px;
}

/* STAT CARDS GRID */
.dashboard-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-md);
    border: 1px solid #ffffff;
    cursor: pointer;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.card-icon-box {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.card-icon-box.green { background-color: var(--color-green); }
.card-icon-box.blue { background-color: var(--color-blue); }
.card-icon-box.orange { background-color: #f97316; }
.card-icon-box.purple { background-color: var(--color-purple); }

.card-icon-box svg {
    width: 22px;
    height: 22px;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
}

.card-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* WHITE CONTAINER */
.content-card {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

/* TOOLBAR ACTIONS */
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.btn-add-green {
    background-color: var(--color-green);
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-excel-green {
    background-color: var(--color-excel);
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 450px;
}

.search-input-simple {
    flex: 1;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-dark);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
}

.btn-search-green {
    background-color: var(--color-green-dark);
    color: #ffffff;
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
}

/* TABLE STYLING - COMPACT SPACING */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table-simple {
    width: 100%;
    border-collapse: collapse;
    margin-top: 4px;
    font-size: 0.88rem;
}

.data-table-simple th {
    background: #ffffff;
    color: #334155;
    font-weight: 800;
    text-transform: none;
    padding: 10px 10px;
    border-bottom: 2px solid var(--border-light);
    text-align: left;
}

.data-table-simple td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table-simple tbody tr:hover {
    background: #f8fafc;
}

/* EXCEL SHEET REPORT TABLE STYLING (PERSIS GAMBAR 2) */
.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    font-family: inherit;
    background: #ffffff;
    border: 2px solid #000000;
    margin-top: 10px;
}

.excel-table th, .excel-table td {
    border: 1px solid #000000;
    padding: 6px 10px;
}

.excel-table th {
    background: #ffffff;
    color: #000000;
    font-weight: 800;
    text-align: center;
    vertical-align: middle;
}

.excel-table td.col-product {
    text-align: left;
    font-weight: 600;
}

.excel-table td.col-unit {
    text-align: center;
}

.excel-table td.col-avail {
    text-align: right;
    font-weight: 700;
}

.excel-table td.col-floor {
    text-align: center;
    font-weight: 600;
}

/* ACTION BUTTON */
.cell-action-combined {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.btn-action-edit {
    background-color: var(--color-orange);
    color: #ffffff;
    border: none;
    padding: 3px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.2;
}

/* COMPACT NUMBER INPUT WITH ▲▼ SPIN ARROWS */
.compact-number-box {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 2px 4px;
    height: 28px;
    width: 52px;
}

.input-number-compact {
    width: 30px;
    border: none;
    background: transparent;
    text-align: center;
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--text-dark);
    font-family: inherit;
    outline: none;
    -moz-appearance: textfield;
}

.input-number-compact::-webkit-outer-spin-button,
.input-number-compact::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-number-compact::placeholder {
    color: #c0c0c0;
    font-weight: 400;
    opacity: 1;
}

.spin-arrows {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    user-select: none;
}

.spin-arrow-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 11px;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0;
}

.spin-arrow-btn:hover, .spin-arrow-btn:active {
    color: var(--color-green);
}

/* AUTO KETERANGAN BADGES */
.col-ket {
    text-align: center !important;
}

.badge-container-double {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 0 auto;
}

.weight-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.weight-badge.pack {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
}

.weight-badge.kg {
    background: #dcfce7;
    color: #15803d;
    border-color: #bbf7d0;
}

/* CENTANG UJI CHECKBOX (LAPORAN INVENTORY) */
.chk-uji-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
}

.chk-uji-box {
    width: 20px;
    height: 20px;
    border: 2px solid #94a3b8;
    background: #e2e8f0;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}

.chk-uji-box:hover {
    border-color: #64748b;
    background: #cbd5e1;
}

.chk-uji-box.checked {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(16, 185, 129, 0.35);
}

.chk-uji-box svg {
    width: 14px;
    height: 14px;
    stroke: #ffffff;
    stroke-width: 3;
}

/* Filter Pills */
.filter-scroll-container {
    overflow-x: auto;
    white-space: nowrap;
    padding: 2px 0 10px 0;
    margin-bottom: 8px;
    scrollbar-width: none;
}
.filter-scroll-container::-webkit-scrollbar { display: none; }

.pill-btn {
    background: #f1f5f9;
    border: 1px solid var(--border-light);
    color: #475569;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.pill-btn.active {
    background: var(--color-green);
    color: #ffffff;
    border-color: transparent;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-backdrop.show { display: flex; }

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}
.form-group input, .form-group select {
    width: 100%;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    color: var(--text-dark);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
}

.view-section { display: none; }
.view-section.active { display: block; }

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: #0f172a;
    color: #ffffff;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    box-shadow: var(--shadow-lg);
}
.toast.success { border-left: 4px solid var(--color-green); }
.toast.error { border-left: 4px solid var(--color-red); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* DESKTOP / MOBILE UTILITIES */
.mobile-only { display: none !important; }
.desktop-only { display: inline !important; }

/* RESPONSIVE FOR ANDROID & IPHONE (ULTRA COMPACT FIT ALL COLUMNS) */
@media (max-width: 768px) {
    .mobile-only { display: inline !important; }
    .desktop-only { display: none !important; }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { backdrop-filter: blur(4px); }
    .sidebar-overlay.open { display: block; }
    .mobile-toggle { 
        display: inline-flex; 
        align-items: center; 
        justify-content: center; 
        width: 36px; 
        height: 36px; 
        border-radius: 8px; 
        background: #f1f5f9; 
    }

    .top-bar {
        padding: 6px 10px;
    }
    .top-bar-title {
        font-size: 0.88rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .realtime-status-badge {
        padding: 2px 6px;
        font-size: 0.65rem;
        gap: 4px;
    }

    .page-container { 
        padding: 6px 4px; 
    }

    .content-card {
        padding: 8px 6px;
        border-radius: var(--radius-md);
        margin-bottom: 12px;
    }

    .dashboard-cards-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 6px; 
        margin-bottom: 10px;
    }
    .stat-card {
        padding: 8px 10px;
        gap: 8px;
        border-radius: var(--radius-md);
    }
    .card-icon-box {
        width: 28px;
        height: 28px;
        border-radius: 6px;
    }
    .card-icon-box svg {
        width: 16px;
        height: 16px;
    }
    .card-title {
        font-size: 0.75rem;
        line-height: 1.1;
    }
    .card-subtext {
        font-size: 0.65rem;
    }

    .toolbar-actions { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 6px; 
        margin-bottom: 8px;
    }
    .btn-add-green {
        justify-content: center;
        padding: 6px 12px;
        font-size: 0.82rem;
    }
    .search-wrapper { 
        max-width: 100%; 
        width: 100%; 
        gap: 4px;
    }
    .search-input-simple {
        padding: 5px 8px;
        font-size: 0.78rem;
    }
    .btn-search-green {
        padding: 5px 12px;
        font-size: 0.78rem;
    }

    .filter-scroll-container {
        padding: 2px 0 6px 0;
        margin-bottom: 4px;
    }
    .pill-btn {
        padding: 3px 8px;
        font-size: 0.72rem;
    }

    /* COMPACT TABLE ON MOBILE: FIT ALL COLUMNS FROM NO TO EDIT */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table-simple {
        width: 100%;
        font-size: 0.68rem;
        table-layout: auto;
    }

    .data-table-simple th, .data-table-simple td {
        padding: 3px 1px;
        font-size: 0.68rem;
        line-height: 1.15;
    }

    .col-no { width: 14px; text-align: center; }
    .col-name { font-size: 0.69rem; word-break: break-word; min-width: 68px; }
    .col-pack, .col-unit { width: 40px; text-align: center; }
    .col-ket { width: 46px; text-align: center; }
    .col-check { width: 32px; text-align: center; }

    /* Compact Number Box & Spin Arrows on Mobile */
    .compact-number-box {
        width: 38px;
        height: 22px;
        padding: 1px;
        border-radius: 4px;
    }
    .input-number-compact {
        width: 22px;
        font-size: 0.72rem;
    }
    .spin-arrow-btn {
        width: 10px;
        height: 8px;
    }
    .spin-arrow-btn svg {
        width: 6px;
        height: 4px;
    }

    /* Double Badges & Checkbox Compact */
    .badge-container-double {
        gap: 2px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .weight-badge {
        min-width: 44px !important;
        padding: 1px 3px;
        font-size: 0.6rem;
        border-radius: 8px;
        line-height: 1.1;
        text-align: center;
    }

    .chk-uji-wrapper {
        padding: 1px !important;
    }
    .chk-uji-input {
        width: 14px !important;
        height: 14px !important;
    }

    .btn-action-edit {
        padding: 2px 5px;
        font-size: 0.62rem;
        border-radius: 3px;
    }

    .modal-content {
        width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
        padding: 16px 12px;
        border-radius: var(--radius-md);
    }
}

@media print {
    .sidebar, .top-bar, .no-print, .toolbar-actions { display: none !important; }
    .main-content { background: #fff !important; }
    .page-container { padding: 0 !important; }
    .view-section { display: block !important; }
    #view-opname, #view-crud, #view-settings { display: none !important; }
}

/* REALTIME SYNC BADGE */
.realtime-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-light);
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green {
    background-color: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}
