:root {
  --primary: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  --primary-dark: #3730a3;
  --secondary-gradient: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
  --sikma-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --logkom-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --admin-gradient: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  --bg-main: #f8fafc;
  --sidebar-bg: #0f172a;
  --card-bg: #ffffff;
  --border-color: #f1f5f9;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ANIMASI & TRANSISI */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseDotDanger {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.page-section {
  animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* LOGIN VIEW */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #1e1b4b 0%, #0f172a 60%, #020617 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, rgba(59, 130, 246, 0) 70%);
  top: -150px;
  right: -150px;
  border-radius: 50%;
}

.login-wrapper::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, rgba(59, 130, 246, 0) 70%);
  bottom: -150px;
  left: -150px;
  border-radius: 50%;
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  max-width: 480px;
  width: 100%;
  padding: 40px;
  position: relative;
  z-index: 10;
}

.login-icon-badge {
  background: var(--primary-gradient);
  color: #ffffff;
  width: 68px;
  height: 68px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.5);
  margin-bottom: 20px;
}

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

/* SIDEBAR */
.sidebar {
  width: 270px;
  background: var(--sidebar-bg);
  color: #f8fafc;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

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

.sidebar-menu {
  padding: 20px 14px;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #94a3b8;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.925rem;
  margin-bottom: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.nav-link-custom i {
  font-size: 1.15rem;
  transition: transform 0.2s ease;
}

.nav-link-custom:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.nav-link-custom:hover i {
  transform: scale(1.15);
}

.nav-link-custom.active {
  color: #ffffff;
  background: var(--primary-gradient);
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.35);
}

/* MAIN CONTENT AREA */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-main);
}

.topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 99;
}

.page-body {
  padding: 28px;
  flex-grow: 1;
}

/* CARDS & STATS */
.card-custom {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.card-custom:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.metric-card {
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #cbd5e1;
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

/* LAB & STATUS BADGES */
.badge-sikma {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.25);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-logkom {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.825rem;
  font-weight: 600;
}

.badge-aman {
  background-color: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-menipis {
  background-color: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.badge-habis {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.green {
  background-color: #10b981;
  animation: pulseDot 2s infinite;
}

.status-dot.amber {
  background-color: #f59e0b;
}

.status-dot.red {
  background-color: #ef4444;
  animation: pulseDotDanger 1.5s infinite;
}

/* TABLES */
.table-custom {
  margin-bottom: 0;
}

.table-custom th {
  background-color: #f8fafc;
  color: #475569;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.table-custom td {
  padding: 14px 18px;
  vertical-align: middle;
  font-size: 0.885rem;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  transition: background-color 0.15s ease;
}

.table-custom tbody tr:hover td {
  background-color: #f8fafc;
}

/* TOAST NOTIFICATION MODERN */
.toast-container-custom {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-modern {
  pointer-events: auto;
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 20px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 420px;
  border-left: 5px solid var(--primary);
  animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

.toast-modern.success { border-left-color: #10b981; }
.toast-modern.danger { border-left-color: #ef4444; }
.toast-modern.warning { border-left-color: #f59e0b; }

/* BUTTONS & CONTROLS */
.btn-primary {
  background: var(--primary-gradient);
  border: none;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #2563eb 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4);
}

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

.btn-xs {
  font-size: 0.75rem;
  padding: 3px 10px;
  line-height: 1.4;
}

.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* MODAL */
.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 14px 24px;
}

/* PRINT STYLES */
@media print {
  .sidebar, .topbar, .btn-action-no-print, .modal-backdrop, .modal, .toast-container-custom {
    display: none !important;
  }
  .app-container {
    display: block !important;
  }
  .page-body {
    padding: 0 !important;
  }
  .card-custom {
    border: none !important;
    box-shadow: none !important;
  }
  #print-area {
    display: block !important;
  }
}

/* MOBILE RESPONSIVE */
.btn-sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.4rem;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
}
.btn-sidebar-toggle:hover {
  background: rgba(0,0,0,0.06);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
  display: block;
}

.bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .login-card {
    padding: 28px 20px;
    border-radius: 20px;
  }

  .btn-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 30px rgba(0,0,0,0.35);
  }

  .main-content {
    width: 100%;
  }

  .topbar {
    padding: 10px 14px;
  }

  .page-body {
    padding: 14px;
    padding-bottom: 76px;
  }

  .card-custom {
    padding: 16px !important;
    margin-bottom: 14px;
  }

  .metric-card {
    padding: 16px;
  }

  .table-custom th {
    font-size: 0.7rem;
    padding: 10px 10px;
    white-space: nowrap;
  }
  .table-custom td {
    font-size: 0.8rem;
    padding: 10px 10px;
  }

  .toast-container-custom {
    top: auto;
    bottom: 80px;
    right: 12px;
    left: 12px;
  }
  .toast-modern {
    min-width: unset;
    max-width: 100%;
    font-size: 0.875rem;
    padding: 12px 14px;
  }

  .modal-dialog {
    margin: 0;
    max-width: 100%;
    vertical-align: bottom;
  }
  .modal.fade .modal-dialog {
    transform: translateY(40px);
  }
  .modal.show .modal-dialog {
    transform: translateY(0);
  }
  .modal-content {
    border-radius: 20px 20px 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    z-index: 998;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    align-items: stretch;
    justify-content: space-around;
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 2px;
    color: #94a3b8;
    font-size: 0.62rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
    padding: 6px 4px;
    transition: color 0.2s, background 0.2s;
    border-top: 3px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  .bottom-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 1px;
  }
  .bottom-nav-item.active {
    color: var(--primary);
    border-top-color: var(--primary);
  }
  .bottom-nav-item:active {
    background: rgba(79,70,229,0.06);
  }

  #topbar-lab-label {
    display: none !important;
  }

  .btn-sm {
    font-size: 0.82rem;
    padding: 7px 14px;
  }
}

@media (max-width: 400px) {
  .login-card {
    padding: 22px 16px;
  }
  .page-body {
    padding: 10px;
    padding-bottom: 76px;
  }
  .bottom-nav-item {
    font-size: 0.58rem;
  }
  .bottom-nav-item i {
    font-size: 1.15rem;
  }
}

/* Cegah Auto-Zoom di iOS Safari / Mobile Browser */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="time"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important;
  }
}


