/* =============================================
   SIPRESMIN - Sistem Presensi GPS
   MIN 1 Kota Malang
   Futuristic Green & White Theme
   ============================================= */

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

:root {
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;
  --green-neon: #00ff88;
  --green-glow: rgba(34, 197, 94, 0.3);

  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Card accent colors */
  --card-teal: linear-gradient(135deg, #0d9488, #0f766e);
  --card-violet: linear-gradient(135deg, #7c3aed, #6d28d9);
  --card-rose: linear-gradient(135deg, #e11d48, #be123c);
  --card-amber: linear-gradient(135deg, #d97706, #b45309);
  --card-cyan: linear-gradient(135deg, #0891b2, #0e7490);
  --card-green: linear-gradient(135deg, #16a34a, #15803d);
  --card-indigo: linear-gradient(135deg, #4f46e5, #4338ca);
  --card-pink: linear-gradient(135deg, #db2777, #be185d);

  --sidebar-width: 260px;
  --topbar-height: 64px;
  --border-radius: 16px;
  --border-radius-sm: 10px;
  --border-radius-lg: 24px;
  --transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 40px rgba(0,0,0,0.12), 0 8px 16px rgba(0,0,0,0.06);
  --shadow-green: 0 8px 24px rgba(22, 163, 74, 0.25);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  overflow-x: hidden;
  /* Safe area untuk iPhone notch & home bar */
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Sidebar safe area kiri */
.sidebar {
  padding-left: env(safe-area-inset-left, 0);
}

/* Tombol presensi lebih besar & mudah ditekan di HP */
@media (max-width: 768px) {
  .btn-presensi {
    min-height: 52px;
    font-size: 1rem;
    width: 100%;
    justify-content: center;
  }
  .presensi-time {
    font-size: 2.8rem;
  }
}

/* ===== MORPH ANIMATIONS ===== */
@keyframes morphBlob {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
  50% { border-radius: 50% 60% 30% 70% / 30% 40% 70% 60%; }
  75% { border-radius: 70% 30% 60% 40% / 40% 70% 30% 60%; }
}

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

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes morphCard {
  0%, 100% { border-radius: 16px; }
  50%       { border-radius: 24px 12px 24px 12px; }
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  50%       { box-shadow: 0 0 0 12px rgba(22, 163, 74, 0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes gpsRipple {
  0%   { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ===== PAGE TRANSITIONS ===== */
.page-enter {
  animation: fadeInUp 0.5s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.card-enter {
  animation: scaleIn 0.4s cubic-bezier(0.23, 1, 0.32, 1) both;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #14532d 100%);
  position: relative;
  overflow: hidden;
}

.login-bg-blob {
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(22,163,74,0.2), transparent 70%);
  animation: morphBlob 12s ease-in-out infinite;
  pointer-events: none;
}

.login-bg-blob:nth-child(1) { top: -100px; right: -100px; }
.login-bg-blob:nth-child(2) { bottom: -100px; left: -100px; animation-delay: -4s; }
.login-bg-blob:nth-child(3) { top: 40%; left: 30%; width: 300px; height: 300px; animation-delay: -8s; }

.login-card {
  background: rgba(255,255,255,0.97);
  border-radius: var(--border-radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(22, 163, 74, 0.1);
  animation: scaleIn 0.6s cubic-bezier(0.23, 1, 0.32, 1) both;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-circle {
  width: 80px;
  height: 80px;
  background: var(--card-green);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  margin-bottom: 16px;
  animation: float 4s ease-in-out infinite;
  box-shadow: var(--shadow-green);
}

.login-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius-sm);
  font-size: 0.93rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--green-500);
  background: white;
  box-shadow: 0 0 0 3px var(--green-glow);
}

.input-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 1.1rem;
  pointer-events: none;
}

.input-group .form-control {
  padding-left: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 0.93rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--card-green);
  color: white;
  box-shadow: var(--shadow-green);
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(22, 163, 74, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  background: transparent;
  color: var(--green-600);
  border: 2px solid var(--green-200);
}

.btn-outline:hover {
  background: var(--green-50);
  border-color: var(--green-500);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: 8px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1rem;
  border-radius: 14px;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 44px;
  height: 44px;
  background: var(--card-green);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
  animation: float 4s ease-in-out infinite;
  box-shadow: var(--shadow-green);
}

.sidebar-brand-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.68rem;
  color: var(--green-400);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  background: var(--card-violet);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--green-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--border-radius-sm);
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  position: relative;
  overflow: hidden;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--card-green);
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--border-radius-sm);
}

.nav-item:hover {
  color: white;
  transform: translateX(3px);
}

.nav-item:hover::before {
  opacity: 0.15;
}

.nav-item.active {
  background: var(--card-green);
  color: white;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.nav-item.active::before {
  opacity: 0;
}

.nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.nav-text {
  flex: 1;
  position: relative;
  z-index: 1;
}

.nav-badge {
  background: var(--card-rose);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  position: relative;
  z-index: 1;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ===== TOP BAR ===== */
.topbar {
  height: var(--topbar-height);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 900;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  flex: 1;
}

.topbar-date {
  font-size: 0.82rem;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-notif {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gray-100);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  font-size: 1.1rem;
  transition: var(--transition);
  position: relative;
}

.topbar-notif:hover {
  background: var(--green-50);
  color: var(--green-600);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid white;
}

.topbar-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--gray-100);
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  font-size: 1.2rem;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 28px;
  flex: 1;
  min-height: calc(100vh - var(--topbar-height));
}

/* ===== PAGE HEADER ===== */
.page-header {
  margin-bottom: 28px;
  animation: fadeInUp 0.5s ease both;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  border-radius: var(--border-radius);
  padding: 22px 24px;
  color: white;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  animation: fadeInUp 0.5s ease both;
}

.stat-card:nth-child(1) { background: var(--card-green); animation-delay: 0.05s; }
.stat-card:nth-child(2) { background: var(--card-cyan); animation-delay: 0.1s; }
.stat-card:nth-child(3) { background: var(--card-violet); animation-delay: 0.15s; }
.stat-card:nth-child(4) { background: var(--card-rose); animation-delay: 0.2s; }

.stat-card::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 120px;
  height: 120px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  transition: var(--transition);
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: -30px;
  right: 20px;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.07);
  border-radius: 50%;
}

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

.stat-card:hover::before {
  transform: scale(1.2);
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-desc {
  font-size: 0.78rem;
  opacity: 0.75;
}

.stat-icon {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 1.8rem;
  opacity: 0.3;
  z-index: 1;
}

/* ===== CONTENT CARD ===== */
.card {
  background: white;
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
  animation: fadeInUp 0.5s ease both;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

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

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-icon {
  width: 34px;
  height: 34px;
  background: var(--green-50);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-600);
  font-size: 1rem;
}

/* ===== GPS PRESENSI SECTION ===== */
.presensi-hero {
  background: linear-gradient(135deg, var(--gray-900) 0%, #14532d 100%);
  border-radius: var(--border-radius-lg);
  padding: 36px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  animation: fadeInUp 0.5s ease both;
}

.presensi-hero::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 50%;
  top: -80px;
  right: -80px;
  animation: morphBlob 15s ease-in-out infinite;
}

.presensi-time {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 4px;
}

.presensi-date-text {
  font-size: 0.95rem;
  opacity: 0.7;
  margin-bottom: 28px;
}

.gps-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 40px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 24px;
  transition: var(--transition);
}

.gps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #94a3b8;
  position: relative;
}

.gps-dot.active {
  background: var(--green-400);
  animation: pulse-green 2s ease-in-out infinite;
}

.gps-dot.active::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--green-400);
  animation: gpsRipple 2s ease-out infinite;
}

.presensi-btn-group {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-presensi {
  padding: 14px 28px;
  border: none;
  border-radius: 14px;
  font-size: 0.93rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-masuk {
  background: var(--green-500);
  color: white;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.btn-masuk:hover:not(:disabled) {
  background: var(--green-400);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.5);
}

.btn-pulang {
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
}

.btn-pulang:hover:not(:disabled) {
  background: rgba(255,255,255,0.25);
  transform: translateY(-2px);
}

.btn-presensi:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== GPS MAP ===== */
.gps-map-container {
  border-radius: var(--border-radius);
  overflow: hidden;
  height: 240px;
  background: var(--gray-100);
  position: relative;
  margin-bottom: 16px;
}

#map {
  width: 100%;
  height: 100%;
}

.map-overlay {
  position: absolute;
  top: 12px;
  right: 12px;
  background: white;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-700);
  box-shadow: var(--shadow);
  z-index: 999;
}

/* ===== TABLE ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

td {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.2s;
}

tr:hover td {
  background: var(--green-50);
}

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

/* ===== BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success { background: var(--green-100); color: var(--green-700); }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: var(--gray-100); color: var(--gray-600); }

/* ===== ALERT / TOAST ===== */
.alert {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 16px;
  animation: scaleIn 0.3s ease both;
  font-size: 0.9rem;
  font-weight: 500;
}

.alert-success {
  background: var(--green-50);
  border: 1px solid var(--green-200);
  color: var(--green-800);
  border-left: 4px solid var(--green-500);
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fed7aa;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--gray-900);
  color: white;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 0.87rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: fadeInRight 0.4s cubic-bezier(0.23, 1, 0.32, 1) both;
  pointer-events: all;
  max-width: 360px;
  border-left: 4px solid var(--green-500);
}

.toast.error { border-left-color: #ef4444; }
.toast.warning { border-left-color: #f59e0b; }

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ===== CHART ===== */
.chart-container {
  position: relative;
  height: 280px;
}

/* ===== FORM ===== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ===== TABS ===== */
.tab-nav {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  border-radius: var(--border-radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--gray-500);
  background: transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.tab-btn.active {
  background: white;
  color: var(--green-700);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
  animation: fadeInUp 0.4s ease both;
}

.tab-content.active {
  display: block;
}

/* ===== GRID LAYOUTS ===== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

/* ===== ATTENDANCE TIMELINE ===== */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--green-400), var(--gray-200));
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
  animation: fadeInLeft 0.4s ease both;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green-500);
  border: 3px solid white;
  box-shadow: 0 0 0 3px var(--green-200);
}

.timeline-dot.pulang {
  background: var(--card-cyan);
  box-shadow: 0 0 0 3px #cffafe;
}

.timeline-content {
  background: var(--gray-50);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--gray-100);
}

.timeline-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.timeline-time {
  font-size: 0.78rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== ADMIN GPS SETTINGS ===== */
.gps-settings-map {
  height: 320px;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 2px solid var(--green-200);
}

/* ===== LOADING ===== */
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== OVERLAY ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeInUp 0.3s ease both;
  backdrop-filter: blur(4px);
}

.modal {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 500px;
  animation: scaleIn 0.4s cubic-bezier(0.23, 1, 0.32, 1) both;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-900);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--gray-100);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-size: 1.2rem;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--gray-200);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ===== SIDEBAR TOGGLE / RESPONSIVE ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.3);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
  }

  .sidebar-overlay.visible {
    display: block;
  }

  .topbar {
    left: 0;
  }

  .topbar-menu-btn {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .presensi-time { font-size: 2.5rem; }
  .presensi-hero { padding: 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .presensi-btn-group { flex-direction: column; }
  .btn-presensi { justify-content: center; }
  .tab-nav { flex-wrap: wrap; }
}

/* ===== PRINT ===== */
@media print {
  .sidebar, .topbar { display: none !important; }
  .main-content { margin: 0; padding: 0; }
}
