/* =============================================
   LAPAS BANDANAIRA - Global Styles
   ============================================= */

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

:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(30,64,175,0.08);
  --shadow-lg: 0 8px 40px rgba(30,64,175,0.12);
}

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

body {
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  background: #f0f4ff;
  color: #1e293b;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- SPLASH SCREEN ---- */
#splashScreen {
  position: fixed; inset: 0; z-index: 99999;
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
#splashScreen.hiding {
  opacity: 0; transform: scale(1.05); pointer-events: none;
}
.splash-logo-ring {
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  animation: splashPulse 2s ease infinite;
  margin-bottom: 24px;
}
.splash-logo-inner {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.splash-title {
  color: white; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; text-align: center; line-height: 1.2;
}
.splash-subtitle {
  color: rgba(255,255,255,0.7); font-size: 13px; margin-top: 6px; text-align: center;
}
.splash-loader {
  margin-top: 40px; width: 160px; height: 3px; background: rgba(255,255,255,0.15); border-radius: 100px; overflow: hidden;
}
.splash-loader-bar {
  height: 100%; background: rgba(255,255,255,0.8); border-radius: 100px;
  animation: splashLoad 1.8s ease forwards;
}
@keyframes splashPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
@keyframes splashLoad {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 60%, #1d4ed8 100%);
  z-index: 100; display: flex; flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 4px 0 24px rgba(30,64,175,0.2);
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-brand-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0; overflow: hidden;
}
.sidebar-brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-brand-text { min-width: 0; }
.sidebar-brand-name {
  color: white; font-size: 13px; font-weight: 800;
  line-height: 1.2; letter-spacing: -0.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand-sub {
  color: rgba(255,255,255,0.6); font-size: 10px; margin-top: 1px;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-section { margin-bottom: 20px; }
.nav-section-title {
  font-size: 9px; font-weight: 700; letter-spacing: 1.2px;
  color: rgba(255,255,255,0.4); text-transform: uppercase;
  padding: 0 10px; margin-bottom: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  cursor: pointer; transition: all 0.2s;
  color: rgba(255,255,255,0.7); text-decoration: none;
  font-size: 13px; font-weight: 500;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active {
  background: rgba(255,255,255,0.18);
  color: white; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.nav-item .nav-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-item.active .nav-icon { background: rgba(255,255,255,0.2); }
.nav-item .nav-icon svg { width: 16px; height: 16px; }
.sidebar-footer {
  padding: 12px 10px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ---- MAIN CONTENT ---- */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin 0.3s;
}
.top-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(240,244,255,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(30,64,175,0.1);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.header-title { font-size: 16px; font-weight: 700; color: #1e293b; }
.header-subtitle { font-size: 11px; color: #94a3b8; font-weight: 400; }
.header-user {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  background: white; border-radius: 50px;
  border: 1px solid rgba(30,64,175,0.12);
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(30,64,175,0.06);
}
.header-user:hover { box-shadow: 0 4px 16px rgba(30,64,175,0.12); }
.header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
  overflow: hidden;
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.header-uname { font-size: 12px; font-weight: 600; color: #1e293b; }
.header-role { font-size: 10px; color: #94a3b8; }

.content-area { padding: 24px; }
.page-section { display: none; }
.page-section.active { display: block; }

/* ---- CARDS ---- */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(30,64,175,0.06);
  overflow: hidden;
}
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #fafbff, #f0f4ff);
}
.card-title { font-size: 15px; font-weight: 700; color: #1e293b; }
.card-body { padding: 20px; }

/* ---- STAT CARDS ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: white; border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid rgba(30,64,175,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-card .stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-size: 28px; font-weight: 800; color: #1e293b; line-height: 1; }
.stat-label { font-size: 12px; color: #94a3b8; margin-top: 4px; font-weight: 500; }
.stat-bg {
  position: absolute; right: -16px; bottom: -16px;
  width: 80px; height: 80px; border-radius: 50%;
  opacity: 0.06;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.2s; text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  color: white; box-shadow: 0 4px 12px rgba(59,130,246,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.45); }
.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(16,185,129,0.4); }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white; box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}
.btn-danger:hover { transform: translateY(-1px); }
.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white; box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}
.btn-warning:hover { transform: translateY(-1px); }
.btn-ghost {
  background: #f1f5f9; color: #64748b;
}
.btn-ghost:hover { background: #e2e8f0; color: #1e293b; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: 10px; }

/* ---- TABLES ---- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 11px 14px; text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: #64748b;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbff; }
.table-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  overflow: hidden; flex-shrink: 0;
}
.table-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 1.5px solid #e2e8f0; background: white;
  font-size: 13px; color: #1e293b; font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-control:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-control::placeholder { color: #94a3b8; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; opacity: 0; transition: opacity 0.3s;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: white; border-radius: 24px;
  max-width: 540px; width: 100%; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 24px 64px rgba(0,0,0,0.2);
  transform: translateY(20px) scale(0.97);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: white; z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 800; color: #1e293b; }
.modal-close {
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #f1f5f9; border: none; cursor: pointer; color: #94a3b8;
  transition: all 0.2s;
}
.modal-close:hover { background: #fee2e2; color: #ef4444; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #f1f5f9;
  display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0; background: white;
}

/* ---- SEARCH & FILTER BAR ---- */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; padding: 14px 20px;
  background: #fafbff; border-bottom: 1px solid #f1f5f9;
}
.search-input {
  position: relative; flex: 1; min-width: 180px;
}
.search-input input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 13px; background: white; font-family: inherit;
  color: #1e293b; outline: none; transition: border-color 0.2s;
}
.search-input input:focus { border-color: #3b82f6; }
.search-input svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: #94a3b8;
}

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center;
}
.empty-icon {
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.empty-icon svg { width: 32px; height: 32px; color: #3b82f6; opacity: 0.6; }
.empty-title { font-size: 15px; font-weight: 700; color: #374151; margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: #94a3b8; max-width: 280px; line-height: 1.5; }

/* ---- PHOTO UPLOAD ---- */
.photo-upload {
  width: 100%; aspect-ratio: 1;
  border: 2px dashed #d1d5db; border-radius: 16px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
  background: #fafbff; position: relative; overflow: hidden;
}
.photo-upload:hover { border-color: #3b82f6; background: #eff6ff; }
.photo-upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-upload-overlay {
  position: absolute; inset: 0;
  background: rgba(30,64,175,0.5);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
  backdrop-filter: blur(2px);
}
.photo-upload:hover .photo-upload-overlay { opacity: 1; }

/* ---- TOGGLE SWITCH ---- */
.toggle {
  position: relative; width: 42px; height: 24px; cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 100px;
  background: #d1d5db; transition: all 0.3s;
}
.toggle-slider::before {
  content: ''; position: absolute; height: 18px; width: 18px;
  left: 3px; top: 3px; border-radius: 50%;
  background: white; transition: all 0.3s; box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider { background: #3b82f6; }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ---- FOOTER ---- */
.app-footer {
  text-align: center; padding: 16px 20px;
  font-size: 11px; color: #94a3b8;
  border-top: 1px solid #e2e8f0; margin-top: 24px;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.app-footer a { color: #3b82f6; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.app-footer a:hover { text-decoration: underline; }
.social-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; text-decoration: none;
  transition: all 0.2s;
}
.ig-link { background: #fce7f3; color: #be185d; }
.ig-link:hover { background: #fbcfe8; }
.tt-link { background: #f0f9ff; color: #0369a1; }
.tt-link:hover { background: #e0f2fe; }

/* ---- MOBILE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .content-area { padding: 16px; }
  .mobile-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 99; display: none;
  }
  .mobile-overlay.show { display: block; }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease forwards; }

/* WBP CARD GRID */
.wbp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.wbp-card {
  background: white; border-radius: 16px;
  border: 2px solid transparent; cursor: pointer;
  transition: all 0.2s; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.wbp-card:hover { border-color: #3b82f6; transform: translateY(-2px); }
.wbp-card.hadir { border-color: #10b981; background: #f0fdf4; }
.wbp-card.tidak-hadir { border-color: #ef4444; background: #fef2f2; }
.wbp-card-photo {
  width: 100%; aspect-ratio: 3/4;
  background: linear-gradient(135deg, #dbeafe, #e0e7ff);
  position: relative; overflow: hidden;
}
.wbp-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.wbp-card-info { padding: 10px 12px 12px; }
.wbp-card-name { font-size: 12px; font-weight: 700; color: #1e293b; line-height: 1.3; }
.wbp-card-noreg { font-size: 10px; color: #94a3b8; margin-top: 2px; }
.wbp-card-status {
  margin-top: 8px; display: flex; gap: 4px;
}
.wbp-card-status button {
  flex: 1; padding: 5px; font-size: 10px; font-weight: 600;
  border: none; border-radius: 7px; cursor: pointer; transition: all 0.15s;
}
.btn-hadir { background: #d1fae5; color: #065f46; }
.btn-hadir.active, .btn-hadir:hover { background: #10b981; color: white; }
.btn-tidak { background: #fee2e2; color: #991b1b; }
.btn-tidak.active, .btn-tidak:hover { background: #ef4444; color: white; }

/* BLOK SELECTOR */
.blok-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.blok-card {
  background: white; border-radius: 14px;
  padding: 16px 12px; text-align: center;
  border: 2px solid #e2e8f0; cursor: pointer;
  transition: all 0.2s; box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.blok-card:hover:not(.disabled) { border-color: #3b82f6; background: #eff6ff; }
.blok-card.selected { border-color: #3b82f6; background: #eff6ff; box-shadow: 0 0 0 4px rgba(59,130,246,0.1); }
.blok-card.disabled { opacity: 0.5; cursor: not-allowed; background: #f9fafb; }
.blok-card.in-use { border-color: #f59e0b; background: #fffbeb; }
.blok-icon { font-size: 28px; margin-bottom: 8px; }
.blok-name { font-size: 13px; font-weight: 700; color: #1e293b; }
.blok-count { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.blok-user { font-size: 10px; color: #f59e0b; font-weight: 600; margin-top: 3px; }

/* LOGIN PAGE */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute;
  width: 500px; height: 500px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
  top: -150px; right: -150px;
}
.login-page::after {
  content: ''; position: absolute;
  width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,0.03);
  bottom: -100px; left: -100px;
}
.login-card {
  background: white; border-radius: 28px;
  padding: 40px 36px; max-width: 420px; width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,0.2);
  position: relative; z-index: 1;
}
.login-logo {
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, #3b82f6, #1e40af);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(59,130,246,0.3);
}
.login-logo img { width: 100%; height: 100%; object-fit: cover; }
.login-logo-placeholder { font-size: 32px; }

/* PROFILE PAGE */
.profile-header {
  background: linear-gradient(135deg, #1e3a8a, #3b82f6);
  border-radius: 20px; padding: 28px;
  display: flex; align-items: center; gap: 20px;
  color: white; margin-bottom: 20px;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 20px;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
