/* ============================================================
   SIMKOPMU PWA ABSENSI - ULTRALIGHT MOBILE STYLESHEET
   Warna Utama: Sea Blue (#006994), Navy Dark (#0f172a), Sky Accent (#38bdf8)
   ============================================================ */

:root {
  --primary: #006994;
  --primary-dark: #004a69;
  --primary-light: #e0f2fe;
  --accent: #38bdf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #0f172a;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow: 0 4px 16px rgba(0, 105, 148, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  background-color: #f1f5f9;
  color: var(--text-main);
  line-height: 1.5;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

/* Container Mobile App */
.pwa-app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);
  padding-bottom: 74px; /* Space untuk bottom navigation */
}

/* Header Top */
.pwa-header {
  background: linear-gradient(135deg, var(--dark) 0%, var(--primary) 100%);
  color: #ffffff;
  padding: 1.25rem 1.25rem 1.5rem;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 8px 24px rgba(0, 105, 148, 0.18);
}

.pwa-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.pwa-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
}

.pwa-logo i {
  color: var(--accent);
}

.pwa-net-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
}

.dot-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
}
.dot-status.offline {
  background-color: var(--danger);
}

.pwa-user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pwa-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.2rem;
  font-weight: bold;
  border: 2px solid var(--accent);
  overflow: hidden;
}

.pwa-user-info h3 {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
}

.pwa-user-info p {
  font-size: 0.8rem;
  opacity: 0.85;
}

/* Body Content */
.pwa-body {
  padding: 1.25rem;
  flex: 1;
}

/* Live Clock Card */
.clock-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  text-align: center;
  margin-top: -1.75rem;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}

.live-time {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--dark);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.live-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Shift Info Banner */
.shift-banner {
  margin-top: 1rem;
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.shift-banner strong {
  color: var(--primary-dark);
}

.shift-switch-wrapper {
  margin-top: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-shift-pill {
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn-shift-pill:hover {
  background: #f1f5f9;
}

.btn-shift-pill.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.3);
}

/* GPS Geolocation Banner */
.gps-banner {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  transition: all 0.3s ease;
}

.gps-banner.out-range {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.gps-banner.error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

/* Mode Tugas Lapangan (Dinas Luar) */
.toggle-field-mode {
  margin-top: 1rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--dark);
}

.field-note-input {
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
  font-family: inherit;
  resize: vertical;
}

.field-note-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 105, 148, 0.15);
}

/* Action Buttons (Masuk & Pulang) */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.25rem;
}

.btn-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 0.75rem;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

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

.btn-action-card.btn-masuk {
  background: linear-gradient(145deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.35);
}

.btn-action-card.btn-pulang {
  background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.35);
}

.btn-action-card.disabled {
  background: #cbd5e1;
  color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.75;
}

.btn-action-card i {
  font-size: 1.8rem;
}

.btn-action-card .badge-recorded {
  font-size: 0.75rem;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  margin-top: 0.2rem;
}

/* Stats Section */
.stats-container {
  margin-top: 1.5rem;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.stat-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.5rem;
  text-align: center;
}

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

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* History Mini List */
.history-list {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.history-date {
  font-weight: 600;
  color: var(--dark);
}

.history-time {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.status-chip {
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.status-chip.ontime { background: #dcfce7; color: #15803d; }
.status-chip.late { background: #fee2e2; color: #b91c1c; }
.status-chip.field { background: #e0f2fe; color: #0369a1; }

/* Bottom Navigation Bar */
.pwa-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
  z-index: 99;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

.nav-link-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.72rem;
  gap: 0.2rem;
  transition: color 0.15s ease;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-link-btn.active, .nav-link-btn:hover {
  color: var(--primary);
  font-weight: 600;
}

.nav-link-btn i {
  font-size: 1.25rem;
}

/* Modal Selfie Camera */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.camera-card {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.camera-header {
  padding: 1rem;
  background: var(--dark);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.camera-viewfinder {
  position: relative;
  width: 100%;
  height: 320px;
  background: #000000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-viewfinder video,
.camera-viewfinder canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.face-guide {
  position: absolute;
  width: 190px;
  height: 240px;
  border: 2px dashed rgba(56, 189, 248, 0.75);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.camera-footer {
  padding: 1rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.btn-capture {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  border: 4px solid #ffffff;
  outline: 3px solid var(--primary);
  color: #ffffff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 105, 148, 0.4);
  transition: transform 0.15s ease;
}

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

/* Modal Panduan Izin & PWA */
.perm-card {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
}

.perm-header {
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, #0f172a 0%, #006994 100%);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.perm-body {
  padding: 1.15rem;
  overflow-y: auto;
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.5;
}

.perm-tabs {
  display: flex;
  gap: 0.35rem;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 10px;
  margin-bottom: 1rem;
}

.perm-tab-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  background: none;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.perm-tab-btn.active {
  background: #ffffff;
  color: #006994;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.perm-tab-content {
  display: none;
}

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

.perm-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.perm-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.perm-step-text {
  flex: 1;
  font-size: 0.82rem;
}

.perm-footer {
  padding: 0.85rem 1.15rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 0.5rem;
}

