:root {
  --bg-main: #0B0B0B;
  --bg-card: rgba(20, 20, 20, 0.95);
  --bg-sidebar: #0F0F0F;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.14);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --primary: #FA832E;
  --primary-hover: #e07220;
  --accent-green: #1E9E3C;
  --accent-yellow: #FFD014;
  --accent-red: #D97757;
  --accent-violet: #8b5cf6;
  --accent-cyan: #38bdf8;
  --text-main: #F7F6F2;
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-sub: rgba(255, 255, 255, 0.4);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  background-color: #0B0B0B;
  color: #F7F6F2;
  font-family: var(--font-main);
  min-height: 100vh;
  min-height: 100dvh;
}

/* Touch ergonomics & eliminate tap delays on mobile/tablets */
button, a, input, select, textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: #0B0B0B;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Clean Dark Grid (xczdev signature background) */
.bg-grid-dark,
.bg-grid-cyber,
.bg-grid-pattern,
.app-container {
  background-color: #0B0B0B;
  background-image: 
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  background-attachment: fixed;
}

/* Base Layout Containers */
.app-container {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.main-wrapper {
  margin-left: 256px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  max-width: 100%;
  transition: margin-left 0.25s ease;
}

.content-body {
  padding: 24px 20px max(40px, env(safe-area-inset-bottom, 40px));
  flex: 1;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

@media (max-width: 1024px) {
  .main-wrapper {
    margin-left: 0 !important;
  }
  .content-body {
    padding: 16px 12px max(32px, env(safe-area-inset-bottom, 32px));
  }
}

/* Modern Card System (xczdev signature style) */
.card,
.xcz-card {
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  contain: layout;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover,
.xcz-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Mac 3-Dots Window Header */
.mac-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.mac-dot,
.mac-dot-red,
.mac-dot-yellow,
.mac-dot-green {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mac-dot-red { background-color: #D97757; }
.mac-dot-yellow { background-color: #FFD014; }
.mac-dot-green { background-color: #1E9E3C; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

.stat-box {
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  contain: layout;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.stat-box:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.stat-box-content {
  padding: 16px 18px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
}

.stat-data h3 {
  font-size: clamp(1.125rem, 3.5vw, 1.75rem);
  font-weight: 600;
  color: #fff;
  line-height: 1;
}

.stat-data p {
  font-size: clamp(0.5625rem, 1vw, 0.75rem);
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 5px;
}

.icon-blue { background: rgba(250, 131, 46, 0.12); color: #FA832E; border: 1px solid rgba(250, 131, 46, 0.2); }
.icon-green { background: rgba(30, 158, 60, 0.12); color: #1E9E3C; border: 1px solid rgba(30, 158, 60, 0.2); }
.icon-purple { background: rgba(139, 92, 246, 0.12); color: #8b5cf6; border: 1px solid rgba(139, 92, 246, 0.2); }
.icon-amber { background: rgba(245, 158, 11, 0.12); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.2); }

.stat-data h3 {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-data p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-active { background: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-expired { background: rgba(244, 63, 94, 0.1); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.25); }
.badge-info { background: rgba(48, 140, 232, 0.1); color: #5AA6F2; border: 1px solid rgba(48, 140, 232, 0.25); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #F7F6F2;
  color: #0B0B0B;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.12);
}

.btn-primary:hover {
  background: #ffffff;
  color: #000;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.24);
}

.btn-cyber {
  background: #308CE8;
  color: #fff;
  box-shadow: 0 0 16px rgba(48, 140, 232, 0.35);
}

.btn-cyber:hover {
  background: #2577c9;
  color: #fff;
  box-shadow: 0 0 20px rgba(48, 140, 232, 0.5);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #fb7185;
}

.btn-danger:hover {
  background: #f43f5e;
  border-color: #f43f5e;
  color: #fff;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 8px;
}

/* API Key Box */
.api-key-box {
  background: rgba(10, 10, 12, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.api-key-text {
  color: #5AA6F2;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cyber Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  border-radius: 12px;
}

table.cyber-table {
  width: 100%;
  min-width: 600px;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

table.cyber-table th {
  padding: 12px 16px;
  color: var(--text-sub);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.015);
  border-bottom: 1px solid var(--border-color);
}

table.cyber-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  color: var(--text-main);
  vertical-align: middle;
}

table.cyber-table tr:last-child td {
  border-bottom: none;
}

table.cyber-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Terminal Card */
.terminal-card {
  background: #08080a;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  font-family: var(--font-mono);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.terminal-header {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #f43f5e; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-title {
  font-size: 11px;
  color: var(--text-sub);
  margin-left: 6px;
}

.terminal-body {
  padding: 16px 18px;
  font-size: 12px;
  line-height: 1.7;
  color: #cbd5e1;
  overflow-x: auto;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-backdrop.active {
  display: flex;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-box {
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  max-width: 600px;
  width: min(100%, calc(100vw - 2rem));
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  margin: auto;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 22px 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 10px;
  }
  .modal-box {
    border-radius: 14px;
    width: 100%;
    max-height: calc(100dvh - 1.5rem);
  }
  .modal-header {
    padding: 14px 16px;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.25); color: #34d399; }
.alert-error { background: rgba(244, 63, 94, 0.1); border: 1px solid rgba(244, 63, 94, 0.25); color: #fb7185; }

/* Responsive Sidebar Drawer & Desktop Collapse */
.sidebar {
  background-color: #0C0C0E;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

/* Navbar sidebar toggle & divider visibility rules */
.navbar-sidebar-toggle {
  display: inline-flex;
}
.navbar-sidebar-divider {
  display: block;
}

@media (min-width: 1025px) {
  .sidebar {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  html.sidebar-collapsed .sidebar,
  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%) !important;
  }
  html.sidebar-collapsed .main-wrapper,
  body.sidebar-collapsed .main-wrapper {
    margin-left: 0 !important;
  }

  /* When sidebar is OPEN on desktop: hide toggle button & divider in navbar to prevent awkward void */
  .navbar-sidebar-toggle {
    display: none !important;
  }
  .navbar-sidebar-divider {
    display: none !important;
  }

  /* When sidebar is COLLAPSED on desktop: show toggle button & divider in navbar so user can expand it */
  html.sidebar-collapsed .navbar-sidebar-toggle,
  body.sidebar-collapsed .navbar-sidebar-toggle {
    display: inline-flex !important;
  }
  html.sidebar-collapsed .navbar-sidebar-divider,
  body.sidebar-collapsed .navbar-sidebar-divider {
    display: block !important;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: min(280px, 85vw);
    width: 280px;
    height: 100vh;
    height: 100dvh;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  }
}

/* ======================================================
   FIGURA EMBLEM & LOGO FRAMING SYSTEM
   Mengubah logo/icon kotak/persegi menjadi figura emblem keren
   ====================================================== */
.figura-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(20, 20, 20, 0.95) 45%, rgba(10, 10, 10, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 4px 14px rgba(0, 0, 0, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.25),
    inset 0 -1px 2px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  flex-shrink: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.figura-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 30% 25%, rgba(250, 131, 46, 0.22), transparent 70%);
  pointer-events: none;
  z-index: 1;
}

.figura-frame::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, transparent 100%);
  transform: rotate(-25deg);
  pointer-events: none;
  z-index: 2;
  opacity: 0.7;
}

.figura-frame:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(250, 131, 46, 0.55);
  box-shadow: 
    0 0 0 1px rgba(250, 131, 46, 0.35),
    0 6px 20px rgba(250, 131, 46, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.figura-frame-admin {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.18) 0%, rgba(20, 20, 20, 0.95) 45%, rgba(10, 10, 10, 0.98) 100%);
  border-color: rgba(167, 139, 250, 0.35);
}

.figura-frame-admin::before {
  background: radial-gradient(circle at 30% 25%, rgba(139, 92, 246, 0.28), transparent 70%);
}

.figura-frame-admin:hover {
  border-color: rgba(167, 139, 250, 0.65);
  box-shadow: 
    0 0 0 1px rgba(139, 92, 246, 0.45),
    0 6px 20px rgba(139, 92, 246, 0.35),
    inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

/* Gambar di dalam figura */
.figura-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  border-radius: 10px;
  position: relative;
  z-index: 3;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
  transition: transform 0.25s ease;
}

.figura-frame:hover .figura-img {
  transform: scale(1.05);
}

/* Icon bawaan di dalam figura jika tidak ada gambar */
.figura-icon {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Predefined sizes - Compact & refined */
.figura-xs { width: 20px; height: 20px; border-radius: 6px; }
.figura-xs .figura-img { padding: 2px; border-radius: 5px; }

.figura-sm { width: 26px; height: 26px; border-radius: 7px; }
.figura-sm .figura-img { padding: 2.5px; border-radius: 6px; }

.figura-md { width: 34px; height: 34px; border-radius: 9px; }
.figura-md .figura-img { padding: 3px; border-radius: 7px; }

.figura-lg { width: 48px; height: 48px; border-radius: 12px; }
.figura-lg .figura-img { padding: 5px; border-radius: 9px; }

.figura-xl { width: 64px; height: 64px; border-radius: 15px; }
.figura-xl .figura-img { padding: 7px; border-radius: 12px; }

/* ======================================================
   MOBILE, TABLET, ANDROID & IOS RESPONSIVENESS ENHANCEMENTS
   ====================================================== */

/* 1. Mencegah auto-zoom yang mengganggu di iOS Safari saat tap input/select/textarea */
@media screen and (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* 2. Safe Area Insets Helpers untuk iPhone X / 11 / 12 / 13 / 14 / 15 / 16 (Dynamic Island & Home Indicator) */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

.safe-pb {
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
}

.safe-pt {
  padding-top: max(16px, env(safe-area-inset-top, 16px));
}

/* 3. Touch Scroll Momentum untuk Android & iOS */
.touch-scroll,
.table-responsive,
.overflow-x-auto,
.overflow-y-auto {
  -webkit-overflow-scrolling: touch;
}

.touch-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

/* 4. Table responsive wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 8px;
  position: relative;
}

.table-responsive > table {
  min-width: 620px;
}

/* 5. Mobile Pre / Code blocks overflow handling */
pre, code {
  max-width: 100%;
}

pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  word-break: normal;
}

/* 6. Breakpoint optimizations untuk layar kecil (< 400px seperti iPhone SE / Android compact) */
@media (max-width: 400px) {
  .btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .card-header {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .mac-dots {
    padding: 8px 10px 6px;
  }

  .api-key-box {
    padding: 10px 12px;
    font-size: 11px;
    flex-direction: column;
    align-items: stretch;
  }
}


