/* ============================================================
   Gate Entry System - stylesheet
   Simple, clean, mobile/tablet friendly (no framework, no build step)
   Theme: Dark (Navy Blue accent)
   ============================================================ */

:root {
    --color-primary: #3b82f6;
    --color-primary-dark: #1e3a5f;
    --color-bg: #0f172a;
    --color-card: #1a2436;
    --color-input-bg: #141d2e;
    --color-border: #30425c;
    --color-text: #e5edf7;
    --color-muted: #94a6c2;
    --color-success: #34d399;
    --color-warning: #fbbf24;
    --color-danger: #f87171;
    --radius: 8px;
    --sidebar-width: 230px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
}

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

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary-dark);
    color: #dce6f5;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.brand-logo { background: #fff; color: var(--color-primary-dark); font-weight: 700; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.brand-text { font-size: 13px; line-height: 1.3; }
.brand-text small { opacity: 0.75; font-weight: normal; }

.nav-list { list-style: none; margin: 0; padding: 10px 0; flex: 1; overflow-y: auto; }
.nav-list li a {
    display: block;
    padding: 10px 18px;
    color: #c8d6ea;
    font-size: 14px;
}
.nav-list li a:hover, .nav-list li a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    text-decoration: none;
    border-left: 3px solid #fff;
    padding-left: 15px;
}
.nav-section {
    padding: 14px 18px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.45);
}

.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.12); }
.logout-link { color: #f3a8a8; font-size: 14px; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--color-primary-dark);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    padding: 14px 22px;
    gap: 12px;
}
.page-title { font-size: 19px; margin: 0; flex: 1; color: #fff; }
.topbar-user { font-size: 13px; color: #c8d6ea; text-align: right; }
.nav-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: #fff; }

.page-content { padding: 22px; flex: 1; }

/* ---------- Cards / panels ---------- */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
}
.card h2, .card h3 { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.stat-card .stat-number { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { color: var(--color-muted); font-size: 13px; }
.stat-card.warning { border-left-color: var(--color-warning); }
.stat-card.danger { border-left-color: var(--color-danger); }
.stat-card.muted { border-left-color: var(--color-muted); }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.form-group { margin-bottom: 14px; }
input[type=text], input[type=tel], input[type=email], input[type=password],
input[type=number], input[type=date], input[type=time], input[type=file],
select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--color-input-bg);
    color: var(--color-text);
    font-family: inherit;
}
/* Date/time picker icons are dark glyphs by default - invert so they're visible on a dark field */
input[type=date]::-webkit-calendar-picker-indicator,
input[type=time]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(59,130,246,0.35); }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > .form-group { flex: 1; min-width: 200px; }
.form-hint { font-size: 12px; color: var(--color-muted); margin-top: 4px; }
fieldset { border: 1px dashed var(--color-border); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
legend { font-weight: 700; padding: 0 6px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: var(--color-input-bg); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-border); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--color-border); text-align: left; white-space: nowrap; }
th { background: #1c2740; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-muted); }
tr:hover td { background: rgba(255,255,255,0.03); }

/* ---------- Badges / Alerts ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; background: #26344a; color: var(--color-text); }
.badge-success { background: #123d2c; color: #4ade80; }
.badge-warning { background: #3d2f0a; color: #fbbf24; }
.badge-danger { background: #3d1712; color: #f87171; }
.badge-muted { background: #26344a; color: var(--color-muted); }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #123d2c; color: #6ee7b7; }
.alert-error { background: #3d1712; color: #fca5a5; }
.alert-warning { background: #3d2f0a; color: #fcd34d; }
.alert-info { background: #123a52; color: #7dd3fc; }

/* ---------- Type selector (gate check-in) ---------- */
.type-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.type-tabs a {
    padding: 10px 18px;
    border-radius: 20px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-weight: 600;
    font-size: 13.5px;
}
.type-tabs a.active, .type-tabs a:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); text-decoration: none; }

/* ---------- Auth pages ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--color-bg), var(--color-primary-dark)); }
.auth-card { background: var(--color-card); border: 1px solid var(--color-border); padding: 34px 30px; border-radius: 12px; width: 100%; max-width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; color: var(--color-text); }
.auth-card .subtitle { color: var(--color-muted); font-size: 13px; margin-bottom: 20px; }
.auth-card .btn { width: 100%; margin-top: 8px; }

.text-muted { color: var(--color-muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
    .nav-toggle { display: inline-block; }
    .sidebar {
        position: fixed;
        z-index: 50;
        top: 0; bottom: 0; left: 0;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        width: 220px;
    }
    .app-shell.nav-open .sidebar { transform: translateX(0); }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .page-content { padding: 14px; }
    .topbar { padding: 12px 14px; }
    th, td { white-space: normal; }
}
