/* =========================================================
   OMNI AI STUDIO — 3D SPATIAL MUSE PRO THEME (v28)
   4 Palettes • 3D Interactive Hologram • 3D VPS Ring Gauges
   ========================================================= */

body.ui-3d {
  /* Default Palette: Cosmic Muse */
  --m3d-p1: #4f8cff;
  --m3d-p2: #7c5cff;
  --m3d-p3: #06b6d4;
  --m3d-btn-depth: #2d3c8a;
  --m3d-grid: rgba(99, 155, 255, 0.12);
  --m3d-glow: rgba(79, 140, 255, 0.45);
  --m3d-sheen: rgba(116, 168, 255, 0.16);
  --m3d-border-hover: rgba(116, 168, 255, 0.38);

  --bg-3d-base: #050812;
  --glass-bg: rgba(16, 22, 38, 0.66);
  --glass-bg-strong: rgba(12, 17, 30, 0.86);
  --glass-border: rgba(255, 255, 255, 0.11);
  --shadow-3d-card:
    0 18px 40px -14px rgba(0, 0, 0, 0.8),
    0 6px 14px -4px rgba(0, 0, 0, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.38);

  background: var(--bg-3d-base) !important;
  overflow-x: hidden;
}

/* Preset 2: Neon Cyan */
body.ui-3d[data-3d-palette="cyan"] {
  --m3d-p1: #00d8ff;
  --m3d-p2: #0284c7;
  --m3d-p3: #2dd4bf;
  --m3d-btn-depth: #0c4a6e;
  --m3d-grid: rgba(0, 216, 255, 0.13);
  --m3d-glow: rgba(0, 216, 255, 0.45);
  --m3d-sheen: rgba(34, 211, 238, 0.18);
  --m3d-border-hover: rgba(34, 211, 238, 0.44);
  --bg-3d-base: #030b12;
}

/* Preset 3: Cyberpunk Ungu */
body.ui-3d[data-3d-palette="cyberpunk"] {
  --m3d-p1: #ec4899;
  --m3d-p2: #9333ea;
  --m3d-p3: #38bdf8;
  --m3d-btn-depth: #581c87;
  --m3d-grid: rgba(236, 72, 153, 0.13);
  --m3d-glow: rgba(217, 70, 239, 0.46);
  --m3d-sheen: rgba(244, 114, 182, 0.18);
  --m3d-border-hover: rgba(232, 121, 249, 0.44);
  --bg-3d-base: #0b0514;
}

/* Preset 4: Emerald Gelap */
body.ui-3d[data-3d-palette="emerald"] {
  --m3d-p1: #10b981;
  --m3d-p2: #0d9488;
  --m3d-p3: #84cc16;
  --m3d-btn-depth: #065f46;
  --m3d-grid: rgba(16, 185, 129, 0.12);
  --m3d-glow: rgba(16, 185, 129, 0.44);
  --m3d-sheen: rgba(52, 211, 153, 0.17);
  --m3d-border-hover: rgba(52, 211, 153, 0.42);
  --bg-3d-base: #030f0c;
}

/* === Latar Belakang 3D Spatial + Starfield + Orbs === */
#muse-3d-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  display: none;
  background:
    radial-gradient(circle at 18% 16%, color-mix(in srgb, var(--m3d-p1) 18%, transparent), transparent 46%),
    radial-gradient(circle at 82% 24%, color-mix(in srgb, var(--m3d-p2) 18%, transparent), transparent 48%),
    radial-gradient(circle at 50% 90%, color-mix(in srgb, var(--m3d-p3) 14%, transparent), transparent 52%),
    linear-gradient(180deg, var(--bg-3d-base) 0%, #090d1c 58%, #04060d 100%);
}
body.ui-3d #muse-3d-backdrop { display: block; }

#muse-3d-backdrop .muse-stars {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(255,255,255,0.85), transparent),
    radial-gradient(1.2px 1.2px at 28% 42%, rgba(255,255,255,0.65), transparent),
    radial-gradient(1.8px 1.8px at 46% 14%, var(--m3d-p1), transparent),
    radial-gradient(1.3px 1.3px at 68% 30%, rgba(255,255,255,0.75), transparent),
    radial-gradient(1.6px 1.6px at 84% 16%, var(--m3d-p3), transparent),
    radial-gradient(1.2px 1.2px at 92% 52%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 18% 66%, var(--m3d-p2), transparent),
    radial-gradient(1.2px 1.2px at 58% 60%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.6px 1.6px at 76% 74%, var(--m3d-p1), transparent);
  background-size: 320px 320px;
  animation: museTwinkle 8s ease-in-out infinite alternate;
}

#muse-3d-backdrop .muse-grid-floor {
  position: absolute;
  left: -30%;
  right: -30%;
  bottom: -18%;
  height: 55vh;
  background-image:
    linear-gradient(var(--m3d-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--m3d-grid) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(680px) rotateX(68deg);
  transform-origin: center bottom;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.72) 10%, transparent 92%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.72) 10%, transparent 92%);
  animation: museGridDrift 18s linear infinite;
}

#muse-3d-backdrop .muse-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(44px);
  opacity: 0.44;
  will-change: transform;
}
#muse-3d-backdrop .muse-orb.o1 {
  width: 300px; height: 300px; top: -60px; left: -50px;
  background: radial-gradient(circle, var(--m3d-p1) 0%, transparent 70%);
  animation: museFloatA 14s ease-in-out infinite alternate;
}
#muse-3d-backdrop .muse-orb.o2 {
  width: 340px; height: 340px; top: 28%; right: -90px;
  background: radial-gradient(circle, var(--m3d-p2) 0%, transparent 70%);
  animation: museFloatB 17s ease-in-out infinite alternate;
}
#muse-3d-backdrop .muse-orb.o3 {
  width: 260px; height: 260px; bottom: -40px; left: 32%;
  background: radial-gradient(circle, var(--m3d-p3) 0%, transparent 70%);
  animation: museFloatA 20s ease-in-out infinite alternate-reverse;
}

@keyframes museTwinkle { 0% { opacity: 0.35; } 100% { opacity: 0.72; } }
@keyframes museGridDrift { 0% { background-position: 0 0, 0 0; } 100% { background-position: 0 46px, 0 0; } }
@keyframes museFloatA { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(34px,26px,0) scale(1.12); } }
@keyframes museFloatB { 0% { transform: translate3d(0,0,0) scale(1.05); } 100% { transform: translate3d(-36px,-28px,0) scale(0.95); } }

/* Konten di atas Latar 3D */
body.ui-3d #auth-screen,
body.ui-3d #app,
body.ui-3d .app-shell,
body.ui-3d .main-content {
  position: relative;
  z-index: 1;
  background: transparent !important;
}

/* Sidebar & Topbar Kaca */
body.ui-3d .sidebar {
  background: var(--glass-bg-strong) !important;
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-right: 1px solid var(--glass-border) !important;
  box-shadow: 12px 0 36px rgba(0, 0, 0, 0.58), inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

body.ui-3d .topbar,
body.ui-3d .chat-topbar,
body.ui-3d .mobile-header {
  background: rgba(10, 15, 28, 0.74) !important;
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--glass-border) !important;
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.68), inset 0 -1px 0 rgba(255, 255, 255, 0.07);
}

/* Kartu Kaca 3D */
body.ui-3d .card,
body.ui-3d .stat-card,
body.ui-3d .anl-stat-box,
body.ui-3d .prompt-card,
body.ui-3d .gallery-card,
body.ui-3d .guide-card,
body.ui-3d .apidoc-card,
body.ui-3d .auth-card {
  position: relative;
  background: linear-gradient(155deg, rgba(24, 33, 58, 0.76) 0%, rgba(12, 17, 32, 0.79) 100%) !important;
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
  border: 1px solid var(--glass-border) !important;
  border-radius: 16px !important;
  box-shadow: var(--shadow-3d-card) !important;
  transform-style: preserve-3d;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  overflow: hidden;
}

body.ui-3d .card::before,
body.ui-3d .stat-card::before,
body.ui-3d .anl-stat-box::before,
body.ui-3d .gallery-card::before,
body.ui-3d .prompt-card::before,
body.ui-3d .auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), var(--m3d-sheen), transparent 62%);
  opacity: 0;
  transition: opacity 0.28s ease;
}

body.ui-3d .card:hover::before,
body.ui-3d .stat-card:hover::before,
body.ui-3d .anl-stat-box:hover::before,
body.ui-3d .gallery-card:hover::before,
body.ui-3d .prompt-card:hover::before,
body.ui-3d .auth-card:hover::before,
body.ui-3d .tilt-active::before { opacity: 1; }

body.ui-3d .card:hover,
body.ui-3d .stat-card:hover,
body.ui-3d .anl-stat-box:hover,
body.ui-3d .gallery-card:hover,
body.ui-3d .prompt-card:hover {
  border-color: var(--m3d-border-hover) !important;
  box-shadow:
    0 24px 48px -14px rgba(0, 0, 0, 0.85),
    0 0 24px -6px var(--m3d-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}

/* Modal 3D */
body.ui-3d .modal-backdrop {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(3, 6, 14, 0.74) !important;
}
body.ui-3d .modal-box {
  background: linear-gradient(160deg, rgba(22, 31, 56, 0.94), rgba(10, 14, 28, 0.96)) !important;
  border: 1px solid var(--m3d-border-hover) !important;
  border-radius: 18px !important;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.85), 0 0 36px var(--m3d-sheen), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  animation: museModalPop 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes museModalPop {
  from { opacity: 0; transform: perspective(900px) translateY(16px) scale(0.96) rotateX(6deg); }
  to { opacity: 1; transform: perspective(900px) translateY(0) scale(1) rotateX(0deg); }
}

/* Tombol 3D Taktil */
body.ui-3d .btn {
  border-radius: 11px !important;
  font-weight: 600;
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, filter 0.18s ease;
}
body.ui-3d .btn-primary {
  background: linear-gradient(135deg, var(--m3d-p1) 0%, var(--m3d-p2) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.24) !important;
  box-shadow: 0 5px 0 var(--m3d-btn-depth), 0 10px 22px -6px var(--m3d-glow), inset 0 1px 0 rgba(255, 255, 255, 0.32) !important;
}
body.ui-3d .btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}
body.ui-3d .btn-primary:active {
  transform: translateY(3px) !important;
  box-shadow: 0 2px 0 var(--m3d-btn-depth), 0 4px 10px -4px var(--m3d-glow) !important;
}
body.ui-3d .btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #0ea5a0 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 4px 0 #0f6848, 0 10px 20px -6px rgba(34, 197, 94, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}
body.ui-3d .btn-success:active { transform: translateY(3px) !important; box-shadow: 0 1px 0 #0f6848 !important; }
body.ui-3d .btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #be123c 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 4px 0 #7f1d1d, 0 10px 20px -6px rgba(239, 68, 68, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}
body.ui-3d .btn-danger:active { transform: translateY(3px) !important; box-shadow: 0 1px 0 #7f1d1d !important; }

body.ui-3d .btn-secondary,
body.ui-3d .icon-btn,
body.ui-3d .msg-action-btn {
  background: linear-gradient(180deg, rgba(34, 46, 78, 0.78), rgba(18, 25, 46, 0.82)) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}
body.ui-3d .btn-secondary:active,
body.ui-3d .icon-btn:active,
body.ui-3d .msg-action-btn:active { transform: translateY(2px) !important; }

/* Navigasi & Pil 3D */
body.ui-3d .nav-btn,
body.ui-3d .chat-item { border-radius: 11px !important; transition: transform 0.16s ease, background 0.2s ease; }
body.ui-3d .nav-btn:hover,
body.ui-3d .chat-item:hover { transform: translateX(3px); background: var(--m3d-sheen) !important; }
body.ui-3d .nav-btn.active,
body.ui-3d .chat-item.active,
body.ui-3d .admin-tab.active,
body.ui-3d .mode-pill.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--m3d-p1) 30%, transparent), color-mix(in srgb, var(--m3d-p2) 30%, transparent)) !important;
  border: 1px solid var(--m3d-border-hover) !important;
  box-shadow: 0 6px 18px -6px var(--m3d-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}
body.ui-3d .mode-pill,
body.ui-3d .admin-tab {
  background: rgba(20, 28, 50, 0.72) !important;
  border: 1px solid rgba(255, 255, 255, 0.11) !important;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Input & Chat Bubbles 3D */
body.ui-3d input:not([type="checkbox"]):not([type="radio"]),
body.ui-3d select,
body.ui-3d textarea {
  background: rgba(8, 12, 24, 0.76) !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  border-radius: 11px !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.48), 0 1px 0 rgba(255, 255, 255, 0.06);
}
body.ui-3d input:focus,
body.ui-3d select:focus,
body.ui-3d textarea:focus {
  border-color: var(--m3d-p1) !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 0 3px var(--m3d-sheen) !important;
}

body.ui-3d .msg-user .msg-bubble,
body.ui-3d .message.user .bubble,
body.ui-3d .message.user .msg-body {
  background: linear-gradient(135deg, var(--m3d-p1) 0%, var(--m3d-p2) 100%) !important;
  border: 1px solid rgba(255, 255, 255, 0.24) !important;
  border-radius: 16px 16px 4px 16px !important;
  box-shadow: 0 12px 26px -10px var(--m3d-glow), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

body.ui-3d .msg-assistant .msg-bubble,
body.ui-3d .message.assistant .bubble,
body.ui-3d .message.assistant .msg-body {
  background: linear-gradient(160deg, rgba(22, 30, 54, 0.78), rgba(13, 18, 34, 0.84)) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.11) !important;
  border-radius: 16px 16px 16px 4px !important;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

body.ui-3d .chat-input-wrap,
body.ui-3d .composer,
body.ui-3d .chat-composer {
  background: linear-gradient(180deg, rgba(16, 22, 40, 0.78), rgba(9, 13, 25, 0.92)) !important;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--m3d-border-hover) !important;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.52);
}

body.ui-3d .anl-row {
  background: rgba(15, 21, 38, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
}

/* === Pemilih Tema Warna 3D di Sidebar === */
.muse-3d-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.muse-palette-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.muse-swatch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 21, 38, 0.72);
  color: #cbd5e1;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.muse-swatch-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.muse-swatch-btn.active {
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

/* === Widget Objek Kristal Hologram 3D Interaktif === */
.muse-holo-stage {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 10px;
  user-select: none;
  -webkit-user-select: none;
}
body.ui-3d .muse-holo-stage { display: flex; }

.muse-holo-canvas {
  width: 148px;
  height: 148px;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 0 18px var(--m3d-glow));
}
.muse-holo-canvas:active { cursor: grabbing; }
.muse-holo-hint {
  font-size: 0.7rem;
  color: rgba(203, 213, 225, 0.72);
  letter-spacing: 0.03em;
}

/* === Gauge Melingkar 3D untuk Resource VPS Live === */
.muse-vps-rings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.muse-vps-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.84rem;
}
.muse-rings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.muse-ring-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 14px;
  background: rgba(8, 13, 26, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 8px 18px -10px rgba(0, 0, 0, 0.8);
}
.muse-ring-svg-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.muse-ring-svg-wrap svg {
  width: 72px;
  height: 72px;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 6px var(--ring-color, var(--m3d-p1)));
}
.muse-ring-val {
  position: absolute;
  font-size: 0.84rem;
  font-weight: 700;
  color: #f8fafc;
}
.muse-ring-lbl {
  font-size: 0.74rem;
  font-weight: 600;
  color: #e2e8f0;
}
.muse-ring-sub {
  font-size: 0.68rem;
  color: #94a3b8;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  #muse-3d-backdrop .muse-grid-floor,
  #muse-3d-backdrop .muse-orb,
  #muse-3d-backdrop .muse-stars { animation: none !important; }
}

/* TRANSPARENCY OVERRIDE v29 */
body.ui-3d #app,
body.ui-3d .app-layout,
body.ui-3d .app-container,
body.ui-3d .main-panel,
body.ui-3d .main-area,
body.ui-3d .main-content,
body.ui-3d .view-panel,
body.ui-3d .panel-container,
body.ui-3d .chat-layout,
body.ui-3d .chat-container,
body.ui-3d .chat-messages,
body.ui-3d #messages-container {
  background: transparent !important;
  background-color: transparent !important;
}

/* Pertajam visibilitas grid 3D & aurora di layar HP */
body.ui-3d #muse-3d-backdrop .muse-grid-floor {
  background-image:
    linear-gradient(color-mix(in srgb, var(--m3d-p1) 26%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--m3d-p1) 26%, transparent) 1px, transparent 1px);
}
body.ui-3d #muse-3d-backdrop .muse-orb {
  opacity: 0.58;
}

/* Efek 3D pada topbar chat, pill spek model, & tombol kirim bulat */
body.ui-3d .chat-header,
body.ui-3d .chat-toolbar,
body.ui-3d .model-specs-bar,
body.ui-3d .model-badges {
  background: rgba(11, 16, 32, 0.62) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

body.ui-3d .spec-chip,
body.ui-3d .model-chip,
body.ui-3d .pill-badge {
  background: rgba(20, 30, 56, 0.72) !important;
  border: 1px solid rgba(130, 174, 255, 0.25) !important;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

body.ui-3d .send-btn,
body.ui-3d #btn-send {
  background: linear-gradient(135deg, var(--m3d-p1), var(--m3d-p2)) !important;
  box-shadow: 0 4px 0 var(--m3d-btn-depth), 0 8px 20px -4px var(--m3d-glow), inset 0 1px 0 rgba(255,255,255,0.35) !important;
  border: 1px solid rgba(255,255,255,0.22) !important;
}
body.ui-3d .send-btn:active,
body.ui-3d #btn-send:active {
  transform: translateY(3px) !important;
  box-shadow: 0 1px 0 var(--m3d-btn-depth) !important;
}
