/* ============================================================================
 * GRODIGI DESIGN SYSTEM THEME
 * Visual Architecture: Deep Midnight Slate + Frosted Card + Ambient Glow + Mesh
 * Dynamic variables injected by render_theme_head() via Admin -> Pengaturan Tampilan
 * ============================================================================ */
:root {
  --scn-primary: #00AAFF;
  --scn-secondary: #00A3A0;
  --scn-primary-rgb: 0, 170, 255;
  --scn-secondary-rgb: 0, 163, 160;
  --scn-bg: #090A0D;
  --scn-card: #111317;
  --scn-card-rgb: 17, 19, 23;
  --scn-sidebar: #0D0E12;
  --scn-radius: 16px;
  --scn-sidebar-border: 1px dashed rgba(0, 170, 255, 0.28);
  --scn-glow-opacity: 1;
  --scn-mesh-opacity: 0.16;
  --scn-mesh-url: url('../grodigi/mesh-widget.png');
  --scn-text: #D1D1D1;
  --scn-muted: #C9C9C9;
  --scn-input-bg: rgba(17, 19, 23, 0.85);
  --scn-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --scn-font-size: 13px;
  --scn-heading-weight: 600;
}

html.light {
  --scn-bg: #F1F5F9;
  --scn-card: #FFFFFF;
  --scn-card-rgb: 255, 255, 255;
  --scn-sidebar: #FFFFFF;
  --scn-text: #0F172A;
  --scn-muted: #475569;
  --scn-input-bg: #F8FAFC;
  --scn-sidebar-border: 1px dashed rgba(15, 23, 42, 0.14);
}

*, *::before, *::after {
  box-sizing: border-box;
  text-shadow: none !important;
}

html, body {
  scrollbar-color: rgba(var(--scn-primary-rgb), 0.35) transparent;
  scrollbar-width: thin;
}

body.grodigi-body {
  margin: 0;
  font-family: var(--scn-font-family);
  font-size: var(--scn-font-size);
  line-height: 1.5;
  background-color: var(--scn-bg);
  color: var(--scn-text);
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

h1, h2, h3, h4, .card-title, .kpi-value {
  font-weight: var(--scn-heading-weight);
  color: var(--scn-text);
  text-shadow: none !important;
}

/* Sidebar (Fixed/Sticky 268px GroDigi Collapsible Rail with Independent Scroll) */
.scn-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background: var(--scn-bg);
  align-items: flex-start;
}

.scn-sidebar {
  width: 268px;
  flex-shrink: 0;
  background: var(--scn-sidebar);
  border-right: var(--scn-sidebar-border);
  position: sticky;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s ease, width 0.22s ease;
  overflow: hidden;
  overscroll-behavior: contain;
  z-index: 30;
}

.scn-sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--scn-mesh-url);
  background-size: cover;
  background-position: bottom right;
  opacity: var(--scn-mesh-opacity);
  pointer-events: none;
  z-index: 0;
}

.scn-sidebar.collapsed {
  margin-left: -268px;
}

.scn-sb-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
}

.scn-sb-brand {
  flex-shrink: 0;
  padding: 14px 14px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(var(--scn-primary-rgb), 0.14);
}

.scn-sb-toggle-inside {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.scn-sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  z-index: 55;
}

@media (min-width: 1025px) {
  .scn-topbar-open-btn {
    display: none;
  }
  body.sidebar-collapsed .scn-topbar-open-btn {
    display: inline-flex;
  }
}

@media (max-width: 1024px) {
  .scn-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100dvh;
    max-height: 100dvh;
    overscroll-behavior: contain;
    z-index: 60;
    box-shadow: 12px 0 36px rgba(2, 6, 23, 0.55);
  }
  .scn-sidebar:not(.mobile-open) {
    margin-left: -268px;
  }
  .scn-sidebar.mobile-open {
    margin-left: 0;
  }
  body.sidebar-mobile-open .scn-sb-backdrop {
    display: block;
  }
  body.sidebar-mobile-open .scn-topbar-open-btn {
    display: none;
  }
}

.scn-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--scn-primary), var(--scn-secondary));
  color: #FFFFFF;
  font-weight: 800;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(2, 6, 23, 0.35);
  overflow: hidden;
  flex-shrink: 0;
}

.scn-brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scn-sb-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 10px 12px 26px;
}

.scn-sb-group {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--scn-muted);
  padding: 14px 10px 5px;
}

.scn-sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 11px;
  border-radius: 11px;
  color: var(--scn-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

html.light .scn-sb-link {
  color: var(--scn-muted);
}

.scn-sb-link svg {
  color: var(--scn-muted);
  transition: color 0.15s ease;
}

.scn-sb-link:hover {
  background: rgba(var(--scn-primary-rgb), 0.12);
  color: var(--scn-text);
}

.scn-sb-link:hover svg {
  color: var(--scn-primary);
}

.scn-sb-link.active {
  background: rgba(var(--scn-primary-rgb), 0.22);
  border-color: rgba(var(--scn-primary-rgb), 0.35);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: none;
}

html.light .scn-sb-link.active {
  background: rgba(var(--scn-primary-rgb), 0.14);
  color: var(--scn-primary);
}

.scn-sb-link.active svg {
  color: #FFFFFF;
}

html.light .scn-sb-link.active svg {
  color: var(--scn-primary);
}

/* Main Content & Crisp Sticky Topbar (No Text Halo/Blur) */
.scn-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--scn-bg);
}

.scn-topbar {
  min-height: 62px;
  height: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 22px;
  background: rgba(var(--scn-card-rgb), 0.96);
  border-bottom: 1px solid rgba(var(--scn-primary-rgb), 0.16);
  position: sticky;
  top: 0;
  z-index: 25;
}

@media (max-width: 768px) {
  .scn-topbar {
    flex-wrap: wrap;
    padding: 10px 14px;
  }
}

.scn-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid rgba(var(--scn-primary-rgb), 0.28);
  background: rgba(var(--scn-primary-rgb), 0.12);
  color: var(--scn-text);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.scn-icon-btn:hover {
  border-color: rgba(var(--scn-primary-rgb), 0.55);
  background: rgba(var(--scn-primary-rgb), 0.24);
}

/* Header Sidebar Toggle: Hidden by default; only appears when sidebar is collapsed/closed */
.scn-icon-btn.scn-topbar-open-btn {
  display: none;
}

@media (min-width: 1025px) {
  body.sidebar-collapsed .scn-icon-btn.scn-topbar-open-btn {
    display: inline-flex;
  }
}

@media (max-width: 1024px) {
  body:not(.sidebar-mobile-open) .scn-icon-btn.scn-topbar-open-btn {
    display: inline-flex;
  }
  body.sidebar-mobile-open .scn-icon-btn.scn-topbar-open-btn {
    display: none;
  }
}

.scn-cmd-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid rgba(var(--scn-primary-rgb), 0.26);
  background: rgba(var(--scn-primary-rgb), 0.10);
  color: var(--scn-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scn-cmd-btn:hover {
  border-color: rgba(var(--scn-primary-rgb), 0.5);
  color: var(--scn-text);
}

.scn-cmd-kbd {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid rgba(var(--scn-primary-rgb), 0.35);
  background: rgba(var(--scn-primary-rgb), 0.15);
  color: var(--scn-primary);
}

.scn-content {
  padding: 22px 24px 40px;
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
}

/* GroDigi Bento Hero Card + Mesh + 4 Action Tiles */
.scn-hero-bento {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--scn-radius) + 6px);
  border: 1px solid rgba(var(--scn-primary-rgb), 0.38);
  background: linear-gradient(135deg, rgba(var(--scn-primary-rgb), 0.24) 0%, rgba(var(--scn-card-rgb), 0.94) 55%, rgba(var(--scn-secondary-rgb), 0.22) 100%);
  padding: 26px 28px;
  color: #FFFFFF;
  box-shadow: 0 20px 50px -15px rgba(2, 6, 23, 0.7);
  margin-bottom: 20px;
}

html.light .scn-hero-bento {
  color: #0F172A;
  box-shadow: 0 12px 32px -12px rgba(var(--scn-primary-rgb), 0.25);
}

.scn-hero-bento::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--scn-mesh-url);
  background-size: cover;
  background-position: center;
  opacity: calc(var(--scn-mesh-opacity) * 2.2);
  pointer-events: none;
}

.scn-hero-tiles {
  position: relative;
  z-index: 2;
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1100px) {
  .scn-hero-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .scn-hero-tiles { grid-template-columns: 1fr; }
}

.scn-action-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-radius: var(--scn-radius);
  border: 1px solid rgba(var(--scn-primary-rgb), 0.28);
  background: rgba(var(--scn-card-rgb), 0.94);
  text-decoration: none;
  color: var(--scn-text);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

html.light .scn-action-tile {
  background: rgba(255, 255, 255, 0.96);
  color: #0F172A;
}

.scn-action-tile:hover {
  border-color: rgba(var(--scn-primary-rgb), 0.55);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -10px rgba(2, 6, 23, 0.45);
}

.scn-tile-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(var(--scn-primary-rgb), 0.36);
  background: rgba(var(--scn-primary-rgb), 0.16);
  color: var(--scn-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

html.light .scn-tile-icon {
  color: var(--scn-primary);
}

/* KPI Sparkline Cards (4 Cols) */
.kpi-grid, .scn-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card, .scn-kpi-card {
  position: relative;
  overflow: hidden;
  background: rgba(var(--scn-card-rgb), 0.96);
  border: 1px solid rgba(var(--scn-primary-rgb), 0.28);
  border-radius: var(--scn-radius);
  padding: 18px 20px;
  box-shadow: 0 8px 24px -12px rgba(2, 6, 23, 0.4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card::after, .scn-kpi-card::after {
  content: '';
  position: absolute;
  top: -36px;
  right: -36px;
  width: 112px;
  height: 112px;
  border-radius: 999px;
  background: rgba(var(--scn-primary-rgb), 0.16);
  filter: blur(28px);
  opacity: calc(var(--scn-glow-opacity) * 0.55);
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.kpi-card:hover, .scn-kpi-card:hover {
  border-color: rgba(var(--scn-primary-rgb), 0.55);
  box-shadow: 0 10px 26px -12px rgba(2, 6, 23, 0.45);
}

.kpi-card:hover::after, .scn-kpi-card:hover::after {
  opacity: var(--scn-glow-opacity);
}

.kpi-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--scn-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kpi-value {
  font-size: 24px;
  font-weight: var(--scn-heading-weight);
  margin: 6px 0 4px;
  color: var(--scn-text);
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 12px;
  color: var(--scn-muted);
}

/* Standard GroDigi Card, Tables, Inputs, Buttons & Badges */
.card, .scn-card {
  position: relative;
  background: rgba(var(--scn-card-rgb), 0.96);
  border: 1px solid rgba(var(--scn-primary-rgb), 0.24);
  border-radius: var(--scn-radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 28px -14px rgba(2, 6, 23, 0.38);
}

.card-title {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: var(--scn-heading-weight);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--scn-text);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
  align-items: start;
}

.grid-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--scn-text);
}

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid rgba(var(--scn-primary-rgb), 0.14);
  vertical-align: middle;
}

th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--scn-muted);
  background: rgba(var(--scn-primary-rgb), 0.08);
  font-weight: 700;
}

.form-row {
  margin-bottom: 12px;
}

.form-row label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--scn-muted);
  margin-bottom: 5px;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="password"],
.form-row input[type="email"],
.form-row input[type="url"],
.form-row input[type="datetime-local"],
.form-row input[type="date"],
.form-row select,
.form-row textarea,
.scn-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid rgba(var(--scn-primary-rgb), 0.25);
  background: var(--scn-input-bg);
  color: var(--scn-text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus,
.scn-input:focus {
  outline: none;
  border-color: var(--scn-primary);
  box-shadow: 0 0 0 3px rgba(var(--scn-primary-rgb), 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(90deg, var(--scn-primary), var(--scn-secondary));
  color: #FFFFFF;
  border: none;
  padding: 9px 15px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(2, 6, 23, 0.28);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-dark, .btn-sec {
  background: rgba(var(--scn-primary-rgb), 0.12);
  color: var(--scn-text);
  border: 1px solid rgba(var(--scn-primary-rgb), 0.28);
  box-shadow: none;
}

.btn-dark:hover, .btn-sec:hover {
  background: rgba(var(--scn-primary-rgb), 0.22);
  border-color: rgba(var(--scn-primary-rgb), 0.45);
}

.btn-green {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(2, 6, 23, 0.25);
}

.btn-red {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(2, 6, 23, 0.25);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 9px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.badge-green { background: rgba(16, 185, 129, 0.16); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-orange { background: rgba(245, 158, 11, 0.16); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-red { background: rgba(239, 68, 68, 0.16); color: #F87171; border: 1px solid rgba(239, 68, 68, 0.35); }
.badge-violet { background: rgba(var(--scn-primary-rgb), 0.16); color: var(--scn-primary); border: 1px solid rgba(var(--scn-primary-rgb), 0.38); }
.badge-slate { background: rgba(148, 163, 184, 0.14); color: var(--scn-muted); border: 1px solid rgba(148, 163, 184, 0.25); }

html.light .badge-violet { color: var(--scn-primary); }
html.light .badge-green { color: #059669; }
html.light .badge-orange { color: #D97706; }
html.light .badge-red { color: #DC2626; }

.alert {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 600;
}

.alert-ok {
  background: rgba(16, 185, 129, 0.14);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.alert-warn {
  background: rgba(245, 158, 11, 0.14);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.38);
}

.alert-err {
  background: rgba(239, 68, 68, 0.14);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.gd-toast-wrap {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
  pointer-events: none;
}

.gd-toast {
  pointer-events: auto;
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.48);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

/* Command Palette Modal (⌘K) */
.scn-cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
  z-index: 90;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  padding-left: 16px;
  padding-right: 16px;
}

.scn-cmd-backdrop.open {
  display: flex;
}

.scn-cmd-dialog {
  width: 100%;
  max-width: 540px;
  background: var(--scn-card);
  border: 1px solid rgba(var(--scn-primary-rgb), 0.4);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.scn-cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  color: var(--scn-text);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid rgba(var(--scn-primary-rgb), 0.08);
}

.scn-cmd-item:hover {
  background: rgba(var(--scn-primary-rgb), 0.16);
}
