/* ==========================================================================
   4DVERTEX × Open-Higgsfield-AI — Minimal Matte Studio Design System (No Glow)
   Palette: Pure Matte Dark (#050505 / #111111 / #1a1a1a) + Flat Lime (#d9ff00)
   Typography: Vazirmatn (FA/RTL) + Poppins & JetBrains Mono (EN/LTR)
   ========================================================================== */

:root {
  --bg-app: #050505;
  --bg-panel: #0d0d0d;
  --bg-dock: #111111;
  --bg-card: #141414;
  --bg-elevated: #1a1a1a;
  --color-primary: #d9ff00;
  --color-primary-hover: #ffffff;
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-default: rgba(255, 255, 255, 0.10);
  --border-hover: rgba(255, 255, 255, 0.20);
}

* {
  box-sizing: border-box;
}

html, body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[dir="rtl"] body {
  font-family: 'Vazirmatn', 'Poppins', sans-serif;
}

html[dir="ltr"] body {
  font-family: 'Poppins', 'Vazirmatn', sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace !important;
}

/* Pure Matte Surfaces — Zero Neon Glow */
.bg-studio-mesh {
  background-color: #050505;
}

.hf-glass {
  background: rgba(17, 17, 17, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hf-card {
  background: #0f0f11;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.hf-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

/* Flat High-Contrast Primary Button (No Glow) */
.hf-btn-primary {
  background-color: #d9ff00;
  color: #000000;
  font-weight: 800;
  transition: background-color 0.15s ease, transform 0.1s ease;
  box-shadow: none !important;
}

.hf-btn-primary:hover:not(:disabled) {
  background-color: #ffffff;
  color: #000000;
  box-shadow: none !important;
}

.hf-btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.hf-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Neutralize any legacy glow classes */
.shadow-glow,
.shadow-glow-sm,
.shadow-glow-lg {
  box-shadow: none !important;
}

.text-shadow-glow,
.text-shadow-sm {
  text-shadow: none !important;
}

/* Sidebar Active Item — Minimal Flat Style */
.sidebar-item-active {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Open-Higgsfield Studio Top Navigation Link */
.hf-studio-nav-link {
  position: relative;
  color: #71717a;
  font-size: 13px;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  transition: color 0.15s ease;
  cursor: pointer;
}

.hf-studio-nav-link:hover {
  color: #ffffff;
}

.hf-studio-nav-link.active {
  color: #ffffff;
}

.hf-studio-nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 9999px;
  background-color: #d9ff00;
}

/* Open-Higgsfield Floating Prompt Dock */
.hf-prompt-dock {
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 2rem;
  transition: border-color 0.2s ease;
}

.hf-prompt-dock:focus-within {
  border-color: rgba(255, 255, 255, 0.20);
}

/* Prompt Dock Pill Controls */
.hf-dock-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0.875rem;
  font-size: 12px;
  font-weight: 700;
  color: #e4e4e7;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}

.hf-dock-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.hf-dock-pill.active-pill {
  background: rgba(217, 255, 0, 0.10);
  border-color: rgba(217, 255, 0, 0.35);
  color: #d9ff00;
}

/* Upward Floating Popover Menu */
.hf-popover-menu {
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.85);
}

/* Cinema Studio 2.0 Scroll-Wheel Column */
.hf-wheel-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 310px;
  background: #141414;
  border-radius: 1.75rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.hf-wheel-mask-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 76px;
  background: linear-gradient(to bottom, #141414 15%, rgba(20, 20, 20, 0.82) 60%, transparent 100%);
  z-index: 20;
  pointer-events: none;
}

.hf-wheel-mask-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 76px;
  background: linear-gradient(to top, #141414 15%, rgba(20, 20, 20, 0.82) 60%, transparent 100%);
  z-index: 20;
  pointer-events: none;
}

.hf-wheel-center-indicator {
  position: absolute;
  top: 50%;
  left: 10px;
  right: 10px;
  height: 96px;
  transform: translateY(-50%);
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
  pointer-events: none;
  z-index: 5;
}

/* Scrollbar Utilities */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: #080808;
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (min-width: 768px) {
  #mainAppSidebar {
    transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #mainAppSidebar.sidebar-is-collapsed .sidebar-collapse-hide {
    display: none !important;
  }
  #mainAppSidebar.sidebar-is-collapsed nav button {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
  #mainAppSidebar.sidebar-is-collapsed .sidebar-header-row {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }
}

/* ==========================================================================
   OFF-CANVAS SIDEBAR DRAWER & RESPONSIVE MOBILE STUDIO CONTROLS
   ========================================================================== */
.hf-drawer-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.hf-drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Permanent Off-Canvas Sidebar Drawer — Zero permanent space occupied on any screen */
#mainAppSidebar,
.hf-sidebar-drawer {
  position: fixed !important;
  top: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #090a0c;
  z-index: 95;
  display: flex !important;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
html[dir="rtl"] #mainAppSidebar,
html[dir="rtl"] .hf-sidebar-drawer {
  right: 0 !important;
  left: auto !important;
  transform: translateX(100%);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
html[dir="rtl"] #mainAppSidebar.open,
html[dir="rtl"] .hf-sidebar-drawer.open {
  transform: translateX(0) !important;
}
html[dir="ltr"] #mainAppSidebar,
html[dir="ltr"] .hf-sidebar-drawer {
  left: 0 !important;
  right: auto !important;
  transform: translateX(-100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}
html[dir="ltr"] #mainAppSidebar.open,
html[dir="ltr"] .hf-sidebar-drawer.open {
  transform: translateX(0) !important;
}

/* Horizontal swipe rail for parameter pills on mobile */
.hf-pills-rail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x;
}
.hf-pills-rail::-webkit-scrollbar {
  display: none;
}

/* Subtle dim backdrop for popovers (NO BLUR over the sheet) */
.hf-popover-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.65);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.hf-popover-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.hf-popover-menu {
  pointer-events: auto !important;
}

/* Mobile Bottom Sheet Popover */
@media (max-width: 639px) {
  .hf-mobile-sheet {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-height: 80vh !important;
    border-radius: 1.5rem 1.5rem 0 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-bottom: none !important;
    background: #111215 !important;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.95) !important;
    z-index: 100 !important;
    pointer-events: auto !important;
    animation: sheetUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  }

  /* Mobile Stack for Prompt Dock Parameters & Generate Button */
  #hfDockParamsRow {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }
  #hfDockParamsRow .hf-pills-rail {
    width: 100% !important;
    padding-bottom: 3px !important;
  }
  #hfDockActionsRight {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
  }
  #btnRunTester {
    width: 100% !important;
    height: 48px !important;
    justify-content: center !important;
    font-size: 14px !important;
    border-radius: 1rem !important;
  }
}

@keyframes sheetUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   HIGGSFIELD 4.0 & WORKSTATION STUDIO LEFT SIDEBAR (RESPONSIVE DRAWER)
   ========================================================================== */

/* Desktop (>= 768px): Fixed width side panel */
@media (min-width: 768px) {
  #hfStudioLeftSidebar {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 260px !important;
    height: 100% !important;
    transform: none !important;
    flex-shrink: 0 !important;
    z-index: 20 !important;
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  #hfStudioLeftSidebar.collapsed {
    width: 54px !important;
  }

  #hfStudioLeftSidebar.collapsed .hf-sidebar-label {
    display: none !important;
  }

  #hfStudioLeftSidebar.collapsed .hf-sidebar-item,
  #hfStudioLeftSidebar.collapsed .hf-sidebar-nav-btn {
    justify-content: center !important;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
  }

  #hfStudioLeftSidebar.collapsed .hf-sidebar-badge {
    display: none !important;
  }
}

/* Mobile (< 768px): Off-canvas slide-out drawer (prevents black screen!) */
@media (max-width: 767px) {
  #hfStudioLeftSidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    width: 280px !important;
    max-width: 82vw !important;
    background-color: #0c0c0e !important;
    z-index: 95 !important;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.95) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  html[dir="rtl"] #hfStudioLeftSidebar {
    right: 0 !important;
    left: auto !important;
    transform: translateX(100%) !important;
  }

  html[dir="rtl"] #hfStudioLeftSidebar.open {
    transform: translateX(0) !important;
  }

  html[dir="ltr"] #hfStudioLeftSidebar {
    left: 0 !important;
    right: auto !important;
    transform: translateX(-100%) !important;
  }

  html[dir="ltr"] #hfStudioLeftSidebar.open {
    transform: translateX(0) !important;
  }
}

#hfStudioSidebarBackdrop {
  z-index: 90 !important;
  transition: opacity 0.25s ease;
}




/* Higgsfield 4.0 Studio Canvas & Floating Dock Layout */
#hfStudioFeedContainer {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}
#hfStudioFeedContainer::-webkit-scrollbar {
  width: 6px;
}
#hfStudioFeedContainer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}

#hfPromptDockWrapper .hf-prompt-dock,
#hfPromptDockWrapper .hf-popover-menu,
#hfPromptDockWrapper #hfMinimizedDockBar,
#hfPromptDockWrapper #hfApiCodeDrawer {
  pointer-events: auto;
}


/* ============================================================================
   EXACT HIGGSFIELD WORKSTATION REFERENCE UI STYLES
   ============================================================================ */

/* Main studio background & typography */
.hf-studio-workspace {
  background-color: #0c0c0e !important;
  color: #e4e4e7;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Left Sidebar Styles */
.hf-ref-sidebar {
  background-color: #0c0c0e;
  border-color: rgba(255, 255, 255, 0.07);
}

.hf-sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.45rem 0.625rem;
  border-radius: 0.625rem;
  font-size: 12.5px;
  font-weight: 500;
  color: #a1a1aa;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.hf-sidebar-nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.hf-sidebar-nav-btn.active {
  background-color: #1a1a1e;
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.06);
}

/* Vertical Image / Video Switcher on Dock */
.hf-vertical-mode-switch {
  display: flex;
  flex-direction: column;
  background-color: #131417;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 1.125rem;
  padding: 0.25rem;
  gap: 0.2rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.hf-mode-switch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.6rem;
  border-radius: 0.875rem;
  color: #71717a;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.15s ease;
  cursor: pointer;
}

.hf-mode-switch-btn i {
  font-size: 13px;
  margin-bottom: 2px;
}

.hf-mode-switch-btn:hover {
  color: #d4d4d8;
  background-color: rgba(255, 255, 255, 0.04);
}

.hf-mode-switch-btn.active {
  background-color: #222328;
  color: #ffffff;
}

/* Reference Composer Dock Card */
.hf-ref-composer-card {
  background: rgba(20, 21, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  pointer-events: auto;
  transition: border-color 0.2s ease;
}

.hf-ref-composer-card:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
}

/* Reference Dock Parameter Pills */
.hf-ref-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.35rem 0.65rem;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0.75rem;
  font-size: 11.5px;
  font-weight: 600;
  color: #d4d4d8;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.hf-ref-pill:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.hf-ref-pill-icon {
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #a1a1aa;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hf-ref-pill-icon:hover {
  background-color: rgba(255, 255, 255, 0.10);
  color: #ffffff;
}

/* Neon Yellow-Green Generate Button with Stacked Label & Credits */
.hf-ref-generate-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 1.25rem;
  background: #e2f952;
  border: none;
  border-radius: 1rem;
  color: #000000;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(226, 249, 82, 0.35);
}

.hf-ref-generate-btn:hover {
  background: #ecff66;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(226, 249, 82, 0.45);
}

.hf-ref-generate-btn:active {
  transform: translateY(1px);
  background: #d4eb44;
}

.hf-ref-generate-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
}

.hf-ref-generate-cost {
  font-size: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  opacity: 0.85;
  line-height: 1.2;
}

/* ==========================================================================
   4DVERTEX GENERATING PLACEHOLDER CARD & CYBER SCANNER ANIMATIONS
   ========================================================================== */

@keyframes hfLaserSweep {
  0% { top: 0%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

@keyframes hfSpinSlow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes hfSpinReverse {
  0% { transform: rotate(360deg); }
  100% { transform: rotate(0deg); }
}

@keyframes hfWaveBars {
  0%, 100% { height: 4px; }
  50% { height: 20px; }
}

@keyframes hfPulseGlow {
  0%, 100% { opacity: 0.4; filter: drop-shadow(0 0 6px rgba(217, 255, 0, 0.4)); }
  50% { opacity: 0.9; filter: drop-shadow(0 0 16px rgba(217, 255, 0, 0.8)); }
}

.hf-cyber-grid-bg {
  background-size: 20px 20px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
}

.hf-generating-card {
  position: relative;
  border-radius: 1rem;
  background: #0d0e12;
  border: 1px solid rgba(217, 255, 0, 0.35);
  box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.8), 0 0 20px rgba(217, 255, 0, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hf-laser-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #d9ff00 50%, transparent 100%);
  box-shadow: 0 0 14px #d9ff00, 0 0 4px #ffffff;
  z-index: 15;
  pointer-events: none;
  animation: hfLaserSweep 2.5s ease-in-out infinite;
}

.hf-radar-ring-outer {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  border: 1px dashed rgba(217, 255, 0, 0.35);
  animation: hfSpinSlow 10s linear infinite;
}

.hf-radar-ring-inner {
  position: absolute;
  inset: 6px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: hfSpinReverse 6s linear infinite;
}

.hf-radar-spinner {
  position: absolute;
  inset: 12px;
  border-radius: 9999px;
  border: 2px solid transparent;
  border-top-color: #d9ff00;
  border-bottom-color: #00f0ff;
  animation: hfSpinSlow 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
