/* ============================================================
   CHAMCONG GPS — Main Stylesheet
   ============================================================ */
:root {
    --navy:    #0d2369;
    --navy2:   #1a3a8c;
    --blue:    #1e56d9;
    --green:   #16a34a;
    --red:     #dc2626;
    --yellow:  #d97706;
    --orange:  #ea580c;
    --gray:    #64748b;
    --light:   #f1f5f9;
    --border:  #e2e8f0;
    --white:   #ffffff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', sans-serif; background: var(--light); color: #1e293b; font-size: 14px; }
a { color: var(--blue); text-decoration: none; }

/* ── Topbar ── */
.topbar {
    background: var(--navy);
    color: #fff;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.topbar-brand { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.topbar-brand i { font-size: 18px; }
.topbar-user { font-size: 13px; display: flex; align-items: center; gap: 10px; }
.topbar-user .btn-logout {
    background: #dc2626; color: #fff; border: none;
    padding: 5px 12px; border-radius: 5px; cursor: pointer; font-size: 12px;
}

/* ── Navbar tabs ── */
.nav-tabs-bar {
    background: #fff;
    border-bottom: 2px solid var(--border);
    display: flex;
    gap: 0;
    padding: 0 20px;
    position: sticky;
    top: 52px;
    z-index: 99;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav-tabs-bar::-webkit-scrollbar { display: none; }
.nav-tab {
    padding: 12px 18px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}
.nav-tab:hover { color: var(--navy); }
.nav-tab.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.nav-tab .badge-count {
    background: var(--red);
    color: #fff;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 11px;
}

/* ── Content ── */
.main-content { padding: 20px; max-width: 1400px; margin: 0 auto; }

/* ── Card ── */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    margin-bottom: 20px;
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body { padding: 20px; }

/* ── Filters bar ── */
.filters-bar {
    background: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 12px; color: var(--gray); font-weight: 600; }
.filter-group select,
.filter-group input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    font-size: 13px;
    background: #fff;
    min-width: 150px;
}
.filter-group select:focus,
.filter-group input:focus { outline: none; border-color: var(--blue); }

/* ── Stat chip ── */
.stat-chip {
    background: var(--navy);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    white-space: nowrap;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-primary   { background: var(--blue);   color: #fff; }
.btn-primary:hover { background: var(--navy2); }
.btn-success   { background: var(--green);  color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger    { background: var(--red);    color: #fff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning   { background: var(--yellow); color: #fff; }
.btn-secondary { background: #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 5px 8px; border-radius: 6px; border: none; cursor: pointer; font-size: 14px; }
.btn-icon-blue   { background: #dbeafe; color: var(--blue); }
.btn-icon-yellow { background: #fef3c7; color: var(--yellow); }
.btn-icon-red    { background: #fee2e2; color: var(--red); }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
    background: var(--navy);
    color: #fff;
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.data-table tbody tr:nth-child(even) { background: #f8fafc; }
.data-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr.row-pending  { background: #fffbeb; }
.data-table tbody tr.row-approved { background: #f0fdf4; }
.data-table tbody tr.row-rejected { background: #fff1f2; }
.data-table tbody tr:hover { background: #f0f4ff; }

/* ── Status badges ── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-status.pending  { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-status.approved { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.badge-status.rejected { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.badge-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
}
.badge-red    { background: #dc2626; color: #fff; }
.badge-green  { background: #16a34a; color: #fff; }
.badge-blue   { background: var(--blue); color: #fff; }
.badge-gray   { background: #94a3b8; color: #fff; }
.badge-orange { background: #ea580c; color: #fff; }
.badge-purple { background: #7c3aed; color: #fff; }
.badge-teal   { background: #0d9488; color: #fff; }

/* ── Payroll table cells ── */
.pay-cell {
    display: block;
    width: 100%;
    min-width: 88px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 5px 7px;
    font-size: 12px;
    text-align: right;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.pay-cell:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,.2);
}
.pay-cell::placeholder { color: #d1d5db; }

/* ── Tab filter buttons ── */
.tab-filter-bar { display: flex; gap: 8px; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab-filter {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}
.tab-filter.active-all      { background: #1e293b; color: #fff; border-color: #1e293b; }
.tab-filter.active-pending  { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.tab-filter.active-approved { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.tab-filter.active-rejected { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

/* ── Charts row ── */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.chart-card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.chart-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.chart-title.red  { color: var(--red); }
.chart-title.gold { color: #d97706; }

/* ── Duration badge in leave table ── */
.duration-badge {
    display: inline-block;
    background: #1e293b;
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 11px;
    margin-top: 3px;
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 500;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-header {
    background: var(--navy);
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 15px;
    position: sticky;
    top: 0;
}
.modal-close { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Form ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: #475569; }
.form-control {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 11px;
    font-size: 13px;
    background: #fff;
    width: 100%;
}
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,86,217,.1); }

/* ── GPS status bar (employee) ── */
.gps-bar {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    margin-bottom: 16px;
}
.gps-bar.ok   { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.gps-bar.fail { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.gps-bar.loading { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Login page ── */
.login-wrap {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy) 0%, #1a4494 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    width: 380px;
    box-shadow: 0 24px 64px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h2 { color: var(--navy); font-size: 20px; font-weight: 800; margin-top: 12px; }
.login-logo p { color: var(--gray); font-size: 13px; margin-top: 4px; }
.alert-error { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #d1fae5; color: #065f46; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .charts-row { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .main-content { padding: 12px; }
    .filters-bar { gap: 10px; }
    .stat-chip { margin-left: 0; }
}
