:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg: #F3F4F6;
    --card: #FFFFFF;
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --radius: 12px;
    --input-bg: #F9FAFB;
    --header-bg: linear-gradient(135deg, var(--primary), #818CF8);
    --bottom-nav-bg: #FFFFFF;
}

/* DARK MODE VARIABLES */
[data-theme="dark"] {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg: #111827;
    --card: #1F2937;
    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;
    --border: #374151;
    --input-bg: #111827;
    --header-bg: #1F2937;
    --bottom-nav-bg: #1F2937;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 125vh;
    background-color: var(--bg);
    position: relative;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--header-bg);
    color: white;
    padding: 20px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.header-title { font-size: 1.25rem; font-weight: 700; }
.header-subtitle { font-size: 0.875rem; opacity: 0.9; }

main {
    padding: 20px;
    flex: 1;
    padding-bottom: 80px; /* space for bottom nav */
}

/* Formulir */
.form-group { margin-bottom: 16px; }
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-main);
}
input, select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
    background: var(--input-bg);
    color: var(--text-main);
}
input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}
.btn:active { transform: scale(0.98); }
.btn:hover { background-color: var(--primary-hover); }
.btn-danger { background-color: var(--danger); }

/* Kartu / Box */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
}

/* Statistik */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.stat-box {
    background: var(--card);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* List Item */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.item-info h4 { font-size: 0.875rem; color: var(--text-main); }
.item-info p { font-size: 0.75rem; color: var(--text-muted); }
.item-right { text-align: right; }

/* Alert Native */
.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #F87171; }
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #34D399; }

/* Navigasi Bawah */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--bottom-nav-bg);
    display: flex;
    justify-content: space-around;
    padding: 12px;
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
    z-index: 100;
}
.nav-item {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.nav-item.active { color: var(--primary); }

/* Tabel */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { background-color: var(--input-bg); font-weight: 600; color: var(--text-main); }

/* ANIMASI PULSE MERAH UNTUK STOK MENIPIS */
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.stock-low {
    color: var(--danger) !important;
    font-weight: bold;
    animation: pulse-red 2s infinite;
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-block;
}

/* NATIVE MODAL / NOTIFICATION (OFFLINE 100%) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
}
.modal-overlay.show { display: flex; }
.modal-content {
    background: var(--card);
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    transform: scale(0.9);
    transition: transform 0.2s;
}
.modal-overlay.show .modal-content { transform: scale(1); }
.modal-icon { font-size: 40px; margin-bottom: 16px; }
.modal-icon.success { color: var(--success); }
.modal-icon.warning { color: #F59E0B; }

/* KERANJANG */
.cart-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px dashed var(--border);
}
.qty-controls {
    display: flex; align-items: center; gap: 8px;
}
.qty-btn {
    background: var(--input-bg); border: 1px solid var(--border);
    width: 28px; height: 28px; border-radius: 50%; font-weight: bold; color: var(--text-main); cursor: pointer;
}

/* Search Bar Container */
.search-container {
    position: relative;
    margin-bottom: 16px;
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}
.search-input {
    padding-left: 40px;
}
