/* ===== KOSKU PREMIUM - THEME CSS ===== */
:root {
    /* Light Mode - Blue White */
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --sidebar-bg: linear-gradient(160deg, #0066a6 0%, #004c80 50%, #003060 100%);
    --sidebar-text: rgba(255,255,255,0.9);
    --sidebar-hover: rgba(255,255,255,0.15);
    --sidebar-active: rgba(255,255,255,0.2);
    --text-primary: #1a2e3b;
    --text-secondary: #5a7380;
    --text-muted: #8699a3;
    --border-color: #e0e8ef;
    --input-bg: #ffffff;
    --input-border: #d0dde6;
    --input-focus: #0066a6;
    --accent-blue: #0066a6;
    --accent-blue-light: #e3f2fd;
    --accent-blue-dark: #004c80;
    --accent-green: #2e7d32;
    --accent-green-light: #e8f5e9;
    --accent-orange: #e65100;
    --accent-orange-light: #fff3e0;
    --accent-red: #c62828;
    --accent-red-light: #fce4ec;
    --accent-purple: #6a1b9a;
    --shadow-sm: 0 2px 8px rgba(0,102,166,0.08);
    --shadow-md: 0 4px 16px rgba(0,102,166,0.12);
    --shadow-lg: 0 8px 32px rgba(0,102,166,0.16);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --topbar-bg: #ffffff;
    --notification-bg: #fff8e1;
    --quota-grad: linear-gradient(135deg, #0066a6, #004c80);
    --stat-1: linear-gradient(135deg, #0066a6, #1976d2);
    --stat-2: linear-gradient(135deg, #2e7d32, #43a047);
    --stat-3: linear-gradient(135deg, #e65100, #ef6c00);
    --stat-4: linear-gradient(135deg, #6a1b9a, #9c27b0);
    --toggle-bg: #ccc;
    --toggle-active: #0066a6;
}

[data-theme="dark"] {
    /* Dark Mode - Black + Blue accent */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-card: #1c2230;
    --sidebar-bg: linear-gradient(160deg, #0d1117 0%, #111827 50%, #0a0f1e 100%);
    --sidebar-text: rgba(255,255,255,0.85);
    --sidebar-hover: rgba(0,123,255,0.2);
    --sidebar-active: rgba(0,123,255,0.3);
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --input-bg: #21262d;
    --input-border: #30363d;
    --input-focus: #1f6feb;
    --accent-blue: #1f6feb;
    --accent-blue-light: #0d1f3c;
    --accent-blue-dark: #388bfd;
    --accent-green: #3fb950;
    --accent-green-light: #0d2818;
    --accent-orange: #f78166;
    --accent-orange-light: #2d1b0e;
    --accent-red: #f85149;
    --accent-red-light: #2d1517;
    --accent-purple: #c084fc;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --topbar-bg: #1c2230;
    --notification-bg: #1f1a0d;
    --quota-grad: linear-gradient(135deg, #1f2d4a, #1a3a6b);
    --stat-1: linear-gradient(135deg, #1f2d4a, #1a3a6b);
    --stat-2: linear-gradient(135deg, #0d2818, #1b4d2e);
    --stat-3: linear-gradient(135deg, #2d1b0e, #5c3010);
    --stat-4: linear-gradient(135deg, #1f0d3c, #3c1874);
    --toggle-bg: #30363d;
    --toggle-active: #1f6feb;
}

/* ===== GLOBAL RESET ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background 0.3s, color 0.3s;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 260px; height: 100%;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 200;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.3s;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-header .logo-icon {
    font-size: 40px;
    margin-bottom: 8px;
    display: block;
}

.sidebar-header h3 { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.sidebar-header small { font-size: 11px; opacity: 0.7; }

.sidebar-menu { list-style: none; padding: 15px 0; flex: 1; }
.sidebar-menu .menu-label {
    padding: 12px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.5;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    margin: 2px 10px;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 14px;
}

.sidebar-menu li a:hover { background: var(--sidebar-hover); padding-left: 24px; }
.sidebar-menu li a.active { background: var(--sidebar-active); }
.sidebar-menu li a i { width: 24px; margin-right: 10px; font-size: 15px; }

.sidebar-bottom {
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 260px;
    padding: 20px;
    min-height: 100vh;
    transition: margin-left 0.3s;
}

/* ===== TOP BAR ===== */
.top-bar {
    background: var(--topbar-bg);
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    gap: 12px;
    flex-wrap: wrap;
}

.top-bar h2 { font-size: 18px; color: var(--text-primary); }
.top-bar .top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===== DARK MODE TOGGLE ===== */
.dark-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.toggle-switch {
    width: 44px; height: 22px;
    background: var(--toggle-bg);
    border-radius: 11px;
    position: relative;
    transition: background 0.3s;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    background: white;
    border-radius: 50%;
    top: 2px; left: 2px;
    transition: left 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .toggle-switch { background: var(--toggle-active); }
[data-theme="dark"] .toggle-switch::after { left: 24px; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 { font-size: 16px; color: var(--text-primary); font-weight: 600; }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: white;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--stat-1); }
.stat-icon.green { background: var(--stat-2); }
.stat-icon.orange { background: var(--stat-3); }
.stat-icon.purple { background: var(--stat-4); }

.stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0,102,166,0.12);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

/* ===== BUTTONS ===== */
.btn { padding: 10px 20px; border: none; border-radius: var(--radius); cursor: pointer; font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 600; transition: all 0.2s; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-dark)); color: white; }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-success { background: linear-gradient(135deg, #43a047, #2e7d32); color: white; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: linear-gradient(135deg, #ef5350, #c62828); color: white; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-warning { background: linear-gradient(135deg, #ffa726, #e65100); color: white; }
.btn-warning:hover { filter: brightness(1.1); }
.btn-info { background: linear-gradient(135deg, #29b6f6, #0277bd); color: white; }
.btn-info:hover { filter: brightness(1.1); }
.btn-wa { background: linear-gradient(135deg, #25d366, #128c7e); color: white; }
.btn-wa:hover { filter: brightness(1.1); }
.btn-cancel { background: var(--border-color); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-logout { background: #ef476f; color: white; border: none; padding: 8px 18px; border-radius: var(--radius); cursor: pointer; font-size: 13px; font-weight: 600; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border-color); font-size: 13px; color: var(--text-primary); }
th { background: var(--bg-primary); font-weight: 600; font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
tr:hover td { background: var(--bg-primary); }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-free { background: var(--border-color); color: var(--text-secondary); }
.badge-pro { background: #dbeafe; color: #1d4ed8; }
.badge-premium { background: #d1fae5; color: #065f46; }
.badge-lunas { background: var(--accent-green-light); color: var(--accent-green); }
.badge-belum { background: var(--accent-orange-light); color: var(--accent-orange); }
.badge-overdue { background: var(--accent-red-light); color: var(--accent-red); }
.badge-kosong { background: var(--accent-orange-light); color: var(--accent-orange); }
.badge-terisi { background: var(--accent-green-light); color: var(--accent-green); }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.alert-success { background: var(--accent-green-light); color: var(--accent-green); border: 1px solid rgba(46,125,50,0.2); }
.alert-danger { background: var(--accent-red-light); color: var(--accent-red); border: 1px solid rgba(198,40,40,0.2); }
.alert-warning { background: var(--accent-orange-light); color: var(--accent-orange); border: 1px solid rgba(230,81,0,0.2); }
.alert-info { background: var(--accent-blue-light); color: var(--accent-blue); border: 1px solid rgba(0,102,166,0.2); }

/* ===== MODALS ===== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 9000; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.modal.active { display: flex; }
.modal-content { background: var(--bg-card); border-radius: var(--radius-xl); width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--border-color); animation: modalIn 0.2s ease; }
@keyframes modalIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-header h4 { font-size: 16px; color: var(--text-primary); }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); padding: 2px 6px; border-radius: 6px; line-height: 1; }
.modal-close:hover { background: var(--bg-primary); }
.modal-body { padding: 20px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

/* ===== QUOTA BAR ===== */
.quota-card {
    background: var(--quota-grad);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 20px;
    color: white;
    box-shadow: var(--shadow-md);
}

.quota-bar-track { background: rgba(255,255,255,0.25); border-radius: 8px; height: 8px; margin-top: 10px; }
.quota-bar-fill { background: white; border-radius: 8px; height: 8px; transition: width 0.5s; max-width: 100%; }

/* ===== TIER BADGE ===== */
.tier-badge { padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.tier-free { background: rgba(200,200,200,0.2); color: var(--text-muted); border: 1px solid var(--border-color); }
.tier-pro { background: rgba(29,78,216,0.15); color: #1d4ed8; border: 1px solid rgba(29,78,216,0.3); }
.tier-premium { background: rgba(217,119,6,0.15); color: #b45309; border: 1px solid rgba(217,119,6,0.3); }

/* ===== HAMBURGER ===== */
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 8px; border-radius: var(--radius); color: var(--text-primary); font-size: 20px; }

/* ===== MOBILE NAV OVERLAY ===== */
.nav-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 199; }
.nav-overlay.active { display: block; }

/* ===== BOTTOM NAV (mobile) ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 8px 0 env(safe-area-inset-bottom, 8px);
    z-index: 300;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}

.bottom-nav ul { list-style: none; display: flex; justify-content: space-around; }
.bottom-nav ul li a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    text-decoration: none; color: var(--text-muted); font-size: 10px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.2s;
}

.bottom-nav ul li a i { font-size: 20px; }
.bottom-nav ul li a.active { color: var(--accent-blue); }
.bottom-nav ul li a span { font-weight: 500; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.page-btn { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-card); cursor: pointer; font-size: 13px; color: var(--text-primary); }
.page-btn.active { background: var(--accent-blue); color: white; border-color: var(--accent-blue); }
.page-btn:hover:not(.active) { background: var(--bg-primary); }

/* ===== KTP CAMERA ===== */
.ktp-upload-area {
    border: 2px dashed var(--input-border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--bg-primary);
}

.ktp-upload-area:hover { border-color: var(--accent-blue); background: var(--accent-blue-light); }
.ktp-upload-area img { max-width: 100%; max-height: 120px; border-radius: 8px; }
.ktp-upload-area .upload-icon { font-size: 32px; color: var(--text-muted); margin-bottom: 8px; }
.ktp-upload-area p { font-size: 13px; color: var(--text-secondary); }
.ktp-btn-group { display: flex; gap: 8px; margin-top: 10px; justify-content: center; }

/* ===== EXPIRY WARNING ===== */
.expiry-banner {
    background: linear-gradient(135deg, #ff6b35, #e53935);
    color: white;
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    box-shadow: var(--shadow-md);
}

.expiry-banner i { font-size: 24px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 12px; padding-bottom: 80px; }
    .hamburger { display: block; }
    .bottom-nav { display: block; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 18px; }
    table { font-size: 12px; }
    th, td { padding: 8px 10px; }
    .top-bar { padding: 10px 14px; }
    .form-row { grid-template-columns: 1fr; }
    .card { padding: 14px; }
    .top-bar .page-title-text { display: none; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ===== PWA INSTALL ===== */
.pwa-install-btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-blue-dark));
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 6px;
}

/* ===== SECURITY HONEYPOT ===== */
.hp-field { position: absolute; opacity: 0; pointer-events: none; }

/* ===== NUMBER FORMAT ===== */
.formatted-currency::before { content: 'Rp '; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
