/* ============================================
   DOMPET PJLP - Main Stylesheet
   Modern & Elegant Mobile-First Design
   ============================================ */

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

:root {
  --primary: #1a3a5c;
  --primary-light: #2563a8;
  --primary-dark: #0f2340;
  --accent: #f59e0b;
  --accent-light: #fcd34d;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #1e293b;
  --gray: #64748b;
  --light-gray: #f1f5f9;
  --white: #ffffff;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-height: 68px;
  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: #f0f4f8;
  color: var(--dark);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 16px);
  -webkit-tap-highlight-color: transparent;
}

/* ---- HEADER ---- */
.app-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: white;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(26,58,92,0.4);
}

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

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(245,158,11,0.4);
}

.logo-text {
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.logo-sub {
  font-size: 10px;
  opacity: 0.8;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.realtime-clock {
  text-align: right;
}

.clock-time {
  font-family: var(--font-main);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
}

.clock-date {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
  font-weight: 500;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  padding: 8px 12px;
  border-radius: 40px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--dark);
  overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info-sm { flex: 1; }
.user-name-sm {
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  font-family: var(--font-main);
}

.user-role-sm { font-size: 10px; opacity: 0.75; }

/* ---- BOTTOM NAV ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
  z-index: 200;
  border-top: 1px solid var(--border);
  padding: 0 4px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 8px 4px;
  text-decoration: none;
  color: var(--gray);
  transition: all 0.2s ease;
  position: relative;
  border-radius: 12px;
  margin: 4px 2px;
}

.nav-item.active {
  color: var(--primary);
  background: rgba(26,58,92,0.08);
}

.nav-item.active .nav-icon { transform: translateY(-2px); }

.nav-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  font-family: var(--font-main);
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  background: var(--danger);
  color: white;
  font-size: 9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
}

/* ---- CARDS ---- */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- STAT CARDS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.green { background: rgba(16,185,129,0.12); }
.stat-icon.blue { background: rgba(59,130,246,0.12); }
.stat-icon.orange { background: rgba(245,158,11,0.12); }
.stat-icon.red { background: rgba(239,68,68,0.12); }
.stat-icon.purple { background: rgba(139,92,246,0.12); }

.stat-num {
  font-family: var(--font-main);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  color: var(--dark);
}

.stat-label {
  font-size: 12px;
  color: var(--gray);
  font-weight: 500;
  margin-top: 2px;
}

/* ---- ABSENSI BUTTONS ---- */
.absensi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.absensi-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  font-family: var(--font-main);
}

.absensi-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(0,0,0,0.1);
  transition: opacity 0.2s;
}

.absensi-btn:active::before { opacity: 1; }

.absensi-btn.hadir { background: linear-gradient(135deg, #059669, #10b981); color: white; }
.absensi-btn.pulang { background: linear-gradient(135deg, #2563eb, #3b82f6); color: white; }
.absensi-btn.piket { background: linear-gradient(135deg, #d97706, #f59e0b); color: white; }
.absensi-btn.lepas-piket { background: linear-gradient(135deg, #7c3aed, #8b5cf6); color: white; }
.absensi-btn.sakit { background: linear-gradient(135deg, #dc2626, #ef4444); color: white; }
.absensi-btn.izin { background: linear-gradient(135deg, #0891b2, #06b6d4); color: white; }
.absensi-btn.cuti { background: linear-gradient(135deg, #1e293b, #334155); color: white; }
.absensi-btn.libur { background: linear-gradient(135deg, #64748b, #94a3b8); color: white; }

.absensi-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.absensi-icon { font-size: 32px; }
.absensi-label { font-size: 14px; font-weight: 700; }
.absensi-sub { font-size: 11px; opacity: 0.85; font-weight: 400; font-family: var(--font-body); }

/* ---- FORMS ---- */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
  font-family: var(--font-main);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--dark);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,168,0.12);
}

.form-control::placeholder { color: #9ca3af; }

select.form-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-full { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-lg { padding: 16px 28px; font-size: 16px; }

.btn:active { transform: scale(0.97); }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th {
  background: var(--primary);
  color: white;
  padding: 10px 12px;
  text-align: left;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.table th:first-child { border-radius: 8px 0 0 0; }
.table th:last-child { border-radius: 0 8px 0 0; }

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--light-gray); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-main);
  letter-spacing: 0.3px;
}

.badge-success { background: rgba(16,185,129,0.12); color: #059669; }
.badge-danger { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-warning { background: rgba(245,158,11,0.12); color: #d97706; }
.badge-info { background: rgba(59,130,246,0.12); color: #2563eb; }
.badge-primary { background: rgba(26,58,92,0.1); color: var(--primary); }
.badge-secondary { background: rgba(100,116,139,0.12); color: var(--gray); }
.badge-dark { background: rgba(30,41,59,0.1); color: var(--dark); }
.badge-light { background: rgba(241,245,249,0.8); color: var(--gray); border: 1px solid var(--border); }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(3px);
}

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

.modal-box {
  background: white;
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 20px 32px;
  animation: slideUp 0.3s ease;
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-title {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---- ALERTS ---- */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid;
}

.alert-success { background: rgba(16,185,129,0.1); border-color: var(--success); color: #065f46; }
.alert-danger { background: rgba(239,68,68,0.1); border-color: var(--danger); color: #991b1b; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: var(--warning); color: #92400e; }
.alert-info { background: rgba(59,130,246,0.1); border-color: var(--info); color: #1e40af; }

/* ---- CAMERA ---- */
#cameraContainer {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: none;
  flex-direction: column;
}

#cameraContainer.show { display: flex; }

#videoPreview {
  width: 100%;
  flex: 1;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-controls {
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  background: #111;
}

.btn-capture {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: white;
  border: 4px solid rgba(255,255,255,0.5);
  cursor: pointer;
  transition: transform 0.1s;
  box-shadow: 0 0 0 6px rgba(255,255,255,0.15);
}

.btn-capture:active { transform: scale(0.9); }

.btn-camera-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 12px 20px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--font-main);
  font-weight: 600;
}

#capturedPhoto {
  display: none;
  width: 100%;
  flex: 1;
  object-fit: cover;
}

/* ---- LOGIN PAGE ---- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 40%, var(--primary-light) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: 40px;
}

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

.login-logo-icon {
  width: 80px;
  height: 80px;
  background: var(--accent);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 32px rgba(245,158,11,0.4);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(245,158,11,0.4); }
  50% { box-shadow: 0 8px 48px rgba(245,158,11,0.6); }
}

.login-logo h1 {
  font-family: var(--font-main);
  font-size: 28px;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}

.login-logo p {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
  font-weight: 400;
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-title {
  font-family: var(--font-main);
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 24px;
}

/* ---- PROGRESS BAR ---- */
.progress-bar {
  height: 8px;
  background: var(--light-gray);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.5s ease;
}

/* ---- CHIPS / TAGS ---- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-main);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}

.chip-outline {
  border-color: var(--border);
  background: transparent;
  color: var(--gray);
}

.chip-selected {
  border-color: var(--primary);
  background: rgba(26,58,92,0.08);
  color: var(--primary);
}

/* ---- ADMIN LAYOUT ---- */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 260px;
  background: var(--primary-dark);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  z-index: 300;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.admin-sidebar.collapsed { transform: translateX(-260px); }

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

.sidebar-nav { padding: 16px 12px; }

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-main);
  transition: all 0.2s;
  margin-bottom: 4px;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
  background: rgba(255,255,255,0.12);
  color: white;
}

.sidebar-nav-item.active {
  background: rgba(245,158,11,0.2);
  color: var(--accent-light);
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  padding: 12px 16px 8px;
}

.admin-main {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  background: #f0f4f8;
  transition: margin-left 0.3s;
}

.admin-main.full { margin-left: 0; }

.admin-topbar {
  background: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-content {
  padding: 24px;
  max-width: 1200px;
}

.page-title {
  font-family: var(--font-main);
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--gray);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-260px); }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 400px) {
  .absensi-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- UTILITIES ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray); font-size: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.fw-bold { font-weight: 700; font-family: var(--font-main); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.hidden { display: none !important; }

/* ---- SKELETON LOADER ---- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

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

/* Date picker chips for cuti */
.date-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(26,58,92,0.08);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-main);
}

.date-chip .remove {
  cursor: pointer;
  color: var(--danger);
  font-size: 14px;
  line-height: 1;
}

/* Floating action button */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + 20px);
  right: 20px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(245,158,11,0.4);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.fab:active { transform: scale(0.92); }

/* Kuota badge */
.kuota-card {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.kuota-card::after {
  content: '📅';
  position: absolute;
  right: -10px;
  bottom: -10px;
  font-size: 80px;
  opacity: 0.1;
}

.kuota-num {
  font-size: 40px;
  font-weight: 800;
  font-family: var(--font-main);
  line-height: 1;
}

.kuota-label { font-size: 13px; opacity: 0.8; margin-top: 4px; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 299;
  display: none;
}

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