/* DepEd Leave Management System - Main Stylesheet */
/* Font: Plus Jakarta Sans + DM Mono */

:root {
  /* Color Palette */
  --primary: #1a4fa0;
  --primary-light: #2563d4;
  --primary-dark: #0f3070;
  --primary-ghost: rgba(26, 79, 160, 0.08);
  --accent: #f59e0b;
  --accent-light: #fcd34d;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #3b82f6;
  --info-light: #dbeafe;

  /* Neutrals */
  --bg: #f0f4f9;
  --bg-card: #ffffff;
  --sidebar-bg: #0e1e40;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: rgba(245, 158, 11, 0.15);
  --sidebar-active-border: #f59e0b;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #1a4fa0;

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  /* Typography */
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}

/* ========================
   SIDEBAR
======================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  display: block;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  display: block;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-superadmin { background: rgba(239,68,68,0.2); color: #fff; }
.badge-admin { background: rgba(16,185,129,0.2); color: #fff; }
.badge-hradmin { background: rgba(139,92,246,0.2); color: #fff; }
.badge-subadmin { background: rgba(245,158,11,0.2); color: #fff; }
.badge-approver { background: rgba(245,158,11,0.2); color: #fff; }
.badge-user { background: rgba(59,130,246,0.2); color: #fff; }
.badge-employee { background: rgba(59,130,246,0.2); color: #fff; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 140px);
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.nav-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
  margin-bottom: 1px;
}

.nav-item i { width: 18px; text-align: center; font-size: 0.85rem; flex-shrink: 0; }

.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--accent-light);
  border-left: 3px solid var(--sidebar-active-border);
}

.nav-item.active i { color: var(--accent); }

.nav-logout { color: rgba(239,68,68,0.7) !important; margin-top: 8px; }
.nav-logout:hover { background: rgba(239,68,68,0.1) !important; color: #fca5a5 !important; }

.badge-count {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
}

/* ========================
   MAIN WRAPPER + TOPBAR
======================== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  display: none;
}

.sidebar-toggle:hover { background: var(--bg); color: var(--primary); }

.topbar-title { flex: 1; }
.topbar-title h1 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.topbar-sub { font-size: 0.75rem; color: var(--text-muted); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.topbar-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  background: var(--bg);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}

.topbar-user-chip:hover { background: var(--border); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
  z-index: 1000;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.82rem;
  transition: background 0.2s;
}

.dropdown-item:hover { background: var(--bg); }
.dropdown-item.logout { color: var(--danger); }
.dropdown-item.logout:hover { background: var(--danger-light); }
.dropdown-item i { width: 16px; text-align: center; }

.chip-avatar {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ========================
   FLASH MESSAGES
======================== */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 24px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.flash-success { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }
.flash-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.flash-info { background: var(--info-light); color: #1e40af; border: 1px solid #93c5fd; }
.flash-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; opacity: 0.6; font-size: 0.9rem; }
.flash-close:hover { opacity: 1; }

/* ========================
   PAGE CONTENT
======================== */
.page-content { padding: 24px; flex: 1; }

/* ========================
   CARDS
======================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title i { color: var(--primary); }

.card-body { padding: 20px; }

/* ========================
   STAT CARDS
======================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-ghost); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }

.stat-info { flex: 1; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* ========================
   TABLES
======================== */
.table-container { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead tr {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
}

th {
  padding: 11px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:hover { background: rgba(26,79,160,0.02); }
tbody tr:last-child td { border-bottom: none; }

/* ========================
   STATUS BADGES
======================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.status-pending { background: var(--warning-light); color: #92400e; }
.status-pending::before { background: var(--warning); }
.status-approved { background: var(--success-light); color: #065f46; }
.status-approved::before { background: var(--success); }
.status-disapproved { background: var(--danger-light); color: #991b1b; }
.status-disapproved::before { background: var(--danger); }

/* ========================
   FORMS
======================== */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26, 79, 160, 0.1);
  transform: translateY(-1px);
}

textarea { min-height: 90px; resize: vertical; }

.form-hint { font-size: 0.72rem; color: var(--text-muted); }
.form-error { font-size: 0.72rem; color: var(--danger); }

/* ========================
   BUTTONS
======================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary { background: linear-gradient(135deg, #1a4fa0 0%, #2563d4 50%, #3b82f6 100%); color: white; }
.btn-primary:hover { background: linear-gradient(135deg, #0f3070 0%, #1a4fa0 50%, #2563d4 100%); box-shadow: 0 6px 20px rgba(26,79,160,0.4); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }

.btn-success { background: linear-gradient(135deg, #0891b2 0%, #06b6d4 50%, #22d3ee 100%); color: white; }
.btn-success:hover { background: linear-gradient(135deg, #0e7490 0%, #0891b2 50%, #06b6d4 100%); }

.btn-danger { background: linear-gradient(135deg, #1e40af 0%, #2563d4 50%, #3b82f6 100%); color: white; }
.btn-danger:hover { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563d4 100%); }

.btn-outline { background: linear-gradient(135deg, rgba(26,79,160,0.1) 0%, rgba(37,99,235,0.1) 100%); color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: linear-gradient(135deg, rgba(26,79,160,0.2) 0%, rgba(37,99,235,0.2) 100%); }

.btn-ghost { background: linear-gradient(135deg, rgba(59,130,246,0.05) 0%, rgba(37,99,235,0.05) 100%); color: var(--text-secondary); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: linear-gradient(135deg, rgba(59,130,246,0.15) 0%, rgba(37,99,235,0.15) 100%); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }

/* ========================
   FILTERS BAR
======================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.filter-bar select, .filter-bar input {
  width: auto;
  min-width: 140px;
  padding: 7px 10px;
  font-size: 0.82rem;
}

.filter-bar label { font-size: 0.78rem; white-space: nowrap; }

/* ========================
   CHARTS GRID
======================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-container { position: relative; height: 260px; }

/* ========================
   LEAVE APPLICATION FORM
======================== */
.leave-type-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.leave-type-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.leave-type-item:hover { background: var(--bg); }
.leave-type-item input[type=checkbox] { margin-top: 2px; accent-color: var(--primary); }

.leave-type-label { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.3; }

/* ========================
   EMPTY STATE
======================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; }

/* ========================
   MODAL
======================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1rem; cursor: pointer; color: var(--text-muted); padding: 4px; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ========================
   LOGIN PAGE
======================== */
.login-page {
  min-height: 100vh;
  display: flex;
  flex: 1;
  width: 100%;
  background: linear-gradient(135deg, #0a1628, #1a3a6b, #0f2847, #1a4fa0, #2563d4, #0a1628);
  background-size: 400% 400%;
  animation: gradientWave 20s ease infinite;
  position: relative;
  overflow: hidden;
}

@keyframes gradientWave {
  0% { background-position: 0% 50%; }
  25% { background-position: 50% 75%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 50% 25%; }
  100% { background-position: 0% 50%; }
}

.login-page::before {
  content: '';
  position: absolute;
  width: 1000px; height: 1000px;
  background: radial-gradient(circle, rgba(245,158,11,0.2) 0%, transparent 70%);
  top: -300px; left: -300px;
  animation: wave1 25s ease-in-out infinite;
  border-radius: 40%;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(37,99,235,0.25) 0%, transparent 70%);
  bottom: -250px; right: -250px;
  animation: wave2 30s ease-in-out infinite;
  border-radius: 45%;
}

@keyframes wave1 {
  0%, 100% { 
    transform: translate(0, 0) rotate(0deg) scale(1); 
    border-radius: 40%;
  }
  25% { 
    transform: translate(100px, -80px) rotate(90deg) scale(1.15); 
    border-radius: 35%;
  }
  50% { 
    transform: translate(50px, 50px) rotate(180deg) scale(0.9); 
    border-radius: 50%;
  }
  75% { 
    transform: translate(-80px, 30px) rotate(270deg) scale(1.1); 
    border-radius: 42%;
  }
}

@keyframes wave2 {
  0%, 100% { 
    transform: translate(0, 0) rotate(0deg) scale(1); 
    border-radius: 45%;
  }
  33% { 
    transform: translate(-70px, 90px) rotate(120deg) scale(1.2); 
    border-radius: 38%;
  }
  66% { 
    transform: translate(60px, -60px) rotate(240deg) scale(0.85); 
    border-radius: 52%;
  }
}

.login-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
  z-index: 1;
}

.login-brand { 
  position: relative; 
  text-align: center; 
  color: white;
  animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-brand-logo {
  width: 100px; height: 100px;
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 28px;
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.login-brand h1 { 
  font-size: 2.4rem; 
  font-weight: 800; 
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-brand p { 
  color: rgba(255,255,255,0.6); 
  font-size: 0.95rem; 
  max-width: 360px; 
  margin: 0 auto; 
  line-height: 1.7;
}

.login-right {
  width: 520px;
  min-width: 520px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  position: relative;
  z-index: 1;
  animation: slideInRight 0.6s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.login-form-wrap { 
  width: 100%; 
  max-width: 380px;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
}

.login-form-wrap h2 { 
  font-size: 1.4rem; 
  font-weight: 800; 
  color: var(--text-primary); 
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-form-wrap p { 
  color: var(--text-muted); 
  font-size: 0.85rem; 
  margin-bottom: 28px;
  line-height: 1.5;
}

.input-icon-wrap { 
  position: relative;
}

.input-icon-wrap i { 
  position: absolute; 
  left: 14px; 
  top: 50%; 
  transform: translateY(-50%); 
  color: var(--text-muted); 
  font-size: 0.9rem;
  transition: color 0.3s;
  z-index: 1;
}

.input-icon-wrap input { 
  padding-left: 42px;
}

.input-icon-wrap input[type="password"],
.input-icon-wrap input[type="text"] {
  padding-right: 42px;
}

/* Disable browser's default password reveal button */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}

input[type="password"]::-webkit-credentials-auto-fill-button,
input[type="password"]::-webkit-contacts-auto-fill-button {
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  right: 0;
}

.input-icon-wrap input:focus + i,
.input-icon-wrap:focus-within i { 
  color: var(--primary);
}

.form-group {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 30px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  transition: color 0.3s;
  z-index: 2;
  pointer-events: auto;
}

.password-toggle:hover {
  color: var(--primary);
}

/* ========================
   PAGE SECTION HELPERS
======================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ========================
   RESPONSIVE
======================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 190;
}

@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar { 
    transform: translateX(-100%); 
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  
  .page-grid-2 { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .leave-type-list { grid-template-columns: 1fr; }
  
  .topbar {
    padding: 0 16px;
    height: 56px;
  }
  
  .topbar-title h1 { font-size: 1rem; }
  .topbar-user-chip span { display: none; }
  .topbar-date { display: none; }
  
  .page-content { padding: 16px; }
  
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-bar select, .filter-bar input {
    width: 100%;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  table {
    font-size: 0.8rem;
  }
  
  th, td {
    padding: 8px 10px;
  }
  
  .btn {
    font-size: 0.8rem;
    padding: 8px 14px;
  }
  
  .btn-sm {
    font-size: 0.75rem;
    padding: 5px 10px;
  }
  
  /* Login page mobile */
  .login-left { display: none; }
  .login-right { 
    width: 100%; 
    min-width: 100%;
    padding: 24px;
  }
  
  .login-form-wrap {
    max-width: 100%;
    padding: 28px;
  }
}

@media (max-width: 600px) {
  .stats-grid { 
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    padding: 16px;
  }
  
  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  .stat-value {
    font-size: 1.3rem;
  }
  
  .page-content { 
    padding: 12px; 
  }
  
  .topbar { 
    padding: 0 12px;
    height: 52px;
  }
  
  .card {
    border-radius: var(--radius-sm);
  }
  
  .card-header, .card-body {
    padding: 14px;
  }
  
  .modal {
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius);
  }
  
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 600px;
  }
  
  .form-group label {
    font-size: 0.75rem;
  }
  
  input, select, textarea {
    font-size: 0.82rem;
    padding: 8px 10px;
  }
  
  .input-icon-wrap input {
    padding-left: 38px;
  }
  
  .input-icon-wrap i {
    left: 12px;
    font-size: 0.85rem;
  }
  
  .password-toggle {
    right: 12px;
    font-size: 0.85rem;
  }
  
  .login-form-wrap {
    padding: 24px;
  }
  
  .login-form-wrap h2 {
    font-size: 1.2rem;
  }
  
  .login-brand h1 {
    font-size: 2rem;
  }
  
  .login-brand-logo {
    width: 80px;
    height: 80px;
  }
}

@media (max-width: 400px) {
  .topbar-title h1 {
    font-size: 0.9rem;
  }
  
  .stat-value {
    font-size: 1.1rem;
  }
  
  .stat-label {
    font-size: 0.7rem;
  }
  
  .btn-lg {
    padding: 10px 18px;
    font-size: 0.85rem;
  }
}
