/* =====================================================================
   COLORIMETRIC ANALYZER - TEMA CERAH (PUTIH, BIRU, MERAH, KUNING)
   Modern, Ultra-Bright, High-Contrast Laboratory Palette
   ===================================================================== */

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

:root {
  /* PALET WARNA UTAMA: PUTIH, BIRU, MERAH, KUNING */
  --bg-main: #FFFFFF;
  --bg-page-subtle: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F0F7FF;
  --bg-surface: #FFFFFF;
  --bg-modal: #FFFFFF;

  /* BIRU (ROYAL & NAVY) */
  --color-blue-dark: #1E3A8A;
  --color-blue-primary: #2563EB;
  --color-blue-hover: #1D4ED8;
  --color-blue-light: #EFF6FF;
  --color-blue-border: #BFDBFE;
  --accent-blue: #2563EB;
  --accent-cyan: #0284C7;

  /* MERAH (CRIMSON & DANGER) */
  --color-red-primary: #DC2626;
  --color-red-hover: #B91C1C;
  --color-red-light: #FEF2F2;
  --color-red-border: #FECACA;
  --accent-red: #DC2626;

  /* KUNING (GOLD & AMBER) */
  --color-yellow-primary: #F59E0B;
  --color-yellow-hover: #D97706;
  --color-yellow-light: #FEF9C3;
  --color-yellow-border: #FDE047;
  --color-yellow-bright: #FACC15;
  --accent-amber: #D97706;
  --accent-green: #059669;

  /* TIPOGRAFI TERANG & TEGAS */
  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --text-blue: #1E40AF;

  --border-subtle: #E2E8F0;
  --border-card: #E2E8F0;
  --border-focus: #2563EB;

  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-elevation: 0 10px 20px -3px rgba(37, 99, 235, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: var(--font-main);
  background-color: #FFFFFF;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 10% 5%, rgba(37, 99, 235, 0.04) 0%, transparent 45%),
    radial-gradient(circle at 90% 95%, rgba(245, 158, 11, 0.04) 0%, transparent 45%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Scrollbar kustom */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: #F8FAFC;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* Top Navigation Bar: ROYAL BLUE DENGAN AKSEN KUNING EMAS */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 100%);
  border-bottom: 3px solid #F59E0B; /* Garis Aksen Kuning Emas */
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.2);
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: #FACC15; /* Kuning Cerah */
  color: #1E3A8A; /* Teks Biru Tua */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.25rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.1;
  color: #FFFFFF; /* Putih Bersih */
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 0.74rem;
  color: #FEF08A; /* Kuning Lembut */
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-link {
  color: #DBEAFE; /* Putih Kebiruan */
  text-decoration: none;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.15);
}

.nav-link.active {
  color: #1E3A8A;
  background: #FEF08A; /* Pill Kuning Terang Aktif */
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* User & Logout */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: #FFFFFF;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.18);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
}

/* Telemetry Widget in Nav */
.device-telemetry-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #FFFFFF;
  border: 1px solid #BFDBFE;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  display: inline-block;
  animation: pulse 2.5s infinite;
}

.status-dot.offline {
  background: #94A3B8;
  box-shadow: none;
  animation: none;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Container */
.container {
  max-width: 1360px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

/* Cards */
.card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: #BFDBFE;
  box-shadow: var(--shadow-elevation);
}

.card-header {
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1E3A8A; /* Navy Blue */
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.25rem;
  background: #FFFFFF;
}

/* Metric Stats Row (Putih dengan aksen Biru, Kuning, Merah) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card:nth-child(1) {
  border-top: 4px solid #2563EB; /* Aksen Biru */
}
.stat-card:nth-child(2) {
  border-top: 4px solid #F59E0B; /* Aksen Kuning Emas */
}
.stat-card:nth-child(3) {
  border-top: 4px solid #1E3A8A; /* Aksen Navy Blue */
}
.stat-card:nth-child(4) {
  border-top: 4px solid #DC2626; /* Aksen Merah */
}

.stat-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: #0F172A;
  margin-top: 0.35rem;
  line-height: 1.2;
}

.stat-sub {
  font-size: 0.78rem;
  color: #64748B;
  margin-top: 0.3rem;
}

/* Charts Layout Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 960px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.canvas-container {
  width: 100%;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
}

canvas {
  display: block;
  width: 100%;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: #FFFFFF;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
  background: #FFFFFF;
}

.table th {
  background: #F0F7FF; /* Biru Sangat Lembut */
  color: #1E3A8A; /* Navy Blue */
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.85rem 1rem;
  border-bottom: 2px solid #BFDBFE;
  white-space: nowrap;
}

.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #E2E8F0;
  color: #0F172A;
  vertical-align: middle;
  background: #FFFFFF;
}

.table tbody tr {
  transition: background 0.15s ease;
}

.table tbody tr:hover td {
  background: #F8FAFC !important;
}

.table tbody tr.selected td {
  background: #EFF6FF !important; /* Highlight Biru Terpilih */
}

/* Swatch Color Preview Pill */
.color-swatch-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.6rem 0.25rem 0.35rem;
  border-radius: var(--radius-full);
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #0F172A;
}

.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

/* Buttons (Putih, Biru, Merah, Kuning) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

/* BIRU (Primary) */
.btn-primary {
  background: #2563EB;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: #1D4ED8;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

/* PUTIH (Secondary) */
.btn-secondary {
  background: #FFFFFF;
  color: #1E3A8A;
  border: 1px solid #CBD5E1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn-secondary:hover {
  background: #F0F7FF;
  border-color: #2563EB;
  color: #2563EB;
}

/* MERAH (Danger) */
.btn-danger {
  background: #DC2626;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.25);
}
.btn-danger:hover {
  background: #B91C1C;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.35);
}

/* KUNING (Warning / Highlight) */
.btn-warning, .btn-yellow {
  background: #F59E0B;
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover, .btn-yellow:hover {
  background: #D97706;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
}

.btn-success {
  background: #059669;
  color: #FFFFFF;
}
.btn-success:hover {
  background: #047857;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Badge Biru */
.badge-blue {
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

/* Badge Merah */
.badge-red, .badge-danger {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

/* Badge Kuning */
.badge-amber, .badge-warning, .badge-yellow {
  background: #FEF9C3;
  color: #A16207;
  border: 1px solid #FDE047;
}

/* Badge Hijau */
.badge-green, .badge-success {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

/* Alerts */
.alert {
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.5;
  font-weight: 500;
}

.alert-success {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.alert-danger {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.alert-warning {
  background: #FEF9C3;
  color: #A16207;
  border: 1px solid #FDE047;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.95rem;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: var(--radius-sm);
  color: #0F172A;
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Floating Bulk Action Bar (Merah & Putih) */
.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #FFFFFF;
  border: 2px solid #2563EB; /* Border Biru Tegas */
  border-radius: var(--radius-full);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  padding: 0.65rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bulk-bar.visible {
  transform: translateX(-50%) translateY(0);
}

.bulk-text {
  font-weight: 700;
  font-size: 0.9rem;
  color: #1E3A8A;
}

/* Checkbox styling */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2563EB;
  border-radius: 4px;
}

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

.modal-backdrop.active {
  display: flex;
}

.modal-content {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid #E2E8F0;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Komparasi Swatch */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .compare-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.compare-swatch {
  height: 160px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  position: relative;
  box-shadow: var(--shadow-card);
  border: 2px solid #E2E8F0;
}

.vs-badge {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid #2563EB;
  color: #2563EB;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: var(--shadow-card);
  margin: 0 auto;
}

/* Print CSS */
@media print {
  .navbar, .btn, .nav-links, .bulk-bar, #app-toast-box {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
  }
  .card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
}
