/* ============================================================
   HRMS Pro – Main Stylesheet
   Font: Plus Jakarta Sans (UI) + JetBrains Mono (data)
   Theme: Clean dark with blue accent
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@300;400;500;600&display=swap');

:root {
    --bg-base:        #09090d;
    --bg-surface:     #0f1015;
    --bg-card:        #161820;
    --bg-hover:       #1c1f2b;
    --bg-input:       #0f1015;
    --border:         #212433;
    --border-light:   #2d3148;
    --accent:         #5b8def;
    --accent-dim:     rgba(91,141,239,0.12);
    --accent-hover:   #7aa3f5;
    --accent-glow:    rgba(91,141,239,0.22);
    --success:        #34d399;
    --success-dim:    rgba(52,211,153,0.10);
    --danger:         #f87171;
    --danger-dim:     rgba(248,113,113,0.10);
    --warning:        #fbbf24;
    --warning-dim:    rgba(251,191,36,0.10);
    --info:           #60a5fa;
    --info-dim:       rgba(96,165,250,0.10);
    --purple:         #a78bfa;
    --purple-dim:     rgba(167,139,250,0.10);
    --text-primary:   #eef0f6;
    --text-secondary: #7d8699;
    --text-muted:     #434860;
    --sidebar-w:      252px;
    --topbar-h:       58px;
    --radius:         12px;
    --radius-sm:      8px;
    --radius-xs:      5px;
    --shadow:         0 12px 40px rgba(0,0,0,0.6);
    --shadow-sm:      0 2px 10px rgba(0,0,0,0.3);
    --font-ui:        'Plus Jakarta Sans', system-ui, sans-serif;
    --font-mono:      'JetBrains Mono', 'Courier New', monospace;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }

body {
    font-family: var(--font-ui);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

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

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    position: fixed; top: 0; left: 0;
    height: 100vh; z-index: 200;
    display: flex; flex-direction: column;
    transition: width 0.25s ease;
    overflow: hidden;
}
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.brand-icon {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 15px; color: #fff;
    flex-shrink: 0; box-shadow: 0 0 0 4px var(--accent-dim);
}
.brand-name { font-size: 14px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.3px; }
.brand-sub  { font-size: 9px; color: var(--text-muted); font-family: var(--font-mono); letter-spacing: 1.5px; text-transform: uppercase; }

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.nav-section-label {
    font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--text-muted); padding: 12px 8px 4px;
    font-family: var(--font-mono);
}
.nav-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none;
    font-size: 13px; font-weight: 500;
    transition: all 0.15s; margin-bottom: 2px; white-space: nowrap;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-logout:hover { background: var(--danger-dim); color: var(--danger); }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.user-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 11px; color: #fff;
}
.user-name { display: block; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.user-role { display: block; font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; font-family: var(--font-mono); }

/* ── MAIN ── */
.main-content {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column; min-height: 100vh;
    transition: margin-left 0.25s ease;
}

/* ── TOP BAR ── */
.top-bar {
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    padding: 0 22px; position: sticky; top: 0; z-index: 100;
}
.sidebar-toggle {
    background: none; border: 1px solid var(--border);
    color: var(--text-secondary); padding: 5px 9px;
    border-radius: var(--radius-xs); cursor: pointer; font-size: 13px;
    transition: all 0.15s;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-title-area { flex: 1; }
.page-heading { font-size: 15px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.page-breadcrumb { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.top-bar-actions { display: flex; align-items: center; gap: 10px; }
.top-date { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

.notif-bell { position: relative; cursor: pointer; font-size: 15px; user-select: none; padding: 5px; }
.notif-badge {
    position: absolute; top: 0; right: 0;
    background: var(--danger); color: #fff; border-radius: 50%;
    width: 13px; height: 13px; font-size: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-weight: 600;
}
.notif-dropdown {
    display: none; position: absolute; top: 38px; right: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); width: 300px; box-shadow: var(--shadow); z-index: 999;
}
.notif-dropdown.open { display: block; }
.notif-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 12px; }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item strong { font-size: 12px; display: block; margin-bottom: 2px; }
.notif-item p { font-size: 11px; color: var(--text-secondary); }
.notif-item small { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

/* ── CONTENT ── */
.content-body { padding: 22px; flex: 1; }

/* ── CARDS ── */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-secondary); }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px;
    position: relative; overflow: hidden;
    transition: border-color 0.2s, transform 0.15s;
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.stat-card::after {
    content: ''; position: absolute; top: 0; left: 0;
    width: 100%; height: 2px; background: var(--accent);
}
.stat-card.green::after  { background: var(--success); }
.stat-card.red::after    { background: var(--danger);  }
.stat-card.blue::after   { background: var(--info);    }
.stat-card.purple::after { background: var(--purple);  }
.stat-label { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-family: var(--font-mono); margin-bottom: 10px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; margin-bottom: 4px; letter-spacing: -1px; }
.stat-meta  { font-size: 11px; color: var(--text-secondary); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { border-bottom: 1px solid var(--border); }
th { padding: 9px 13px; text-align: left; font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-family: var(--font-mono); font-weight: 500; white-space: nowrap; }
td { padding: 11px 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: var(--bg-hover); }

/* ── BADGES ── */
.badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: 20px;
    font-size: 10px; font-weight: 600; font-family: var(--font-mono);
    letter-spacing: 0.3px; text-transform: uppercase;
}
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger);  }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info    { background: var(--info-dim);    color: var(--info);    }
.badge-muted   { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.badge-accent  { background: var(--accent-dim);  color: var(--accent);  }
.badge-purple  { background: var(--purple-dim);  color: var(--purple);  }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 15px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; font-family: var(--font-ui);
    cursor: pointer; border: 1px solid transparent;
    text-decoration: none; transition: all 0.15s;
    letter-spacing: -0.1px; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 0 3px var(--accent-glow); }
.btn-success { background: var(--success-dim); color: var(--success); border-color: rgba(52,211,153,0.25); }
.btn-success:hover { background: var(--success); color: #000; }
.btn-danger  { background: var(--danger-dim);  color: var(--danger);  border-color: rgba(248,113,113,0.25); }
.btn-danger:hover  { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-sm  { padding: 4px 10px; font-size: 11px; border-radius: var(--radius-xs); }
.btn-lg  { padding: 10px 22px; font-size: 14px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.w-100 { width: 100%; justify-content: center; }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block; font-size: 11px; font-weight: 600;
    letter-spacing: 0.5px; text-transform: uppercase;
    color: var(--text-secondary); margin-bottom: 5px;
}
.form-control {
    width: 100%; padding: 8px 12px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-family: var(--font-ui); font-size: 13px;
    transition: border-color 0.15s, box-shadow 0.15s; line-height: 1.4;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); }

/* ── ALERTS ── */
.alert {
    padding: 11px 15px; border-radius: var(--radius-sm);
    margin-bottom: 14px; font-size: 13px; border: 1px solid;
}
.alert-success { background: var(--success-dim); border-color: rgba(52,211,153,0.25); color: var(--success); }
.alert-danger  { background: var(--danger-dim);  border-color: rgba(248,113,113,0.25); color: var(--danger);  }
.alert-warning { background: var(--warning-dim); border-color: rgba(251,191,36,0.25);  color: var(--warning); }
.alert-info    { background: var(--info-dim);    border-color: rgba(96,165,250,0.25);  color: var(--info);    }

/* ── SHIFT PANEL ── */
.shift-panel {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 30px;
    text-align: center; margin-bottom: 18px; position: relative; overflow: hidden;
}
.shift-panel::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
}
.shift-time {
    font-size: 48px; font-weight: 800; font-family: var(--font-mono);
    color: var(--text-primary); letter-spacing: -2px;
    margin-bottom: 4px; line-height: 1;
}
.shift-date {
    font-size: 11px; color: var(--text-muted); letter-spacing: 2px;
    font-family: var(--font-mono); margin-bottom: 22px; text-transform: uppercase;
}
.camera-box {
    width: 320px; height: 240px; background: #000;
    border-radius: var(--radius); margin: 0 auto 16px;
    overflow: hidden; border: 2px solid var(--border); position: relative;
}
.camera-box video { width: 100%; height: 100%; object-fit: cover; }
.camera-overlay {
    position: absolute; inset: 0; border: 2px solid var(--accent);
    border-radius: var(--radius); pointer-events: none;
    animation: cam-pulse 2s infinite;
}
@keyframes cam-pulse { 0%,100% { border-color: var(--accent); } 50% { border-color: var(--accent-hover); } }

.verification-steps { display: flex; justify-content: center; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.step-indicator { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-light); transition: all 0.3s; }
.step-dot.done   { background: var(--success); box-shadow: 0 0 5px var(--success); }
.step-dot.active { background: var(--accent); animation: blink 0.8s infinite; }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity: 0.3; } }

.face-check-status {
    margin: 10px auto; width: 320px; padding: 10px 14px;
    border-radius: var(--radius-sm); font-size: 12px;
    font-family: var(--font-mono); text-align: left; display: none;
}
.face-check-status.checking { background: var(--info-dim);    border: 1px solid rgba(96,165,250,0.3);   color: var(--info);    display: block; }
.face-check-status.pass     { background: var(--success-dim); border: 1px solid rgba(52,211,153,0.3);  color: var(--success); display: block; }
.face-check-status.fail     { background: var(--danger-dim);  border: 1px solid rgba(248,113,113,0.3); color: var(--danger);  display: block; }

/* ── LOGIN ── */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg-base);
    background-image:
        radial-gradient(ellipse 60% 50% at 20% 80%, rgba(91,141,239,0.06) 0%, transparent 100%),
        radial-gradient(ellipse 50% 40% at 80% 20%, rgba(167,139,250,0.04) 0%, transparent 100%);
}
.login-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 16px; padding: 40px 36px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
    width: 48px; height: 48px; background: var(--accent); border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 900; color: #fff; margin-bottom: 12px;
    box-shadow: 0 0 0 8px var(--accent-dim);
}
.login-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.5px; }
.login-sub   { font-size: 10px; color: var(--text-muted); letter-spacing: 2px; font-family: var(--font-mono); text-transform: uppercase; }

/* ── LEAVE BARS ── */
.leave-bar-wrap { margin-bottom: 12px; }
.leave-bar-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; font-weight: 500; }
.leave-bar-track { background: var(--bg-surface); border-radius: 6px; height: 5px; overflow: hidden; }
.leave-bar-fill  { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 6px; transition: width 1.2s cubic-bezier(0.4,0,0.2,1); }

/* ── LEAVE CALENDAR ── */
.leave-cal-wrap { overflow-x: auto; }
.leave-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; min-width: 500px; }
.leave-cal-day-header { text-align: center; font-size: 9px; font-family: var(--font-mono); color: var(--text-muted); padding: 4px; letter-spacing: 1px; text-transform: uppercase; }
.leave-cal-day {
    aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 7px; font-size: 12px; font-family: var(--font-mono); font-weight: 500;
    cursor: pointer; border: 1px solid transparent; transition: all 0.15s;
    position: relative; flex-direction: column; gap: 2px;
}
.leave-cal-day:hover:not(.empty):not(.weekend) { background: var(--bg-hover); border-color: var(--border-light); }
.leave-cal-day.today   { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.leave-cal-day.weekend { color: var(--text-muted); opacity: 0.5; cursor: default; }
.leave-cal-day.holiday { background: var(--accent-dim); color: var(--accent); border-color: rgba(91,141,239,0.2); }
.leave-cal-day.leave-approved { background: var(--success-dim); color: var(--success); }
.leave-cal-day.leave-pending  { background: var(--warning-dim); color: var(--warning); }
.leave-cal-day.leave-rejected { background: var(--danger-dim);  color: var(--danger);  }
.leave-cal-day.manual-selected { background: var(--info-dim); border-color: var(--info); color: var(--info); }
.leave-cal-day.empty { cursor: default; }
.leave-cal-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

/* ── HIERARCHY ── */
.hierarchy-tree { padding: 16px 0 0 24px; position: relative; }
.hierarchy-tree::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 20px; width: 1px; background: var(--border); }
.hierarchy-node { position: relative; padding: 6px 0 6px 20px; }
.hierarchy-node::before { content: ''; position: absolute; left: 0; top: 22px; width: 16px; height: 1px; background: var(--border); }
.hierarchy-node-card {
    background: var(--bg-hover); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 9px 14px;
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 500;
}

/* ── MODAL ── */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
    z-index: 500; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px;
    width: 90%; max-width: 540px; max-height: 90vh;
    overflow-y: auto; box-shadow: var(--shadow);
    animation: modal-in 0.18s ease;
}
@keyframes modal-in { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; transition: color 0.15s; }
.modal-close:hover { color: var(--danger); }

/* ── UTILITY ── */
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-accent   { color: var(--accent); }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.mono          { font-family: var(--font-mono); }
.mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; } .align-center { align-items: center; }
.justify-between { justify-content: space-between; } .gap-2 { gap: 8px; } .gap-3 { gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .content-body { padding: 14px; }
    .stats-grid { grid-template-columns: 1fr; }
    .shift-time { font-size: 36px; }
}
