/* ==========================================================================
   SysAdmin Zoe — Responsive Web & Mobile App Architecture (Tokopedia-Style)
   + Minia Theme Compatibility (Light & Dark Mode)
   ========================================================================== */

:root {
  --zoe-primary: #5156be;
  --zoe-primary-hover: #42469b;
  --zoe-primary-soft: rgba(81, 86, 190, 0.1);
  --zoe-success: #2ab57d;
  --zoe-success-soft: rgba(42, 181, 125, 0.12);
  --zoe-warning: #e89f29;
  --zoe-warning-soft: rgba(255, 191, 83, 0.16);
  --zoe-danger: #fd625e;
  --zoe-danger-soft: rgba(253, 98, 94, 0.12);
  --zoe-info: #4ba6ef;
  --zoe-info-soft: rgba(75, 166, 239, 0.12);

  --zoe-bg: #f4f6f9;
  --zoe-surface: #ffffff;
  --zoe-surface-alt: #f8fafc;
  --zoe-border: #e6e8f0;
  --zoe-text: #1e293b;
  --zoe-text-muted: #64748b;
  --zoe-sidebar-bg: #fbfaff;
}

body[data-mode="dark"] {
  --zoe-bg: #242726;
  --zoe-surface: #2c302e;
  --zoe-surface-alt: #333836;
  --zoe-border: #3f4341;
  --zoe-text: #f1f5f9;
  --zoe-text-muted: #94a3b8;
  --zoe-sidebar-bg: #2c302e;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--zoe-bg) !important;
  color: var(--zoe-text) !important;
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

button, a, [role="button"] {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

@media (pointer: coarse) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   1. TOPBAR (Desktop & Mobile Adaptive Header)
   ========================================================================== */
.zoe-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--zoe-surface);
  border-bottom: 1px solid var(--zoe-border);
  z-index: 40;
  display: flex;
  align-items: center;
}

.zoe-brand-box {
  height: 64px;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--zoe-border);
  background: var(--zoe-sidebar-bg);
  transition: width 0.18s ease;
  flex-shrink: 0;
}

.zoe-brand-box.is-expanded {
  width: 240px;
  padding: 0 20px;
  justify-content: space-between;
}

.zoe-brand-box.is-collapsed {
  width: 72px;
  padding: 0;
  justify-content: center;
}

.zoe-topbar-inner {
  flex: 1;
  min-width: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
}

.zoe-search-box {
  position: relative;
  width: 280px;
  max-width: 100%;
}

.zoe-search-input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 14px;
  border-radius: 8px;
  border: 1px solid var(--zoe-border);
  background: var(--zoe-surface-alt);
  color: var(--zoe-text);
  font-size: 13px;
  outline: none;
}

.zoe-search-input:focus {
  border-color: var(--zoe-primary);
}

.zoe-search-icon {
  position: absolute;
  right: 6px;
  top: 5px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--zoe-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ==========================================================================
   2. DESKTOP SIDEBAR (Expanded 240px & Collapsed 72px Icon Rail)
   ========================================================================== */
.zoe-sidebar {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  background: var(--zoe-sidebar-bg);
  border-right: 1px solid var(--zoe-border);
  z-index: 35;
  transition: width 0.18s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.zoe-sidebar.is-expanded {
  width: 240px;
}

.zoe-sidebar.is-collapsed {
  width: 72px;
}

.zoe-nav-section-title {
  padding: 14px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--zoe-text-muted);
}

.zoe-nav-link {
  display: flex;
  align-items: center;
  height: 44px;
  margin: 3px 10px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--zoe-text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.zoe-sidebar.is-collapsed .zoe-nav-link {
  justify-content: center;
  padding: 0;
  margin: 4px 12px;
}

.zoe-nav-link:hover {
  background: var(--zoe-primary-soft);
  color: var(--zoe-primary);
}

.zoe-nav-link.is-active {
  background: var(--zoe-primary);
  color: #ffffff;
}

.zoe-nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--zoe-primary-soft);
  color: var(--zoe-primary);
}

.zoe-nav-link.is-active .zoe-nav-badge {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* ==========================================================================
   3. MAIN CONTENT & ADAPTIVE BREAKPOINTS (Web Desktop vs Mobile App)
   ========================================================================== */
.zoe-main {
  padding-top: 64px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.18s ease;
}

.zoe-main.with-sidebar-expanded {
  margin-left: 240px;
}

.zoe-main.with-sidebar-collapsed {
  margin-left: 72px;
}

.zoe-main.is-mobile-Forced {
  margin-left: 0 !important;
  max-width: 480px;
  margin-right: auto;
  margin-left: auto !important;
  border-left: 1px solid var(--zoe-border);
  border-right: 1px solid var(--zoe-border);
  background: var(--zoe-bg);
}

.zoe-container {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 32px;
}

/* Visibility Helpers */
.zoe-desktop-view {
  display: block;
}
.zoe-mobile-view {
  display: none;
}

/* ==========================================================================
   4. SUMMARY METRIC CARDS (Fixed Height & Tabular Nums = Zero Jump)
   ========================================================================== */
.zoe-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.zoe-metric-card {
  background: var(--zoe-surface);
  border: 1px solid var(--zoe-border);
  border-radius: 10px;
  padding: 16px 18px;
  height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.zoe-metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.zoe-metric-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--zoe-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zoe-metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.zoe-metric-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--zoe-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.zoe-metric-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--zoe-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   5. MONITORING DATA TABLES (100% Fixed Width & Height — No Layout Shift)
   ========================================================================== */
.zoe-section-card {
  background: var(--zoe-surface);
  border: 1px solid var(--zoe-border);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}

.zoe-section-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--zoe-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.zoe-table-scroll {
  width: 100%;
  overflow-x: auto;
}

.zoe-fixed-table {
  width: 100%;
  min-width: 820px;
  table-layout: fixed;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.zoe-fixed-table th {
  height: 44px;
  padding: 0 14px;
  background: var(--zoe-surface-alt);
  border-bottom: 1px solid var(--zoe-border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--zoe-text-muted);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zoe-fixed-table td {
  height: 54px;
  max-height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--zoe-border);
  font-size: 13px;
  color: var(--zoe-text);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zoe-fixed-table tbody tr:hover {
  background: var(--zoe-surface-alt);
}

/* ==========================================================================
   6. TOKOPEDIA-STYLE MOBILE UI (< 960px or Mobile Mode)
   ========================================================================== */
.zoe-quick-menu {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  background: var(--zoe-surface);
  border: 1px solid var(--zoe-border);
  border-radius: 10px;
  padding: 12px 8px;
  margin-bottom: 14px;
}

.zoe-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  padding: 4px 2px;
  cursor: pointer;
  color: var(--zoe-text);
}

.zoe-quick-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--zoe-surface-alt);
  border: 1px solid var(--zoe-border);
  transition: all 0.15s ease;
}

.zoe-quick-btn.is-active .zoe-quick-icon-box {
  background: var(--zoe-primary);
  border-color: var(--zoe-primary);
  color: #ffffff;
}

.zoe-quick-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--zoe-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.zoe-mobile-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.zoe-mobile-item-card {
  background: var(--zoe-surface-alt);
  border: 1px solid var(--zoe-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-variant-numeric: tabular-nums;
}

.zoe-mobile-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background: var(--zoe-surface);
  border: 1px solid var(--zoe-border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
}

.zoe-mobile-metric-cell {
  min-width: 0;
  height: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.zoe-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--zoe-surface);
  border-top: 1px solid var(--zoe-border);
  z-index: 45;
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.zoe-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--zoe-text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.zoe-bottom-nav-item.is-active {
  color: var(--zoe-primary);
  font-weight: 600;
}

/* ==========================================================================
   7. RESPONSIVE MEDIA QUERIES (Tablet & Mobile Reflow)
   ========================================================================== */
@media (max-width: 1199px) {
  .zoe-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 959px) {
  .zoe-brand-box,
  .zoe-sidebar {
    display: none !important;
  }

  .zoe-main.with-sidebar-expanded,
  .zoe-main.with-sidebar-collapsed {
    margin-left: 0 !important;
  }

  .zoe-container {
    padding: 12px 12px 84px;
  }

  .zoe-desktop-view {
    display: none !important;
  }

  .zoe-mobile-view {
    display: block !important;
  }

  .zoe-bottom-nav {
    display: grid !important;
  }

  .zoe-metric-card {
    height: 98px;
    padding: 12px 14px;
  }

  .zoe-metric-value {
    font-size: 16px;
  }

  .zoe-metric-icon {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
}

/* Ketika user memilih Mode Preview Mobile di layar Desktop */
body[data-view-mode="mobile"] .zoe-brand-box,
body[data-view-mode="mobile"] .zoe-sidebar {
  display: none !important;
}

body[data-view-mode="mobile"] .zoe-main {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 480px;
  border-left: 1px solid var(--zoe-border);
  border-right: 1px solid var(--zoe-border);
}

body[data-view-mode="mobile"] .zoe-topbar {
  max-width: 480px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 1px solid var(--zoe-border);
  border-right: 1px solid var(--zoe-border);
}

body[data-view-mode="mobile"] .zoe-bottom-nav {
  display: grid !important;
  max-width: 480px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 1px solid var(--zoe-border);
  border-right: 1px solid var(--zoe-border);
}

body[data-view-mode="mobile"] .zoe-container {
  padding: 12px 12px 84px;
}

body[data-view-mode="mobile"] .zoe-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 10px;
}

body[data-view-mode="mobile"] .zoe-metric-card {
  height: 98px;
  padding: 12px 14px;
}

body[data-view-mode="mobile"] .zoe-metric-value {
  font-size: 16px;
}

body[data-view-mode="mobile"] .zoe-desktop-view {
  display: none !important;
}

body[data-view-mode="mobile"] .zoe-mobile-view {
  display: block !important;
}
