/* ============================================================
   PayrollPH – assets/css/app.css
   Dark mode · Philippine payroll system
   ============================================================ */

:root {
  --bg-base:    #0d1117;
  --bg-card:    #161b22;
  --bg-card2:   #1c2230;
  --bg-input:   #21273a;
  --border:     #30363d;
  --border-l:   #3d4455;
  --accent:     #e94560;
  --accent-h:   #c73350;
  --accent2:    #0f3460;
  --accent2-h:  #16213e;
  --gold:       #f5a623;
  --green:      #3fb950;
  --red:        #f85149;
  --blue:       #58a6ff;
  --purple:     #bc8cff;
  --txt:        #e6edf3;
  --txt-2:      #8b949e;
  --txt-3:      #6e7681;
  --radius:     8px;
  --radius-lg:  12px;
  --shadow:     0 4px 16px rgba(0,0,0,.4);
  --shadow-sm:  0 2px 8px rgba(0,0,0,.25);
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --mono:       'JetBrains Mono', 'Fira Code', monospace;
  --sidebar-w:  240px;
  --header-h:   56px;
  --transition: .18s ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg-base); color: var(--txt); min-height: 100vh; overflow-x: hidden; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── Login Page ────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at top-left, #0f3460 0%, var(--bg-base) 60%); }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px 36px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.login-logo  { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 26px; font-weight: 800; letter-spacing: -1px; }
.login-logo h1 span { color: var(--accent); }
.login-logo p  { color: var(--txt-2); font-size: 12px; margin-top: 4px; }

/* ── App Shell ─────────────────────────────────────────────── */
#app { display: none; }
#app.active { display: flex; }

/* Sidebar */
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 200; transition: transform var(--transition); }
.sidebar-brand { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-brand .logo-icon { width: 32px; height: 32px; background: var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.sidebar-brand .logo-text { font-size: 15px; font-weight: 700; }
.sidebar-brand .logo-text span { color: var(--accent); }
.sidebar-nav  { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-group    { margin-bottom: 4px; }
.nav-label    { font-size: 9px; color: var(--txt-3); font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; padding: 10px 20px 4px; }
.nav-item     { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: var(--txt-2); cursor: pointer; transition: all var(--transition); font-size: 13px; border-left: 3px solid transparent; }
.nav-item:hover  { color: var(--txt); background: var(--bg-input); }
.nav-item.active { color: var(--txt); background: rgba(233,69,96,.12); border-left-color: var(--accent); font-weight: 600; }
.nav-item .icon  { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer  { padding: 12px 20px; border-top: 1px solid var(--border); }
.user-chip  { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent2); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--blue); flex-shrink: 0; }
.user-info   { flex: 1; min-width: 0; }
.user-name   { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role   { font-size: 10px; color: var(--txt-2); text-transform: capitalize; }
.btn-logout  { padding: 4px 10px; background: transparent; border: 1px solid var(--border-l); border-radius: 6px; color: var(--txt-2); cursor: pointer; font-size: 11px; transition: all var(--transition); }
.btn-logout:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Main content */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: var(--header-h); background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 100; }
.topbar-title  { font-size: 16px; font-weight: 700; flex: 1; }
.topbar-badge  { font-size: 10px; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.content-area  { flex: 1; padding: 24px; }

/* ── Cards ─────────────────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title  { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--accent); }

/* Stat cards */
.stats-row   { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card   { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden; }
.stat-card::before { content:''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); }
.stat-card.green::before { background: var(--green); }
.stat-card.blue::before  { background: var(--blue); }
.stat-card.gold::before  { background: var(--gold); }
.stat-label  { font-size: 11px; color: var(--txt-2); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.stat-value  { font-size: 24px; font-weight: 800; }
.stat-sub    { font-size: 11px; color: var(--txt-3); margin-top: 4px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label        { font-size: 11px; color: var(--txt-2); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
input, select, textarea {
  background: var(--bg-input); border: 1px solid var(--border-l); border-radius: var(--radius);
  color: var(--txt); padding: 9px 12px; font-size: 13px; font-family: inherit;
  width: 100%; transition: border-color var(--transition);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder { color: var(--txt-3); }
textarea { resize: vertical; min-height: 80px; }
select   { cursor: pointer; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: none; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--transition); font-family: inherit; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--accent-h); }
.btn-secondary{ background: var(--bg-input); color: var(--txt); border: 1px solid var(--border-l); }
.btn-secondary:hover { background: var(--bg-card2); }
.btn-success  { background: #1c4a28; color: var(--green); border: 1px solid #2a6638; }
.btn-success:hover { background: #235430; }
.btn-info     { background: #1c3052; color: var(--blue); border: 1px solid #2d4d78; }
.btn-info:hover { background: #243a62; }
.btn-danger   { background: #3d1c1c; color: var(--red); border: 1px solid #5c2424; }
.btn-danger:hover { background: #4a2020; }
.btn-gold     { background: #3d2e0f; color: var(--gold); border: 1px solid #5c4415; }
.btn-gold:hover { background: #4a3812; }
.btn-sm       { padding: 5px 10px; font-size: 11px; }
.btn-xs       { padding: 3px 8px; font-size: 10px; }
.btn-group    { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap  { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 10px; font-weight: 600; color: var(--txt-2); text-transform: uppercase; letter-spacing: .6px; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid rgba(48,54,61,.5); font-size: 12.5px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }
.data-table .actions { display: flex; gap: 6px; }
.mono { font-family: var(--mono); font-size: 11px; }
.currency { font-family: var(--mono); font-size: 12px; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }

/* ── Badges / Pills ─────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 10px; font-weight: 600; }
.badge-green  { background: rgba(63,185,80,.15); color: var(--green); }
.badge-red    { background: rgba(248,81,73,.15); color: var(--red); }
.badge-blue   { background: rgba(88,166,255,.15); color: var(--blue); }
.badge-gold   { background: rgba(245,166,35,.15); color: var(--gold); }
.badge-purple { background: rgba(188,140,255,.15); color: var(--purple); }
.badge-gray   { background: rgba(110,118,129,.15); color: var(--txt-2); }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 700px; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-size: 15px; font-weight: 700; }
.modal-close  { background: none; border: none; color: var(--txt-2); cursor: pointer; font-size: 20px; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--bg-input); color: var(--txt); }
.modal-body   { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--bg-card); }
.modal.lg     { max-width: 960px; }
.modal.xl     { max-width: 1200px; }

/* ── Search / filter bar ────────────────────────────────────── */
.search-bar   { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search-input { flex: 1; min-width: 200px; }
.search-input input { background: var(--bg-input); }

/* ── Alerts / Toast ─────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 12px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.alert-error   { background: rgba(248,81,73,.12); border: 1px solid rgba(248,81,73,.3); color: var(--red); }
.alert-success { background: rgba(63,185,80,.12); border: 1px solid rgba(63,185,80,.3); color: var(--green); }
.alert-info    { background: rgba(88,166,255,.12); border: 1px solid rgba(88,166,255,.3); color: var(--blue); }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg-card2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-size: 12px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); animation: slideIn .2s ease; min-width: 260px; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Upload zone ────────────────────────────────────────────── */
.upload-zone { border: 2px dashed var(--border-l); border-radius: var(--radius-lg); padding: 36px 20px; text-align: center; cursor: pointer; transition: all var(--transition); }
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: rgba(233,69,96,.05); }
.upload-zone p { color: var(--txt-2); font-size: 12px; margin-top: 8px; }
.upload-zone .icon { font-size: 32px; }

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab  { padding: 10px 16px; font-size: 12px; font-weight: 600; color: var(--txt-2); cursor: pointer; border-bottom: 2px solid transparent; transition: all var(--transition); }
.tab:hover  { color: var(--txt); }
.tab.active { color: var(--txt); border-bottom-color: var(--accent); }

/* ── Section header ─────────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.section-title-main { font-size: 20px; font-weight: 800; }
.section-subtitle   { font-size: 12px; color: var(--txt-2); margin-top: 2px; }

/* ── Misc ───────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--txt-3); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.loading-spin { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.2); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--bg-input); border: 1px solid var(--border-l); border-radius: 20px; font-size: 10px; color: var(--txt-2); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-blue   { color: var(--blue); }
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--txt-2); }
.fw-700 { font-weight: 700; }
.mt-8  { margin-top: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}

/* Chart area */
.chart-box { position: relative; height: 220px; }
