/* ===== SIDEBAR & IFRAME MOBILE FINAL ===== */
@media (max-width: 768px) {
  .dashboard-container {
    display: block !important;
    height: auto;
  }

  .tool-grid {
    padding: 1rem 1rem 0 1rem;
    width: 100dvw;
    min-height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    box-sizing: border-box;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
  }
  .iframe-container {
    padding: 0 !important;
    margin: 0 !important;
    width: 100dvw;
    height: calc(100dvh - 64px);
    min-height: calc(100dvh - 64px);
    max-height: calc(100dvh - 64px);
    box-sizing: border-box;
    overflow: auto;
    background: transparent;
    position: relative;
    z-index: 1;
  }
  .tool-grid::-webkit-scrollbar {
    display: none;
  }
  .iframe-container {
    position: relative;
    z-index: 1;
    background: transparent;
    padding: 0 !important;
    margin: 0 !important;
    /* width: 100dvw; */
  }
  #toolFrame {
    width: 100vw;
    min-height: calc(100dvh - 64px);
    height: auto;
    max-height: none;
    display: block;
    border: none;
    background: #fff;
    z-index: 1;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    overflow: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: 85dvw;
    max-width: 320px;
    min-width: 220px;
    scrollbar-width: none;
    background: var(--neutral-50);
    z-index: 2001;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
    opacity: 1;
    border-right: 1px solid var(--neutral-300);
    padding: 40px 16px 16px 16px !important;
    grid-area: unset;
    margin: 0 !important;
  }
  .sidebar.sidebar-active {
    transform: translateX(0);
  }
  .sidebar.sidebar-active .nav-text,
  .sidebar.sidebar-active .nav-title {
    opacity: 1 !important;
    transition: opacity 0.2s;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100dvw;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2000;
  }
  .sidebar-overlay.active {
    display: block;
  }
  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--neutral-900);
    cursor: pointer;
    margin-left: 8px;
    z-index: 2100;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    min-width: 48px;
    min-height: 48px;
  }
  
  .sidebar-toggle:hover {
    background-color: var(--neutral-200);
  }
  
  .sidebar-toggle:active {
    transform: scale(0.95);
  }
  
  /* Ensure Lottie player fits properly */
  .sidebar-toggle lottie-player {
    pointer-events: none;
  }
}

@media (min-width: 769px) {
  .sidebar-toggle {
    display: none !important;
  }
  .sidebar-overlay {
    display: none !important;
  }
}
/* ===== UNGGUL TOOLKIT - UNIFIED DESIGN SYSTEM ===== */
:root {
  /* === PRIMARY COLORS === */
  --primary-blue: #4a90e2;
  --primary-blue-dark: #357abd;
  --primary-blue-light: #6ba3e8;
  --primary-blue-alpha: rgba(74, 144, 226, 0.1);

  /* === NEUTRAL COLORS === */
  --neutral-50: #ffffff;
  --neutral-100: #f8fafc;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;

  /* === STATUS COLORS === */
  --status-green: #10b981;
  --status-yellow: #f59e0b;
  --status-gray: #9ca3af;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  /* === TYPOGRAPHY === */
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* === SPACING === */
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  /* === BORDER RADIUS === */
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* === SHADOWS === */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);

  /* === TRANSITIONS === */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--neutral-100);
  color: var(--neutral-900);
  overflow: hidden; /* Mencegah scroll di level body */
}

/* ===== LAYOUT UTAMA ===== */
/* ===== [ROMBAK] HEADER BARU ===== */
.dashboard-header {
  grid-area: header;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--neutral-50);
  border-bottom: 1px solid var(--neutral-300);
  gap: 32px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 36px;
  border-radius: 8px;
  width: auto;
}

.header-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--neutral-900);
  margin: 0;
}
@media (max-width: 768px) {
  .header-logo {
    display: none !important;
  }
  .header-title {
    display: none;
  }
}

.header-search {
  flex-grow: 1; /* Biarkan search bar mengisi ruang yang tersedia */
  max-width: 500px; /* Batasi lebar maksimumnya */
  position: relative;
}

.header-search .search-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: var(--neutral-600);
}

.header-search input[type="search"] {
  width: 100%;
  padding: 12px 16px 12px 48px; /* Beri ruang untuk ikon di kiri */
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  background-color: var(--neutral-100);
  font-size: 14px;
  font-family: var(--font-family);
  transition: all 0.2s ease;
}

.header-search input[type="search"]:focus {
  outline: none;
  background-color: var(--neutral-50);
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

/* ===== HEADER ACTIONS ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 8px;
  background-color: transparent;
  color: var(--neutral-600);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 22px;
}

.theme-toggle:hover {
  background-color: var(--neutral-200);
  color: var(--primary-blue);
}

.theme-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

@media (max-width: 768px) {
  .header-actions {
    gap: 8px;
  }
  
  .theme-toggle {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
}
.tool-grid {
  grid-area: main;
  padding: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  align-content: start;
  overflow-y: auto;
  height: calc(100dvh - 64px);
  max-height: calc(100dvh - 64px);
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
}

.tool-grid::-webkit-scrollbar {
  display: none;
}

@media (max-width: 768px) {
  .tool-grid {
    padding: 1rem 1rem 0 1rem;
    width: 100dvw;
    /* min-height: 100dvh; */
    /* max-height: 100dvh; */
    box-sizing: border-box;
    overflow-y: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tool-grid::-webkit-scrollbar {
    display: none;
  }
}

/* ===== IFRAME CONTAINER (DESKTOP) ===== */
.iframe-container {
  grid-area: main;
  position: relative;
  height: calc(100dvh - 64px);
  max-height: calc(100dvh - 64px);
  overflow: auto;
  background: var(--neutral-50);
}

#toolFrame {
  width: 100%;
  height: 100%;
  min-height: calc(100dvh - 64px);
  border: none;
  background: var(--neutral-50);
  overflow: auto;
}

/* ===== SIDEBAR INTERAKTIF & RESPONSIVE (FINAL) ===== */
/* ===== [FINAL v2] SIDEBAR INTERAKTIF & RESPONSIVE ===== */

/* 1. Atur Layout Grid Utama */
.dashboard-container {
  display: grid;
  grid-template-areas:
    "header header"
    "sidebar main";
  /* Keadaan default: sidebar terlipat (lebar 80px) */
  grid-template-columns: 80px 1fr;
  grid-template-rows: 64px 1fr;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns 0.3s ease-in-out;
}

/* 2. Lebarkan Grid Saat Sidebar di-hover */
.dashboard-container:has(.sidebar:hover) {
  grid-template-columns: 240px 1fr;
}

/* 3. Atur Tampilan Elemen di Dalam Sidebar */
.sidebar {
  grid-area: sidebar;
  background-color: var(--neutral-50);
  border-right: 1px solid var(--neutral-300);
  padding: 16px 0;
  scrollbar-width: none;
  overflow-x: hidden;
}

.sidebar nav ul {
  list-style: none;
  margin-top: 1rem;
}

/* 4. [KUNCI PERBAIKAN] Atur Link dan Ikon */
.sidebar li a {
  display: flex;
  align-items: center; /* WAJIB: Membuat ikon dan teks selalu sejajar vertikal */
  height: 50px; /* Beri tinggi tetap untuk konsistensi */
  text-decoration: none;
  color: var(--neutral-900);
  font-weight: 500;
  position: relative;
}

.sidebar li.active a,
.sidebar li a:hover {
  background-color: var(--neutral-100);
  color: var(--primary-blue);
}

/* Penanda aktif yang lebih rapi */
.sidebar li.active a {
  box-shadow: inset 4px 0 0 0 var(--primary-blue);
}

.sidebar li a i {
  /* Jadikan ikon sebagai "kotak" dengan lebar sama seperti sidebar terlipat */
  flex-shrink: 0; /* Cegah ikon mengecil */
  display: inline-flex;
  align-items: center;
  justify-content: center; /* Wajib: Ikon selalu di tengah secara horizontal */
  width: 80px; /* Wajib: Lebar ikon = lebar sidebar terlipat */
  font-size: 1.2rem;
  color: var(--neutral-600);
  transition: color 0.2s ease;
}

.sidebar li.active a i,
.sidebar li a:hover i {
  color: var(--primary-blue);
}

/* 5. Atur Animasi untuk Teks dan Judul */
.sidebar .nav-text,
.sidebar .nav-title {
  opacity: 0;
  white-space: nowrap;
  transition: opacity 0.2s ease;
  transition-delay: 0.1s;
}

.sidebar .nav-title {
  padding: 0 24px;
  font-size: 12px;
  font-weight: 600;
  color: var(--neutral-600);
  text-transform: uppercase;
  margin-top: 24px;
  margin-bottom: 8px;
}

/* 6. Tampilkan Teks dan Judul Saat di-hover */
.sidebar:hover .nav-text,
.sidebar:hover .nav-title {
  opacity: 1;
}
/* ===== KOMPONEN LAINNYA ===== */

.btn {
  border: none;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background-color: var(--primary-blue);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-blue-dark);
}

/* KARTU TOOL */
.tool-card {
  background-color: var(--neutral-50);
  border: 1px solid var(--neutral-300);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-color, #222);
  object-fit: contain;
  border-radius: 8px;
  background-color: var(--neutral-100);
  padding: 4px;
  transition: all 0.2s ease;
}

/* Icon Font Awesome dalam card */
.card-icon {
  font-size: 28px;
  color: var(--neutral-700);
  transition: all 0.2s ease;
}

.tool-card:hover .card-icon {
  color: var(--primary-blue);
  transform: scale(1.1);
}

.card-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.card-status.active {
  background-color: var(--status-green);
}
.card-status.trial {
  background-color: var(--status-yellow);
}
.card-status.inactive {
  background-color: var(--status-gray);
}

.card-body h3 {
  font-size: 18px;
}
.card-body p {
  font-size: 12px;
  color: var(--neutral-600);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background-color: var(--neutral-100);
  color: var(--neutral-600);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 12px;
}

/* MODAL & OVERLAY */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background-color: var(--neutral-50);
  border-radius: 16px;
  width: 90%;
  max-width: 800px;
  z-index: 1000;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  padding: 32px;
}

.overlay.active,
.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal.active {
  transform: translate(-50%, -50%) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--neutral-600);
}

/* IFRAME CONTAINER */
.iframe-container {
  grid-area: main;
  padding: 0;
  margin: 0;
  overflow: hidden;
  position: relative; /* Diperlukan untuk positioning tombol kembali */
}

/* Tombol Kembali (Back Button) */
.back-button {
  position: absolute;
  top: 20px;
  left: 32px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background-color: var(--neutral-50);
  color: var(--neutral-800);
  border: 1px solid var(--neutral-300);
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.back-button:hover {
  background-color: var(--neutral-100);
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .back-button {
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
}

#toolFrame {
  width: 100%;
  height: 100%;
  border: none;
}

/* GAYA FORM DI MODAL */
.modal-content h2 {
  margin-bottom: 1.5rem;
}
.modal-content .form-group {
  margin-bottom: 1rem;
}
.modal-content label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--neutral-600);
}
.modal-content input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font-family);
}
.modal-content .btn {
  width: 100%;
  margin-top: 1rem;
}
#updatedJsonOutput {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-family: monospace;
  background-color: var(--neutral-100);
  resize: vertical;
}

#categoryNav {
  border-top: 1px solid var(--neutral-300);
  padding-top: 1rem;
  margin-top: 1rem;
}
