/* ===========================
   LEAVEFLOW — MAIN STYLESHEET
   =========================== */

:root {
  --primary: #6c63ff;
  --primary-light: #8b85ff;
  --primary-dark: #5046e5;
  --accent: #ff6b9d;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --bg: #0f0f1a;
  --bg2: #161628;
  --bg3: #1e1e35;
  --bg4: #252540;
  --surface: #1e1e35;
  --surface2: #252540;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);

  --text: #f0f0ff;
  --text2: #a0a0c0;
  --text3: #6060a0;

  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-light); text-decoration: none; }
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}
img { max-width: 100%; }

/* ===========================
   LOGIN PAGE
   =========================== */
.login-page { overflow: hidden; }

.login-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: orbFloat 8s ease-in-out infinite;
}
.orb1 { width: 500px; height: 500px; background: #6c63ff; top: -200px; left: -100px; animation-delay: 0s; }
.orb2 { width: 400px; height: 400px; background: #ff6b9d; bottom: -150px; right: -100px; animation-delay: 3s; }
.orb3 { width: 300px; height: 300px; background: #10b981; top: 50%; left: 50%; animation-delay: 6s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(20px, -20px) scale(1.05); }
}

.login-container {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 20px;
  gap: 48px;
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.login-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 32px;
}
.brand-name { font-size: 1.5rem; font-weight: 600; color: var(--text); }
.brand-sub { font-size: 0.8rem; color: var(--text2); }

.login-form-wrap h2 { font-size: 1.6rem; font-weight: 600; margin-bottom: 4px; }
.login-desc { color: var(--text2); margin-bottom: 28px; font-size: 0.9rem; }

.login-info {
  display: flex; flex-direction: column; gap: 16px;
  max-width: 320px;
}
.info-card {
  background: rgba(108,99,255,0.08);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: var(--radius);
  padding: 20px;
}
.info-icon { font-size: 1.8rem; margin-bottom: 8px; }
.info-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.info-card p { font-size: 0.82rem; color: var(--text2); line-height: 1.5; }

.login-footer { text-align: center; margin-top: 20px; color: var(--text2); font-size: 0.82rem; }

/* ===========================
   LAYOUT
   =========================== */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
.sidebar.open { transform: translateX(0); }
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 199; display: none;
}
.sidebar-overlay.show { display: block; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 16px;
  font-weight: 600; font-size: 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-close { 
  margin-left: auto; background: none; border: none; color: var(--text2); 
  cursor: pointer; font-size: 1rem; padding: 4px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-section-title {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text3); padding: 12px 10px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text2); cursor: pointer;
  transition: all 0.15s ease; font-size: 0.9rem;
  margin-bottom: 2px; user-select: none;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(108,99,255,0.15); color: var(--primary-light); }
.nav-item .nav-icon { width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--accent); color: #fff;
  border-radius: 20px; font-size: 0.7rem; padding: 1px 7px; font-weight: 600;
}

.sidebar-user {
  padding: 16px; border-top: 1px solid var(--border);
  font-size: 0.82rem;
}
.sidebar-user .user-info { display: flex; align-items: center; gap: 10px; }
.sidebar-user .user-name { font-weight: 600; font-size: 0.85rem; }
.sidebar-user .user-role { color: var(--text2); font-size: 0.75rem; }
.logout-btn {
  display: flex; align-items: center; gap: 6px;
  margin-top: 10px; color: var(--danger); cursor: pointer;
  font-size: 0.82rem; padding: 6px 0;
  background: none; border: none;
  transition: opacity 0.15s;
}
.logout-btn:hover { opacity: 0.8; }

@media (min-width: 900px) {
  .sidebar { transform: translateX(0); }
  .sidebar-close { display: none; }
  .main-layout { margin-left: var(--sidebar-w); }
  .hamburger { display: none !important; }
  .sidebar-overlay { display: none !important; }
}

.main-layout {
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin-left 0.25s ease;
}

.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px; gap: 12px;
  backdrop-filter: blur(12px);
}
.hamburger {
  display: flex; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text2); border-radius: 2px;
  transition: all 0.2s;
}
.topbar-title { font-weight: 600; font-size: 1rem; flex: 1; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: #fff; flex-shrink: 0;
  cursor: pointer;
}

.page-content {
  flex: 1;
  padding: 24px 20px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ===========================
   FORMS
   =========================== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 0.82rem; font-weight: 500;
  color: var(--text2); margin-bottom: 6px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type="text"], input[type="password"], input[type="date"],
input[type="number"], input[type="email"], select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-size: 0.9rem;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}
input::placeholder, textarea::placeholder { color: var(--text3); }
select option { background: var(--bg3); }
textarea { resize: vertical; min-height: 80px; }
.input-hint { font-size: 0.75rem; color: var(--text3); margin-top: 4px; display: block; }

/* ===========================
   BUTTONS
   =========================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 0.9rem;
  cursor: pointer; transition: all 0.15s ease;
  border: none; text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #0da372; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border2);
  color: var(--text2);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg3); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; }

/* ===========================
   CARDS & STATS
   =========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.stat-label { font-size: 0.78rem; color: var(--text2); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value {
  font-size: 2rem; font-weight: 700; margin: 6px 0 4px;
  font-family: 'DM Mono', monospace;
}
.stat-sub { font-size: 0.78rem; color: var(--text3); }
.stat-cl .stat-value { color: #6c63ff; }
.stat-sl .stat-value { color: #10b981; }
.stat-el .stat-value { color: #f59e0b; }
.stat-lwp .stat-value { color: #ef4444; }
.stat-total .stat-value { color: #3b82f6; }
.stat-pending .stat-value { color: #f59e0b; }

.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.card-title { font-weight: 600; font-size: 1rem; }

/* ===========================
   TABLES
   =========================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th {
  text-align: left; padding: 10px 14px;
  font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }
.table-empty { text-align: center; color: var(--text3); padding: 40px; font-size: 0.9rem; }

/* ===========================
   BADGES & STATUS
   =========================== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
  white-space: nowrap;
}
.badge-pending { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-approved { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-rejected { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-cl { background: rgba(108,99,255,0.15); color: #8b85ff; }
.badge-sl { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-el { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-lwp { background: rgba(239,68,68,0.15); color: #ef4444; }
.badge-compoff { background: rgba(59,130,246,0.15); color: #60a5fa; }

/* ===========================
   ALERTS
   =========================== */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.88rem; margin-bottom: 16px;
}
.alert-error { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-info { background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-header button {
  background: none; border: none; color: var(--text2);
  cursor: pointer; font-size: 1.1rem; padding: 4px;
}
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 0 24px 20px;
}

@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity:0; } to { transform: translateY(0); opacity:1; } }

/* ===========================
   LEAVE DAYS PREVIEW
   =========================== */
.leave-days-preview {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 0.88rem; margin-top: 8px;
}
.days-count { font-size: 1.4rem; font-weight: 700; color: var(--primary-light); font-family: 'DM Mono', monospace; }
.days-note { color: var(--text3); font-size: 0.78rem; }

/* ===========================
   SECTION TABS
   =========================== */
.tabs {
  display: flex; gap: 4px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 7px 16px; border-radius: 6px;
  font-size: 0.85rem; font-weight: 500;
  cursor: pointer; border: none;
  background: transparent; color: var(--text2);
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-btn.active { background: var(--bg2); color: var(--text); box-shadow: var(--shadow-sm); }
.tab-btn:hover:not(.active) { color: var(--text); }

/* ===========================
   CALENDAR / TEAM VIEW
   =========================== */
.team-calendar {
  display: grid; gap: 2px;
}
.cal-row {
  display: flex; align-items: center;
  gap: 8px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.cal-name { width: 160px; font-weight: 500; flex-shrink: 0; }
.cal-bar { flex: 1; height: 28px; border-radius: 4px; position: relative; }
.cal-leave-block {
  height: 100%; border-radius: 4px;
  display: flex; align-items: center;
  padding: 0 8px; font-size: 0.75rem; font-weight: 600;
  color: #fff; overflow: hidden; white-space: nowrap;
}

/* ===========================
   SEARCH & FILTERS
   =========================== */
.filters-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; align-items: center;
}
.filters-bar input, .filters-bar select {
  padding: 8px 12px; font-size: 0.85rem;
  background: var(--bg3);
}
.search-input { min-width: 200px; flex: 1; }

/* ===========================
   LOADING
   =========================== */
.loading-screen {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 20px; color: var(--text3);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center; padding: 50px 20px;
  color: var(--text3);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ===========================
   LEAVE REQUEST DETAIL CARD
   =========================== */
.leave-detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  font-size: 0.88rem;
}
.detail-item { display: flex; flex-direction: column; gap: 4px; }
.detail-label { font-size: 0.75rem; color: var(--text2); font-weight: 500; }
.detail-value { color: var(--text); font-weight: 500; }

/* ===========================
   HOLIDAY LIST
   =========================== */
.holiday-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.holiday-date {
  width: 54px; height: 54px; border-radius: 10px;
  background: var(--bg3); display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0; text-align: center;
}
.holiday-date .h-day { font-size: 1.3rem; font-weight: 700; line-height: 1; }
.holiday-date .h-mon { font-size: 0.7rem; color: var(--text2); font-weight: 500; margin-top: 2px; }
.holiday-name { flex: 1; font-weight: 500; }
.holiday-delete { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 1.1rem; padding: 4px; }
.holiday-delete:hover { color: var(--danger); }

/* ===========================
   PAGE SECTION HEADERS
   =========================== */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--text2); font-size: 0.9rem; }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .login-info { display: none; }
  .leave-detail-grid { grid-template-columns: 1fr; }
  .filters-bar { gap: 8px; }
  .tabs { gap: 2px; }
  .tab-btn { padding: 6px 12px; font-size: 0.78rem; }
}
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
}
