/* Traffic Management System - Angkasa Pura 2
   Clean, modern, professional UI */

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

:root {
    --primary: #0a4d8c;
    --primary-dark: #063864;
    --primary-light: #e8f1fb;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --gray-50:#f8fafc; --gray-100:#f1f5f9; --gray-200:#e2e8f0;
    --gray-300:#cbd5e1; --gray-400:#94a3b8; --gray-500:#64748b;
    --gray-600:#475569; --gray-700:#334155; --gray-800:#1e293b; --gray-900:#0f172a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.5;
}

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

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.brand-logo {
    width: 44px; height: 44px;
    background: var(--accent);
    color: var(--primary-dark);
    border-radius: var(--radius);
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    letter-spacing: -0.5px;
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; opacity: 0.7; letter-spacing: 0.5px; }

.menu {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 2px;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
}
.menu a:hover { background: rgba(255,255,255,0.08); color: white; }
.menu a.active { background: rgba(255,255,255,0.15); color: white; }
.menu a .ico {
    width: 22px; text-align: center;
    font-size: 15px;
}
.menu-sec {
    font-size: 10px;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.4);
    padding: 18px 14px 8px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.user-info {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 10.5px; opacity: 0.7; letter-spacing: 0.5px; }
.logout-btn {
    display: block;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    text-align: center;
    font-size: 12.5px;
    font-weight: 500;
    transition: background 0.15s;
}
.logout-btn:hover { background: rgba(239,68,68,0.8); }

.main {
    flex: 1;
    padding: 28px 32px;
    max-width: calc(100vw - 260px);
    overflow-x: hidden;
}

/* =========== PAGE HEADER =========== */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-head h1 { font-size: 22px; color: var(--gray-900); font-weight: 700; }
.page-head .subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* =========== CARD =========== */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

/* =========== STATS GRID =========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    padding: 18px 20px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--primary);
}
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }

.stat-label { font-size: 12px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--gray-900); margin-top: 6px; }
.stat-sub { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* =========== FORM =========== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10,77,140,0.12);
}
.form-group input[readonly], .form-group input:disabled {
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: not-allowed;
}
.form-hint { font-size: 11.5px; color: var(--gray-500); margin-top: 4px; }

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

/* =========== BUTTON =========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* =========== TABLE =========== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    background: white;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 600;
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--gray-200);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-size: 11.5px;
    white-space: nowrap;
}
table.data td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
table.data tr:hover td { background: var(--gray-50); }
table.data tr:last-child td { border-bottom: none; }

/* =========== BADGE =========== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: var(--gray-200); color: var(--gray-700); }

/* =========== ALERT =========== */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 4px solid;
}
.alert-success { background: #d1fae5; color: #065f46; border-color: var(--success); }
.alert-error   { background: #fee2e2; color: #991b1b; border-color: var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-color: var(--warning); }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: var(--info); }

/* =========== LOGIN =========== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}
.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}
.login-card .brand-login {
    text-align: center;
    margin-bottom: 28px;
}
.login-card .brand-login .logo {
    width: 60px; height: 60px;
    background: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 18px;
    border-radius: 14px;
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.login-card h2 { color: var(--gray-900); font-size: 20px; }
.login-card .sub { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

.login-demo {
    margin-top: 20px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 6px;
    font-size: 11.5px;
    color: var(--gray-600);
}
.login-demo strong { color: var(--gray-800); }

/* =========== SCAN PAGE =========== */
.scan-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) { .scan-area { grid-template-columns: 1fr; } }

.scan-input-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}
.scan-input-card input[type="text"] {
    font-size: 18px;
    padding: 14px 16px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    text-align: center;
}
.scan-driver-info {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    padding: 16px;
    border-radius: 6px;
    margin-top: 16px;
}
.scan-driver-info.hidden { display: none; }
.driver-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13.5px;
}
.driver-row .label { color: var(--gray-600); }
.driver-row .value { font-weight: 600; color: var(--gray-900); }

.vehicle-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.vehicle-gojek { background: #064e3b; color: white; }
.vehicle-grab  { background: #047857; color: white; }
.vehicle-maxim { background: #f59e0b; color: white; }
.vehicle-premium_car { background: #7c3aed; color: white; }

/* =========== LOCK STATUS =========== */
.lock-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.lock-box {
    padding: 16px;
    border-radius: var(--radius);
    border: 2px dashed var(--gray-300);
    text-align: center;
}
.lock-box.locked { border-color: var(--warning); background: #fef9c3; border-style: solid; }
.lock-box.synced { border-color: var(--success); background: #d1fae5; border-style: solid; }
.lock-box .lb-date { font-size: 12px; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.lock-box .lb-val  { font-size: 28px; font-weight: 700; color: var(--gray-900); margin: 6px 0; }
.lock-box .lb-status { font-size: 11.5px; font-weight: 600; }

/* =========== UTILITY =========== */
.text-muted { color: var(--gray-500); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mt-10 { margin-top: 10px; } .mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; } .mb-20 { margin-bottom: 20px; }

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: end;
}
.filter-bar .form-group { margin-bottom: 0; }

@media (max-width: 768px) {
    .sidebar { width: 70px; }
    .sidebar .brand-name, .sidebar .brand-sub,
    .sidebar .menu a span:not(.ico),
    .sidebar .menu-sec, .sidebar .user-info,
    .sidebar .logout-btn { display: none; }
    .main { max-width: calc(100vw - 70px); padding: 20px; }
}
