/**
 * NAVISEA ENTERPRISE DESIGN SYSTEM (V4.1 DISCIPLINED SPECIFICATION)
 * 60-30-10 Strict Rule | WCAG AAA Contrast | 4-Tier Button Hierarchy | Mobile & Tablet Standard
 */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:root {
  /* =========================================================================
     1. COLOR SYSTEM (60-30-10 STRICT DISCIPLINE - NO MORE RAINBOWS)
     ========================================================================= */
  /* 60% Surfaces & Foundations */
  --ns-canvas: #f8fafc;             /* Crisp Slate-50: Latar belakang seluruh halaman */
  --ns-surface: #ffffff;            /* Pure White: Seluruh kartu, panel modal, dan tabel */
  --ns-surface-subtle: #f1f5f9;     /* Slate-100: Container toolbar & background netral */
  
  /* 30% Typography & Structures */
  --ns-border: #e2e8f0;             /* Slate-200: Garis pembatas kartu & pemisah */
  --ns-border-strong: #cbd5e1;      /* Slate-300: Garis tepi tombol sekunder & form input */
  --ns-border-focus: #1d4ed8;       /* Blue-700: Ring fokus saat diklik */

  --ns-text-title: #0f172a;         /* Slate-900: Judul utama, nama kandidat (Kontras 19.8:1 - AAA) */
  --ns-text-body: #334155;          /* Slate-700: Isi teks, deskripsi form, tabel (Kontras 9.5:1 - AAA) */
  --ns-text-muted: #475569;         /* Slate-600: Keterangan waktu, label metadata (Kontras 7.0:1 - AAA) */
  --ns-text-disabled: #94a3b8;      /* Slate-400: Placeholder & kontrol nonaktif */

  /* 10% Single Accent - Maritime Royal Blue */
  --ns-primary: #1d4ed8;            /* Blue-700: SATU-SATUNYA warna aksi utama platform */
  --ns-primary-hover: #1e40af;      /* Blue-800: Hover tombol utama */
  --ns-primary-subtle: #eff6ff;     /* Blue-50: Latar tab aktif & aksen lembut */
  --ns-primary-border: #bfdbfe;     /* Blue-200: Border aksen lembut */

  /* Semantic Status Indicators (HANYA 1% - Khusus status kritis, bukan tombol!) */
  --ns-status-success-text: #065f46;  --ns-status-success-bg: #ecfdf5;  --ns-status-success-border: #a7f3d0;
  --ns-status-warning-text: #92400e;  --ns-status-warning-bg: #fffbeb;  --ns-status-warning-border: #fde68a;
  --ns-status-danger-text: #991b1b;   --ns-status-danger-bg: #fef2f2;   --ns-status-danger-border: #fecaca;

  /* =========================================================================
     2. GEOMETRY & RADIUS (Router = Rinner + Padding)
     ========================================================================= */
  --ns-radius-outer: 1.5rem;        /* 24px (rounded-3xl): Bingkai Kartu Utama */
  --ns-radius-inner: 1rem;          /* 16px (rounded-2xl): Sub-panel dalam kartu */
  --ns-radius-control: 0.75rem;     /* 12px (rounded-xl): Tombol & Kolom Input */
  --ns-radius-pill: 9999px;         /* rounded-full: Status badge & avatar */

  /* =========================================================================
     3. TOUCH TARGET & CONTROL SIZES (WCAG Mobile Standard)
     ========================================================================= */
  --ns-h-desktop: 2.5rem;           /* 40px: Standar Desktop & Tablet */
  --ns-h-mobile: 2.75rem;           /* 44px: Standar Jempol Mobile */
  --ns-icon-size: 1rem;             /* 16px: Ikon standar tombol */

  /* =========================================================================
     3.1 SHADOW SPECIFICATION (CRISP LIGHT MARITIME ELEVATION)
     ========================================================================= */
  --ns-shadow-2xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --ns-shadow-xs:  0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --ns-shadow-sm:  0 2px 4px -1px rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --ns-shadow-md:  0 4px 10px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --ns-shadow-lg:  0 10px 18px -3px rgba(15, 23, 42, 0.09), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --ns-shadow-xl:  0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  --ns-shadow-2xl: 0 25px 50px -12px rgba(15, 23, 42, 0.18);
  --ns-shadow-card: var(--ns-shadow-xs);
  --ns-shadow-card-hover: 0 10px 20px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);

  /* =========================================================================
     3.2 BLUR & BACKDROP FILTER SPECIFICATION
     ========================================================================= */
  --ns-blur-subtle: blur(4px);
  --ns-blur-header: blur(8px);
  --ns-blur-modal:  blur(6px);

  /* =========================================================================
     3.3 TRANSITION & HOVER TIMING
     ========================================================================= */
  --ns-ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ns-transition-fast: 150ms ease-in-out;
  --ns-transition-normal: 200ms var(--ns-ease-spring);
}

/* =========================================================================
   4. STRICT 4-TIER BUTTON HIERARCHY
   ========================================================================= */
.ns-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;                      /* 8px optical gap */
  height: var(--ns-h-desktop);
  padding: 0 1rem;
  border-radius: var(--ns-radius-control);
  font-size: 0.8125rem;             /* 13px */
  font-weight: 700;
  line-height: 1;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  text-decoration: none !important;
}

.ns-btn:active {
  transform: scale(0.98);
}

/* TIER 1: PRIMARY CTA (Maksimal 1 per viewport/kartu) */
.ns-btn-primary {
  background-color: var(--ns-primary) !important;
  color: #ffffff !important;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px 0 rgba(29, 78, 216, 0.2);
}
.ns-btn-primary:hover {
  background-color: var(--ns-primary-hover) !important;
}

/* TIER 2: SECONDARY OUTLINE (Untuk aksi alternatif) */
.ns-btn-secondary {
  background-color: #ffffff !important;
  color: var(--ns-text-title) !important;
  border: 1px solid var(--ns-border-strong) !important;
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.04);
}
.ns-btn-secondary:hover {
  background-color: var(--ns-canvas) !important;
  border-color: #94a3b8 !important;
}

/* TIER 3: GHOST / TERTIARY (Untuk aksi pembatalan / kembali) */
.ns-btn-ghost {
  background-color: transparent !important;
  color: var(--ns-text-muted) !important;
  border: 1px solid transparent !important;
}
.ns-btn-ghost:hover {
  background-color: var(--ns-surface-subtle) !important;
  color: var(--ns-text-title) !important;
}

/* TIER 4: DESTRUCTIVE (HANYA untuk hapus permanen / tolak) */
.ns-btn-destructive {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px 0 rgba(220, 38, 38, 0.2);
}
.ns-btn-destructive:hover {
  background-color: #b91c1c !important;
}

.ns-btn-destructive-soft {
  background-color: var(--ns-status-danger-bg) !important;
  color: var(--ns-status-danger-text) !important;
  border: 1px solid var(--ns-status-danger-border) !important;
}
.ns-btn-destructive-soft:hover {
  background-color: #fee2e2 !important;
}

/* Tombol Ikon Simetris Bujur Sangkar */
.ns-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ns-h-desktop);
  height: var(--ns-h-desktop);
  border-radius: var(--ns-radius-control);
  background-color: #ffffff;
  border: 1px solid var(--ns-border-strong);
  color: var(--ns-text-body);
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  flex-shrink: 0;
}
.ns-btn-icon:hover {
  background-color: var(--ns-canvas);
  color: var(--ns-text-title);
  border-color: #94a3b8;
}

/* =========================================================================
   5. RESPONSIVE BREAKPOINT RULES (TABLET & MOBILE)
   ========================================================================= */

/* Mobile Handphone (< 640px) */
@media (max-width: 639px) {
  /* Tombol membesar ke 44px untuk sentuhan jempol */
  .ns-btn {
    height: var(--ns-h-mobile);
    font-size: 0.875rem;            /* 14px */
  }

  /* Susunan tombol menumpuk vertikal di mobile */
  .ns-mobile-stack {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  .ns-mobile-stack > * {
    width: 100% !important;
  }

  /* Tab navigasi horizontal yang halus tanpa patah baris */
  .ns-tab-container-mobile {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;          /* Firefox */
    gap: 0.375rem !important;
  }
  .ns-tab-container-mobile::-webkit-scrollbar {
    display: none;                  /* Safari / Chrome */
  }
  .ns-tab-container-mobile > * {
    flex-shrink: 0 !important;
    min-width: auto;
    white-space: nowrap !important;
  }

  /* =========================================================================
     MODAL DIALOG MOBILE RESPONSIVE STANDARD (UI KIT V4.3)
     ========================================================================= */
  /* Overlay dengan padding aman di sisi layar HP */
  .ns-backdrop-overlay {
    padding: 0.75rem 0.5rem !important;
  }
  .ns-backdrop-overlay.hidden {
    display: none !important;
  }

  /* Kotak dialog modal responsif penuh */
  .ns-modal-box {
    margin: 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 1.25rem !important; /* rounded-2xl */
    box-sizing: border-box !important;
  }

  /* Penyesuaian padding internal modal di layar seluler kecil */
  .ns-modal-box.p-6,
  .ns-modal-box.p-7,
  .ns-modal-box.p-8,
  .ns-modal-box.p-5,
  .ns-modal-box > .p-6,
  .ns-modal-box > .p-7,
  .ns-modal-box > .p-8 {
    padding: 1rem !important; /* 16px standar nyaman */
  }

  /* Header modal mobile */
  .ns-modal-box > div:first-child[class*="border-b"],
  .ns-modal-box .modal-header {
    padding: 0.875rem 1rem !important;
    gap: 0.75rem !important;
  }

  /* Body scrollable modal mobile */
  .ns-modal-box > .overflow-y-auto,
  .ns-modal-box form.overflow-y-auto {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Footer tombol aksi menumpuk vertikal di mobile */
  .ns-modal-box .modal-footer,
  .ns-modal-box form > div[class*="border-t"],
  .ns-modal-box > div:last-child[class*="border-t"] {
    display: flex !important;
    flex-direction: column-reverse !important;
    width: 100% !important;
    gap: 0.5rem !important;
    padding: 0.875rem 1rem !important;
  }

  .ns-modal-box .modal-footer > button,
  .ns-modal-box .modal-footer > a,
  .ns-modal-box form > div[class*="border-t"] > button,
  .ns-modal-box form > div[class*="border-t"] > a,
  .ns-modal-box > div:last-child[class*="border-t"] > button,
  .ns-modal-box > div:last-child[class*="border-t"] > a {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Form control mobile touch ergonomics */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  select,
  textarea {
    font-size: 0.875rem !important; /* 14px - cegah auto-zoom iOS Safari */
  }
}

/* Tablet (iPad 640px - 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
  .ns-tablet-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }
}

/* =========================================================================
   6. OPTICAL ALIGNMENT & STATUS BADGES
   ========================================================================= */
.ns-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--ns-radius-pill);
  font-size: 0.6875rem;             /* 11px */
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.ns-badge-active {
  background-color: var(--ns-status-success-bg);
  color: var(--ns-status-success-text);
  border: 1px solid var(--ns-status-success-border);
}

.ns-badge-pending {
  background-color: var(--ns-status-warning-bg);
  color: var(--ns-status-warning-text);
  border: 1px solid var(--ns-status-warning-border);
}

.ns-badge-danger {
  background-color: var(--ns-status-danger-bg);
  color: var(--ns-status-danger-text);
  border: 1px solid var(--ns-status-danger-border);
}

.ns-badge-neutral {
  background-color: var(--ns-surface-subtle);
  color: var(--ns-text-body);
  border: 1px solid var(--ns-border);
}

/* =========================================================================
   7. SHADOW ELEVATION UTILITIES (LIGHT MARITIME SOFT CONTRAST)
   ========================================================================= */
.ns-shadow-2xs { box-shadow: var(--ns-shadow-2xs) !important; }
.ns-shadow-xs  { box-shadow: var(--ns-shadow-xs) !important; }
.ns-shadow-sm  { box-shadow: var(--ns-shadow-sm) !important; }
.ns-shadow-md  { box-shadow: var(--ns-shadow-md) !important; }
.ns-shadow-lg  { box-shadow: var(--ns-shadow-lg) !important; }
.ns-shadow-xl  { box-shadow: var(--ns-shadow-xl) !important; }
.ns-shadow-2xl { box-shadow: var(--ns-shadow-2xl) !important; }
.ns-shadow-card {
  box-shadow: var(--ns-shadow-card) !important;
}

/* =========================================================================
   8. BLUR & GLASSMORPHISM SPECIFICATION
   ========================================================================= */
.ns-glass-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 40 !important;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  will-change: transform;
  background-color: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: var(--ns-blur-header);
  -webkit-backdrop-filter: var(--ns-blur-header);
  border-bottom: 1px solid var(--ns-border);
  flex-shrink: 0 !important;
}

.ns-backdrop-overlay {
  backdrop-filter: var(--ns-blur-modal);
  -webkit-backdrop-filter: var(--ns-blur-modal);
  background-color: rgba(15, 23, 42, 0.45);
}

.ns-glass-card {
  backdrop-filter: var(--ns-blur-subtle);
  -webkit-backdrop-filter: var(--ns-blur-subtle);
  background-color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

/* =========================================================================
   9. HOVER MICRO-INTERACTIONS & STATE FEEDBACK
   ========================================================================= */
.ns-card-hover {
  transition: transform 0.2s var(--ns-ease-spring), 
              box-shadow 0.2s var(--ns-ease-spring), 
              border-color 0.2s ease-in-out;
  will-change: transform, box-shadow;
}

.ns-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--ns-shadow-card-hover) !important;
  border-color: #93c5fd !important; /* Blue-300 subtle focus */
}

.ns-row-hover {
  transition: background-color 0.15s ease-in-out;
}

.ns-row-hover:hover {
  background-color: #f8fafc !important; /* Soft Slate-50 */
}

.ns-interactive-scale {
  transition: transform 0.15s ease-in-out;
}

.ns-interactive-scale:active {
  transform: scale(0.97);
}

.ns-focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25) !important;
  border-color: var(--ns-primary) !important;
}

/* =========================================================================
   10. SKELETON LOADING SYSTEM (ZERO LAYOUT SHIFT & SHIMMER WAVE)
   ========================================================================= */
@keyframes ns-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.ns-skeleton {
  background: linear-gradient(
    90deg,
    #f1f5f9 0%,
    #e2e8f0 50%,
    #f1f5f9 100%
  );
  background-size: 200% 100%;
  animation: ns-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--ns-radius-control);
  display: block;
}

.ns-skeleton-avatar {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--ns-radius-pill);
  flex-shrink: 0;
}

.ns-skeleton-title {
  height: 1.125rem;
  width: 60%;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
}

.ns-skeleton-text {
  height: 0.8125rem;
  width: 100%;
  border-radius: 0.375rem;
  margin-bottom: 0.375rem;
}

.ns-skeleton-text-short {
  height: 0.8125rem;
  width: 40%;
  border-radius: 0.375rem;
}

.ns-skeleton-btn {
  height: var(--ns-h-desktop);
  width: 6.5rem;
  border-radius: var(--ns-radius-control);
}

.ns-skeleton-badge {
  height: 1.375rem;
  width: 4.5rem;
  border-radius: var(--ns-radius-pill);
}
