/* ==========================================================================
   MASS PANDA - PREMIUM MONOCHROME DARK STYLING ENGINE (2026 SaaS STANDARD)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Readex+Pro:wght@300;400;500;600;700&family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=Alexandria:wght@300;400;500;600;700&family=Vazirmatn:wght@400;600;700&family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* FOUC Prevention for Localized Refresh */
html.i18n-loading body {
  opacity: 0 !important;
  visibility: hidden !important;
}

body {
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

:root {
  --color-bg: #030303;
  --color-card: #09090b;
  --color-card-border: #18181b;
  --color-card-hover: #121215;
  --color-border-subtle: #27272a;
  --color-text-main: #f4f4f5;
  --color-text-muted: #a1a1aa;
  --color-text-dim: #71717a;
  --color-accent-green: #10b981;
  --color-accent-red: #ef4444;
}

/* Custom Dual-Circle Cursor System */
@media (pointer: fine) {
  body, button, a, input, select, textarea, [role="button"], label {
    cursor: none !important;
  }
}

#custom-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 6px;
  height: 6px;
  background-color: #ffffff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.15s ease, height 0.15s ease, background-color 0.15s ease, opacity 0.2s ease;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

#custom-cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), height 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease, background-color 0.25s ease, opacity 0.2s ease;
}

/* Cursor Hover Micro-Interaction */
body.cursor-hover #custom-cursor-dot {
  width: 10px;
  height: 10px;
  background-color: #10b981;
  box-shadow: 0 0 14px #10b981;
}

body.cursor-hover #custom-cursor-ring {
  width: 52px;
  height: 52px;
  border-color: rgba(16, 185, 129, 0.6);
  background-color: rgba(16, 185, 129, 0.05);
}

/* Big Inverting Cursor Effect on Titles & Headers */
body.cursor-header-hover #custom-cursor-dot {
  opacity: 0;
}

body.cursor-header-hover #custom-cursor-ring {
  width: 96px;
  height: 96px;
  background-color: #ffffff;
  border-color: #ffffff;
  mix-blend-mode: difference;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #030303;
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

/* Base resets & typography */
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: opacity 0.25s ease-in-out;
}

/* Arabic & Persian Font Overrides */
html[lang="ar"], html[lang="fa"], html[lang="ur"] {
  font-family: 'Cairo', 'Vazirmatn', 'Inter', system-ui, sans-serif !important;
}

html[lang="he"] {
  font-family: 'Vazirmatn', 'Inter', system-ui, sans-serif !important;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Smooth Language Switcher Transition Class */
.lang-fade-out {
  opacity: 0.15;
  transform: scale(0.995);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Technical Grid Background */
.bg-grid-pattern {
  background-size: 32px 32px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

.bg-radial-vignette {
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.04) 0%, rgba(3, 3, 3, 0.95) 75%);
}

/* Glow & Glass Cards */
.glass-panel {
  background: rgba(9, 9, 11, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-card-border);
}

.glass-nav {
  background: rgba(3, 3, 3, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.panda-card {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.panda-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.8), 0 0 20px 1px rgba(255, 255, 255, 0.03);
}

/* Glowing Nodes for Command Center */
.node-core {
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.25), 0 0 60px rgba(255, 255, 255, 0.1);
  animation: core-pulse 3s infinite ease-in-out;
}

@keyframes core-pulse {
  0%, 100% {
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.2), 0 0 50px rgba(255, 255, 255, 0.05);
  }
  50% {
    box-shadow: 0 0 45px rgba(255, 255, 255, 0.4), 0 0 80px rgba(255, 255, 255, 0.15);
  }
}

/* Telemetry Log Stream */
.telemetry-ticker {
  mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

/* Toast Stacking & Animation */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  pointer-events: none;
}

html[dir="rtl"] .toast-container {
  right: auto;
  left: 24px;
}

.toast-item {
  pointer-events: auto;
  animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal Drawer Overlay */
.modal-overlay {
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.2s ease-out;
}

.modal-content {
  animation: modal-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* FAQ Accordion Hide/Show Rules */
.accordion-content {
  display: none;
}

.accordion-item[open] .accordion-content {
  display: block;
  animation: fade-in 0.2s ease-out;
}

.accordion-chevron {
  transition: transform 0.25s ease;
}

.accordion-item[open] .accordion-chevron {
  transform: rotate(180deg);
}

/* Floating Headset Support Button with Radiating Ripple Circles */
.support-headset-wrapper {
  position: relative;
  display: inline-block;
}

.support-ripple-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.6);
  animation: support-ripple-expand 2.4s cubic-bezier(0, 0.2, 0.8, 1) infinite;
  pointer-events: none;
}

.support-ripple-ring:nth-child(2) {
  animation-delay: 0.8s;
}

.support-ripple-ring:nth-child(3) {
  animation-delay: 1.6s;
}

@keyframes support-ripple-expand {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

.support-headset-btn {
  position: relative;
  z-index: 10;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
  color: #030303;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 255, 255, 0.25);
  transition: all 0.25s ease;
}

.support-headset-btn:hover {
  transform: scale(1.1);
  background: #ffffff;
  box-shadow: 0 14px 30px -4px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 255, 255, 0.4);
}

/* RTL Layout & Typography Enhancements - Beiruti Font Enforcement */
html[dir="rtl"] {
  text-align: right;
}

html[lang="ar"],
html[lang="ar"] body,
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3, html[lang="ar"] h4, html[lang="ar"] h5, html[lang="ar"] h6,
html[lang="ar"] p, html[lang="ar"] span, html[lang="ar"] a, html[lang="ar"] button, html[lang="ar"] input, html[lang="ar"] select, html[lang="ar"] textarea, html[lang="ar"] div,
html[lang="ur"],
html[lang="ur"] body,
html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] h3, html[lang="ur"] h4, html[lang="ur"] h5, html[lang="ur"] h6,
html[lang="ur"] p, html[lang="ur"] span, html[lang="ur"] a, html[lang="ur"] button,
[dir="rtl"],
[dir="rtl"] body,
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6,
[dir="rtl"] p, [dir="rtl"] span, [dir="rtl"] a, [dir="rtl"] button, [dir="rtl"] input, [dir="rtl"] select, [dir="rtl"] textarea, [dir="rtl"] div {
  font-family: 'Readex Pro', 'IBM Plex Sans Arabic', 'Alexandria', system-ui, -apple-system, sans-serif !important;
}

html[lang="fa"],
html[lang="fa"] body,
html[lang="fa"] h1, html[lang="fa"] h2, html[lang="fa"] h3, html[lang="fa"] h4, html[lang="fa"] h5, html[lang="fa"] h6,
html[lang="fa"] p, html[lang="fa"] span, html[lang="fa"] a, html[lang="fa"] button {
  font-family: 'Vazirmatn', 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif !important;
}

html[dir="rtl"] .rtl-flip {
  transform: scaleX(-1);
}

/* RTL Modal Close Button Flip ("X" on the left side in RTL mode) */
html[dir="rtl"] .modal-content > button[onclick*="close"],
html[dir="rtl"] .modal-content > button[onclick*="UI.closeModal"] {
  right: auto !important;
  left: 1.5rem !important;
}

html[dir="rtl"] .modal-content {
  text-align: right;
}

/* Focus Ring Customization */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

/* Accessibility Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .support-ripple-ring {
    display: none !important;
  }
  #custom-cursor-dot, #custom-cursor-ring {
    display: none !important;
  }
}

/* Mobile Viewport Horizontal Overflow Lock & Modal Scroll Isolation */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  width: 100% !important;
}

/* Prevent body / background scrolling when any modal is active */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  height: 100vh !important;
  overscroll-behavior: none !important;
}

.modal-overlay {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  overscroll-behavior: contain !important;
}

.modal-content {
  min-width: 0;
  overscroll-behavior: contain !important;
}

/* Modal Width Architecture:
   - Wide Modals: Video Gallary & Dev Library (up to 80rem / 1280px)
   - Less Wide (Compact) Modal: Inspect Tool (42rem / 672px)
*/
#tool-modal .modal-content {
  max-width: min(42rem, calc(100vw - 1.5rem)) !important;
  width: 100% !important;
}

#dev-library-modal .modal-content,
#video-library-modal .modal-content,
#all-tools-modal .modal-content {
  max-width: min(80rem, calc(100vw - 1.5rem)) !important;
  width: 100% !important;
}

#video-player-modal .modal-content,
#video-player-modal > div {
  max-width: min(56rem, calc(100vw - 1.5rem)) !important;
  width: 100% !important;
}

#support-modal .modal-content {
  max-width: min(44rem, calc(100vw - 1.5rem)) !important;
  width: 100% !important;
}

/* RTL Navbar & Dropdown Alignment */
html[dir="rtl"] #nav-actions-wrap {
  margin-left: 0 !important;
  margin-right: auto !important;
}

html[dir="rtl"] #lang-dropdown-menu {
  right: auto !important;
  left: 0 !important;
}

/* RTL Directional Icon Flip inside Buttons & Links */
html[dir="rtl"] button .ph-arrow-right,
html[dir="rtl"] a .ph-arrow-right,
html[dir="rtl"] button .ph-arrow-left,
html[dir="rtl"] a .ph-arrow-left,
html[dir="rtl"] button .ph-caret-left,
html[dir="rtl"] a .ph-caret-left,
html[dir="rtl"] button .ph-caret-right,
html[dir="rtl"] a .ph-caret-right,
html[dir="rtl"] button .ph-arrow-up-right,
html[dir="rtl"] a .ph-arrow-up-right {
  display: inline-block;
  transform: scaleX(-1);
}
