/* 
  =========================================
  Premium Dark Green UI Design System
  =========================================
*/

:root {
  /* Color Palette */
  --bg-color: #0b1411;
  --surface-color: rgba(22, 45, 38, 0.6);
  --surface-hover: rgba(30, 60, 50, 0.8);
  --primary-color: #00d27f;
  --primary-hover: #00e88c;
  --text-main: #e2f0ea;
  --text-muted: #9abfae;
  --border-color: rgba(0, 210, 127, 0.15);

  /* Status Colors */
  --status-verified: #00d27f;
  --status-absent: #ff4b4b;
  --status-leave: #ffc107;
  --status-pending: #0ea5e9;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(circle at 15% 50%, rgba(0, 210, 127, 0.05), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(0, 210, 127, 0.08), transparent 25%);
}

/* Glassmorphism Surface Utilities */
.glass-panel {
  background: var(--surface-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* =========================================
   NAVIGATION — Hamburger Mobile Menu
   =========================================/* Navigation */
.navbar {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-top: none;
  border-left: none;
  border-right: none;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  margin-right: auto; /* push everything else to the right */
}

/* hamburger button — hidden on desktop */
.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  line-height: 1;
  transition: background 0.2s;
  flex-shrink: 0;
  order: 3; /* always rightmost */
}

.nav-hamburger:hover {
  background: rgba(0, 210, 127, 0.1);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  order: 2;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-size: 0.9rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary-color);
  text-shadow: 0 0 10px rgba(0, 210, 127, 0.4);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  order: 4;
  font-size: 0.85rem;
}

/* =========================================
   LAYOUT
   ========================================= */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-family: var(--font-family);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #000;
  box-shadow: 0 4px 14px rgba(0, 210, 127, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 210, 127, 0.4);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-outline:hover {
  background-color: rgba(0, 210, 127, 0.1);
}

/* =========================================
   FORMS AND INPUTS
   ========================================= */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 210, 127, 0.2);
}

/* =========================================
   FILTER ROW (Attendance page)
   ========================================= */
.filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-row .form-control {
  width: auto;
  flex: 1 1 130px;
  min-width: 100px;
}

/* =========================================
   TABLES
   ========================================= */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  min-width: 480px; /* prevent collapse below readable width */
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 1rem;
  border-bottom: 1px solid rgba(0, 210, 127, 0.05);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: rgba(0, 210, 127, 0.03);
}

/* =========================================
   BADGES
   ========================================= */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: inline-block;
}

.badge-verified { background: rgba(0, 210, 127, 0.15); color: var(--status-verified); border: 1px solid rgba(0, 210, 127, 0.3); }
.badge-absent   { background: rgba(255, 75, 75, 0.15);  color: var(--status-absent);   border: 1px solid rgba(255, 75, 75, 0.3); }
.badge-on_leave { background: rgba(255, 193, 7, 0.15);  color: var(--status-leave);    border: 1px solid rgba(255, 193, 7, 0.3); }
.badge-pending  { background: rgba(14, 165, 233, 0.15); color: var(--status-pending);  border: 1px solid rgba(14, 165, 233, 0.3); }

/* =========================================
   DASHBOARD CARDS
   ========================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-title {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* =========================================
   MODALS
   ========================================= */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  padding: 2rem;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--text-main);
}

/* =========================================
   NOTIFICATIONS
   ========================================= */
.notification {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  left: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  background: var(--surface-color);
  border-left: 4px solid var(--primary-color);
  color: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  transform: translateY(120%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification.show {
  transform: translateY(0);
}

.notification.error {
  border-left-color: var(--status-absent);
}

/* =========================================
   UTILITIES
   ========================================= */
.hidden        { display: none !important; }
.text-center   { text-align: center; }
.mt-4          { margin-top: 1rem; }
.mb-4          { margin-bottom: 1rem; }
.flex          { display: flex; }
.gap-2         { gap: 0.5rem; }
.flex-wrap     { flex-wrap: wrap; }
/* =========================================
   RESPONSIVE — TABLET (≤ 960px)
   ========================================= */
@media (max-width: 960px) {
  .navbar {
    padding: 0.75rem 1.25rem;
  }
  .container {
    margin: 1.5rem auto;
    padding: 0 1rem;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================================
   RESPONSIVE — MOBILE (≤ 768px)
   ========================================= */
@media (max-width: 768px) {
  /* --- Nav: show hamburger, collapse links --- */
  .navbar {
    padding: 0.75rem 1rem;
  }

  .nav-hamburger {
    display: block;
  }

  /* nav-links hidden by default on mobile */
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    order: 10; /* below everything */
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.6rem 0.25rem;
    font-size: 0.95rem;
    width: 100%;
    border-bottom: 1px solid rgba(0, 210, 127, 0.05);
  }

  .nav-links a:last-child {
    border-bottom: none;
  }

  /* user-menu stacks below nav-links when open */
  .user-menu {
    font-size: 0.8rem;
  }

  .user-menu span {
    display: none; /* hide name on mobile to save space, only show logout */
  }

  /* --- Layout --- */
  .container {
    margin: 1rem auto;
    padding: 0 0.75rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 1.25rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  /* --- Stats Cards --- */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  /* --- Tables: compact, horizontal scroll --- */
  th, td {
    padding: 0.6rem 0.5rem;
    font-size: 0.82rem;
  }

  /* --- Buttons --- */
  .btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.875rem;
  }

  .flex.gap-2 {
    flex-wrap: wrap;
  }

  /* --- Filter row --- */
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-row .form-control {
    flex: 1 1 auto;
    width: 100%;
  }

  /* --- Modal: slide up from bottom --- */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content {
    padding: 1.5rem;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 85vh;
    transform: translateY(30px);
  }

  .modal-overlay.active .modal-content {
    transform: translateY(0);
  }

  /* --- Notification --- */
  .notification {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    max-width: 100%;
  }
  .glass-panel.table-wrapper,
  .glass-panel[style*="padding"] {
    border-radius: 12px;
  }
}