/* ============================================
   APLIKASI TABINA SWALAYAN
   Custom CSS - style.css
   ============================================ */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 0px;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-navbar: #ffffff;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --table-header-bg: #f8fafc;
    --card-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --card-shadow-hover: 0 10px 25px rgba(0,0,0,.1);
    --border-radius: 12px;
    --transition: all 0.2s ease;
}

/* ============================================
   DARK MODE VARIABLES
   ============================================ */
body.dark-mode {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-navbar: #1e293b;
    --text-primary: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --table-header-bg: #1e293b;
    --card-shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
    --card-shadow-hover: 0 10px 25px rgba(0,0,0,.4);
}

/* Dark mode element overrides */
body.dark-mode { background-color: var(--bg-body); color: var(--text-primary); }

body.dark-mode .card,
body.dark-mode .action-card { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-color); }

body.dark-mode .navbar { background: var(--bg-navbar) !important; border-color: var(--border-color) !important; }

body.dark-mode .table { color: var(--text-primary); }
body.dark-mode .table th { background: var(--table-header-bg); color: var(--text-muted); border-color: var(--border-color); }
body.dark-mode .table td { border-color: var(--border-color); }
body.dark-mode .table > tbody > tr:hover td { background: rgba(255,255,255,0.04); }

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: #0f172a;
    border-color: var(--border-color);
    color: var(--text-primary);
}
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus { border-color: var(--primary); background-color: #0f172a; color: var(--text-primary); }

body.dark-mode .form-label { color: var(--text-primary); }

body.dark-mode .input-group-text { background: #0f172a; border-color: var(--border-color); color: var(--text-muted); }

body.dark-mode .btn-outline-secondary { color: #94a3b8; border-color: #475569; }
body.dark-mode .btn-outline-secondary:hover { background: #334155; color: #e2e8f0; }

body.dark-mode .dropdown-menu { background: var(--bg-card); border-color: var(--border-color); }
body.dark-mode .dropdown-item { color: var(--text-primary); }
body.dark-mode .dropdown-item:hover { background: rgba(255,255,255,0.07); }

body.dark-mode .nav-tabs { border-color: var(--border-color); }
body.dark-mode .nav-tabs .nav-link { color: var(--text-muted); }
body.dark-mode .nav-tabs .nav-link.active { background: var(--bg-card); border-color: var(--border-color); border-bottom-color: var(--bg-card); color: var(--text-primary); }

body.dark-mode .alert-success { background: rgba(22,163,74,0.15); border-color: rgba(22,163,74,0.3); color: #86efac; }
body.dark-mode .alert-danger  { background: rgba(220,38,38,0.15); border-color: rgba(220,38,38,0.3); color: #fca5a5; }
body.dark-mode .alert-warning { background: rgba(217,119,6,0.15); border-color: rgba(217,119,6,0.3); color: #fcd34d; }
body.dark-mode .alert-info    { background: rgba(8,145,178,0.15); border-color: rgba(8,145,178,0.3); color: #67e8f9; }

body.dark-mode .page-header { border-color: var(--border-color); }
body.dark-mode .page-header h4 { color: var(--text-primary); }

body.dark-mode .text-muted { color: var(--text-muted) !important; }
body.dark-mode .border, body.dark-mode .border-bottom { border-color: var(--border-color) !important; }
body.dark-mode .bg-light { background-color: #1e293b !important; }
body.dark-mode .bg-white { background-color: var(--bg-card) !important; }
body.dark-mode code { background: #0f172a; color: #93c5fd; padding: 2px 6px; border-radius: 4px; }

/* Dark mode toggle button */
#darkModeToggle { cursor: pointer; }


/* Reset & Base */
* { box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: #1e293b;
    font-size: 14px;
}

/* ============================================
   SIDEBAR
   ============================================ */
#sidebar-wrapper {
    width: var(--sidebar-width);
    min-height: 100vh;
    min-width: var(--sidebar-width);
    transition: var(--transition);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: #0f172a !important;
    z-index: 1000;
}

#sidebar-wrapper::-webkit-scrollbar { width: 4px; }
#sidebar-wrapper::-webkit-scrollbar-track { background: transparent; }
#sidebar-wrapper::-webkit-scrollbar-thumb { background: #334155; border-radius: 2px; }

.sidebar-brand {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.sidebar-nav .nav-link.sidebar-link {
    color: #94a3b8;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    font-size: 13.5px;
    font-weight: 450;
}

.sidebar-nav .nav-link.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.sidebar-nav .nav-link.sidebar-link.active {
    color: #fff;
    background: var(--primary);
    font-weight: 600;
}

/* Sidebar collapsed */
#wrapper.sidebar-collapsed #sidebar-wrapper {
    min-width: 0;
    width: 0;
    overflow: hidden;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
#page-content-wrapper {
    min-width: 0;
    transition: var(--transition);
    overflow-x: hidden;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--card-shadow-hover); }

/* Summary Cards */
.summary-card {
    border-radius: var(--border-radius);
    padding: 20px;
    color: white;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.summary-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.summary-card .card-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.summary-card .card-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card .card-value {
    font-size: 22px;
    font-weight: 700;
    margin-top: 4px;
    line-height: 1.2;
}

.bg-gradient-primary { background: linear-gradient(135deg, #2563eb, #4f46e5); }
.bg-gradient-success { background: linear-gradient(135deg, #16a34a, #059669); }
.bg-gradient-danger  { background: linear-gradient(135deg, #dc2626, #e11d48); }
.bg-gradient-warning { background: linear-gradient(135deg, #d97706, #b45309); }
.bg-gradient-info    { background: linear-gradient(135deg, #0891b2, #0284c7); }

/* Quick Action Cards */
.action-card {
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
    display: block;
    background: white;
    box-shadow: var(--card-shadow);
}

.action-card:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.action-card .action-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 12px;
    transition: var(--transition);
}

/* ============================================
   TABLES
   ============================================ */
.table {
    font-size: 13.5px;
}

.table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 12px 16px;
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table > tbody > tr:hover td {
    background: #f8fafc;
}

/* ============================================
   BADGES & STATUS
   ============================================ */
.badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 500;
}

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    padding: 9px 12px;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.form-label {
    font-weight: 500;
    font-size: 13px;
    color: #374151;
    margin-bottom: 5px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 13.5px;
    padding: 8px 16px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.page-header h4 {
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.2);
}

/* ============================================
   CHART CONTAINER
   ============================================ */
.chart-wrapper {
    position: relative;
    height: 300px;
}

/* ============================================
   RUPIAH INPUT
   ============================================ */
.input-group-text {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* ============================================
   RESPONSIVE - MOBILE IMPROVEMENTS
   ============================================ */

/* Overlay backdrop saat sidebar buka di mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    cursor: pointer;
}

#wrapper.mobile-open .sidebar-overlay {
    display: block;
}

/* ---- TABLET (≤ 992px) ---- */
@media (max-width: 992px) {
    .summary-card .card-value { font-size: 18px; }
}

/* ---- MOBILE (≤ 768px) ---- */
@media (max-width: 768px) {
    /* Sidebar: full overlay dari kiri */
    #sidebar-wrapper {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 1045;
        min-width: 260px;
        width: 260px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    #wrapper.mobile-open #sidebar-wrapper {
        transform: translateX(0);
        box-shadow: 6px 0 20px rgba(0,0,0,0.3);
    }

    /* Content jangan geser saat sidebar buka */
    #page-content-wrapper {
        width: 100%;
        padding-bottom: 70px; /* ruang bottom nav */
    }

    /* Padding konten lebih kecil */
    .container-fluid.py-4 { padding: 16px 12px !important; }

    /* Summary card lebih kecil */
    .summary-card {
        padding: 14px;
    }
    .summary-card .card-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        margin-bottom: 8px;
    }
    .summary-card .card-value { font-size: 16px; }
    .summary-card .card-label { font-size: 10px; }

    /* Table: horizontal scroll di mobile */
    .table-responsive { -webkit-overflow-scrolling: touch; }
    .table th, .table td { padding: 10px 12px; font-size: 12.5px; }

    /* Page header lebih ringkas */
    .page-header { margin-bottom: 16px; }
    .page-header h4 { font-size: 18px; }

    /* Action cards: 2 kolom di mobile */
    .action-card { padding: 14px 10px; }
    .action-card .action-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
        margin-bottom: 8px;
    }

    /* Form filter: scroll horizontal */
    .card .d-flex.flex-wrap.gap-2 { overflow-x: auto; flex-wrap: nowrap !important; padding-bottom: 4px; }

    /* Login card padding lebih kecil */
    .login-card { padding: 28px 20px; margin: 16px; }

    /* Chart lebih kecil */
    .chart-wrapper { height: 220px; }

    /* Tombol aksi tabel: lebih besar untuk jari */
    .btn-sm { padding: 7px 10px; font-size: 12px; }

    /* Badge font */
    .badge { font-size: 10px; }

    /* Tabel hapus beberapa kolom kurang penting via d-none */
    .table .hide-mobile { display: none !important; }
}

/* ---- SMALL MOBILE (≤ 480px) ---- */
@media (max-width: 480px) {
    .summary-card .card-value { font-size: 14px; }
    .summary-card .card-icon { width: 30px; height: 30px; font-size: 14px; }
    .page-header h4 { font-size: 16px; }
}

/* ============================================
   BOTTOM NAVIGATION BAR (Mobile only)
   ============================================ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 6px 0 env(safe-area-inset-bottom, 6px);
}

.bottom-nav .bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    color: #64748b;
    text-decoration: none;
    font-size: 10px;
    gap: 2px;
    transition: color 0.15s;
    min-height: 48px;
}

.bottom-nav .bnav-item i { font-size: 20px; }
.bottom-nav .bnav-item.active { color: #60a5fa; }
.bottom-nav .bnav-item:hover { color: #93c5fd; }

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    #sidebar-wrapper,
    nav.navbar,
    .bottom-nav,
    .btn,
    .no-print { display: none !important; }

    #page-content-wrapper {
        margin: 0 !important;
        padding: 0 !important;
        padding-bottom: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* Misc Utilities */
.text-rupiah { font-family: 'Inter', monospace; }
.fw-semibold { font-weight: 600; }
.rounded-lg { border-radius: var(--border-radius) !important; }

