/* =====================================================================
   BINTANG SALES MONITOR - Stylesheet
   Tema: Professional Navy + Gold (nuansa bintang)
   Mobile-first, responsive
   ===================================================================== */

:root {
    --primary: #1e3a5f;
    --primary-dark: #15293f;
    --primary-light: #2d5483;
    --accent: #f5b301;
    --accent-dark: #d99e00;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --sidebar-w: 248px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== APP SHELL ===== */
.app-shell { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-star {
    font-size: 26px;
    background: var(--accent);
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
}
.brand-name { font-weight: 700; font-size: 18px; line-height: 1; }
.brand-sub { font-size: 11px; opacity: .65; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px;
    color: rgba(255,255,255,.78);
    border-radius: 8px;
    margin-bottom: 3px;
    font-weight: 500;
    transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--accent); color: var(--primary-dark); font-weight: 600; }
.nav-icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.user-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--accent); color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; opacity: .6; }
.btn-logout {
    display: block; text-align: center;
    background: rgba(255,255,255,.12);
    color: #fff; padding: 9px; border-radius: 8px;
    font-size: 13px; font-weight: 500;
}
.btn-logout:hover { background: rgba(220,38,38,.8); text-decoration: none; }

/* ===== MAIN AREA ===== */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 22px;
    display: flex; align-items: center; gap: 14px;
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 20px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.menu-toggle {
    display: none;
    background: none; border: none; font-size: 22px;
    cursor: pointer; color: var(--text);
    padding: 4px 8px;
}

.content { padding: 22px; flex: 1; max-width: 1280px; width: 100%; }

.app-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex; justify-content: space-between;
    font-size: 12px; color: var(--text-muted);
}

.backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}
.backdrop.show { display: block; }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 18px;
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 700; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

/* ===== STAT CARDS ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px; margin-bottom: 22px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    position: relative;
}
.stat-card.accent { border-left-color: var(--accent); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.info { border-left-color: var(--info); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-icon { position: absolute; right: 16px; top: 16px; font-size: 28px; opacity: .18; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table.data-table {
    width: 100%; border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 12px 14px; text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table th {
    background: #f9fafb; font-size: 12px; text-transform: uppercase;
    letter-spacing: .3px; color: var(--text-muted); font-weight: 700;
    position: sticky; top: 0;
}
.data-table tbody tr:hover { background: #f9fafb; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .cell-name { font-weight: 600; }
.data-table .row-actions { display: flex; gap: 6px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius-sm);
    border: none; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all .15s;
    font-family: inherit;
}
.btn:hover { text-decoration: none; opacity: .92; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 13px; font-size: 15px; }
.btn-icon { padding: 7px 10px; font-size: 15px; }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 6px;
    font-weight: 600; font-size: 13px;
}
.form-group label .req { color: var(--danger); }
.form-control {
    width: 100%; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit;
    background: #fff; transition: border .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none; border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(30,58,95,.1);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.help-text { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.has-error { border-color: var(--danger) !important; }
.error-text { color: var(--danger); font-size: 12px; margin-top: 4px; }

.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    margin-top: 20px; padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block; padding: 3px 10px;
    border-radius: 20px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .3px;
}
.badge.green { background: #dcfce7; color: #166534; }
.badge.yellow { background: #fef9c3; color: #854d0e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #f3f4f6; color: #374151; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.orange { background: #ffedd5; color: #9a3412; }

/* ===== ALERTS ===== */
.alert {
    padding: 13px 16px; border-radius: var(--radius-sm);
    margin-bottom: 18px; font-size: 14px; font-weight: 500;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }

/* ===== PROGRESS BAR ===== */
.progress { background: #e5e7eb; border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; transition: width .4s; }
.progress-bar.green { background: var(--success); }
.progress-bar.yellow { background: var(--accent); }
.progress-bar.red { background: var(--danger); }
.progress-bar.blue { background: var(--info); }

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    margin-bottom: 18px;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ===== LOGIN PAGE ===== */
.login-body {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-wrapper { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: #fff; border-radius: 16px; padding: 36px 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-logo { text-align: center; margin-bottom: 16px; }
.logo-circle {
    width: 64px; height: 64px; margin: 0 auto;
    background: var(--accent); border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 34px;
    box-shadow: 0 8px 20px rgba(245,179,1,.4);
}
.login-card h1 { text-align: center; font-size: 22px; color: var(--primary); }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }
.login-hint {
    margin-top: 22px; padding: 14px; background: #f9fafb;
    border-radius: 8px; font-size: 12px; color: var(--text-muted);
    text-align: center; line-height: 1.7;
}
.login-hint code { background: #e5e7eb; padding: 2px 7px; border-radius: 4px; color: var(--text); }
.login-footer { text-align: center; color: rgba(255,255,255,.6); font-size: 12px; margin-top: 20px; }

/* ===== GPS / LOCATION BOX ===== */
.location-box {
    background: #f0f9ff; border: 1px solid #bae6fd;
    border-radius: var(--radius-sm); padding: 14px;
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 12px;
}
.location-box .gps-icon { font-size: 24px; }
.location-box .gps-text { flex: 1; font-size: 13px; }
.location-box .gps-coord { font-family: monospace; font-size: 12px; color: var(--text-muted); }

.map-preview {
    height: 200px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); margin-top: 10px;
    overflow: hidden; position: relative;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-area { margin-left: 0; }
    .menu-toggle { display: block; }
    .content { padding: 16px; }
    .topbar-title { font-size: 17px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .topbar-right .btn-label { display: none; }
    .topbar-right .btn { padding: 9px 11px; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .btn { width: 100%; justify-content: center; }
    .card-body { padding: 16px; }
}

/* ===== UTILITIES ===== */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.fw-700 { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mt-10 { margin-top: 10px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
