:root {
  /* -- INDUSTRIAL BRAND PALETTE -- */
  --bg: #050505;
  --bg-elevated: #0f0f11;
  --bg-glass: rgba(10, 10, 12, 0.85);
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #52525b;
  --accent: #ff6b00; /* Neon Orange */
  --accent-glow: rgba(255, 107, 0, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  
  --font-main: "Inter", -apple-system, system-ui, sans-serif;
  --radius: 14px;
  --radius-lg: 24px;
  --transition: 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

[data-theme="light"] {
  --bg: #f4f4f5;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --text-primary: #000000;
  --text-secondary: #3f3f46;
  --text-tertiary: #71717a;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
}

/* --- LIGHT MODE SPECIFICS --- */
[data-theme="light"] body { color: var(--text-primary); }
[data-theme="light"] .nav-link { color: #000; opacity: 0.7; }
[data-theme="light"] .nav-link:hover { opacity: 1; color: var(--accent); }
[data-theme="light"] .hero-text { color: #000; }
[data-theme="light"] .subhead { color: #3f3f46; }
[data-theme="light"] .stat-value { color: #000; }
[data-theme="light"] .btn-secondary { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); color: #000; }
[data-theme="light"] .btn-secondary:hover { background: rgba(0,0,0,0.08); border-color: var(--accent); }
[data-theme="light"] #hero-viewer { opacity: 0.8; }
[data-theme="light"] #chatbot-container { background: #fff; border-color: var(--border-strong); color: #000; }
[data-theme="light"] .chat-header { background: #fff; border-color: var(--border); color: #000; }
[data-theme="light"] .chat-bubble.bot { background: #f4f4f5; color: #000; }
[data-theme="light"] .chat-input-area { background: #fff; }
[data-theme="light"] .chat-input-area input { background: #f4f4f5; color: #000; }
[data-theme="light"] .status-indicator { background: rgba(52, 199, 89, 0.15); }
[data-theme="light"] .glass-card { background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,0.05); }

/* -- BASE RESET & SCROLLING -- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; height: 100%; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* -- GLOBAL SVG ICON FIX -- */
svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.5; fill: none; display: inline-block; vertical-align: middle; }

/* -- BRAND LOGO SCALING -- */
.nav-brand svg, .footer-brand-logo svg {
  width: 140px;
  height: 32px;
  stroke: none !important;
  display: block;
  fill: currentColor; /* Ensure children can inherit or use their own */
}
.nav-brand svg text, .footer-brand-logo svg text {
  stroke: none !important;
}

/* -- LAYOUT UTILS -- */
.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 6rem 0; }
.w-full { width: 100%; }

/* -- NAVBAR (FLUID & BULLETPROOF) -- */
#navbar {
  position: fixed; top: 0; left: 0; width: 100%; height: 64px;
  background: var(--bg-glass); backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  z-index: 1000; border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.nav-content { 
  width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; 
  display: flex; align-items: center; justify-content: space-between; 
}
.nav-brand { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.04em; cursor: pointer; flex-shrink: 0; }

.nav-links { 
  display: flex; gap: 1.5rem; margin: 0 2rem; flex: 1; 
  overflow-x: auto; scrollbar-width: none; 
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link { 
  font-size: 0.85rem; font-weight: 500; opacity: 0.6; transition: 0.2s; 
  cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.nav-link:hover { opacity: 1; color: var(--accent); }
.nav-link svg { width: 18px; height: 18px; }

.nav-actions { display: flex; gap: 1.2rem; align-items: center; flex-shrink: 0; }

/* -- PAGES -- */
.page { display: none; padding-top: 64px; }
.page.active { display: block; }

/* -- HERO -- */
.hero-section {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 90vh;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 0;
  overflow: hidden;
}
.hero-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none; /* Let clicks pass to 3D model if needed, but buttons will have pointer-events auto */
}
.hero-content > * { pointer-events: auto; }

.hero-bg-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  z-index: 5;
  pointer-events: none;
}

#hero-viewer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 100%;
  z-index: 1;
  outline: none;
  opacity: 0.4; /* Dim the model to deepen blacks and help text pop */
}

@media (min-width: 1024px) {
  .hero-section { min-height: 95vh; }
  #hero-viewer { height: 120%; width: 120vw; }
}

.hero-text { 
  font-size: clamp(2.5rem, 8vw, 6rem); 
  font-weight: 900; 
  line-height: 0.95; 
  letter-spacing: -0.05em; 
  margin-bottom: 1.5rem; 
}

.subhead { 
  font-size: clamp(1rem, 2vw, 1.2rem); 
  color: #fff; 
  max-width: 600px; 
  margin-bottom: 2.5rem; 
  margin-left: auto; 
  margin-right: auto; 
  font-weight: 500; 
}

/* -- MAGNET BUTTON SYSTEM -- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.8rem 1.8rem; border-radius: 99px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: transform 0.2s var(--transition), background 0.3s ease;
  overflow: hidden; gap: 8px; white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px var(--accent-glow); }
.btn-secondary { background: rgba(255,255,255,0.03); border-color: var(--border-strong); color: #fff; }
.btn-secondary:hover { border-color: var(--accent); background: rgba(255,255,255,0.06); }

/* Cursor Follow Glow */
.btn::after {
  content: ''; position: absolute; top: var(--y, 50%); left: var(--x, 50%);
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  transform: translate(-50%, -50%); opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.btn:hover::after { opacity: 1; }

/* -- CARDS & GRIDS -- */
.glass-card { 
  background: var(--bg-elevated); border: 1px solid var(--border); 
  border-radius: var(--radius-lg); padding: 2rem; transition: var(--transition);
  height: 100%; display: flex; flex-direction: column;
}
.glass-card:hover { border-color: var(--accent); transform: translateY(-4px); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 2rem; padding: 4rem 0; border-top: 1px solid var(--border); }

.product-img { 
  aspect-ratio: 1; background: linear-gradient(135deg, #0f0f11 0%, #050505 100%); 
  border-radius: 16px; margin-bottom: 1.5rem; 
  display: flex; align-items: center; justify-content: center; 
  border: 1px solid var(--border); 
}
.product-img svg { width: 48px; height: 48px; stroke: var(--text-secondary); }

.param-group { margin-bottom: 1.5rem; }
.param-label { display: block; font-size: 0.7rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.param-input { width: 100%; background: #000; border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem; color: #fff; font-size: 1rem; outline: none; }
.price-display { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 0.5rem; }

/* -- MANUFACTURING CONFIGURATOR LAYOUT -- */
.costing-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 3rem;
  max-width: 1200px !important;
  margin: 0 auto;
  align-items: start;
}
.config-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0; /* Prevent flex children from overflowing */
}
.price-summary {
  position: sticky;
  top: 100px;
}

.quote-card-sticky {
  border-color: var(--accent);
  background: var(--bg-elevated);
}
[data-theme="dark"] .quote-card-sticky {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, #000 100%);
}
[data-theme="light"] .quote-card-sticky {
  background: #ffffff;
  border-width: 2px;
}

@media (max-width: 1100px) {
  .costing-grid { grid-template-columns: 1fr; gap: 2rem; }
  .price-summary { position: static; }
}

/* -- STATUS & STATS -- */
.stat-item { text-align: center; }
.stat-value { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; color: #fff; display: block; margin-bottom: 0.5rem; }
.stat-label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.1em; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue { background: rgba(59, 130, 246, 0.1); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-green { background: rgba(34, 197, 94, 0.1); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.2); }
.badge-orange { background: rgba(249, 115, 22, 0.1); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.2); }

.status-indicator { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 1rem; background: rgba(52, 199, 89, 0.1); border: 1px solid rgba(52, 199, 89, 0.2); border-radius: 99px; color: #34c759; font-size: 0.7rem; font-weight: 700; cursor: pointer; margin-bottom: 1rem; width: fit-content; }
.pulse-dot { width: 6px; height: 6px; background: #34c759; border-radius: 50%; box-shadow: 0 0 8px #34c759; position: relative; }
.pulse-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #34c759; animation: pulse 2s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(3); opacity: 0; } }

/* -- CART DRAWER -- */
#cart-drawer {
  position: fixed; top: 0; right: -440px; 
  width: min(420px, 100vw); height: 100vh;
  background: var(--bg-elevated); border-left: 1px solid var(--border);
  z-index: 1500; transition: right 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
}
#cart-drawer.open { right: 0; }

.cart-item {
  display: flex; gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.cart-item-thumb {
  width: 64px; height: 64px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.cart-item-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.cart-item-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.25rem; color: #fff; }
.cart-item-meta { font-size: 0.75rem; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.75rem; }
.cart-item-footer { display: flex; justify-content: space-between; align-items: center; }
.cart-item-price { font-weight: 700; color: var(--accent); font-size: 1rem; }

.qty-controls {
  display: flex; align-items: center;
  gap: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 4px;
}
.qty-btn {
  background: none; border: none; color: var(--text-secondary);
  width: 24px; height: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: 0.2s;
}
.qty-btn:hover { color: #fff; }
.qty-val { font-size: 0.85rem; font-weight: 700; color: #fff; min-width: 20px; text-align: center; }

.remove-item-btn {
  position: absolute; top: 1rem; right: 0;
  background: none; border: none; color: var(--text-tertiary);
  cursor: pointer; font-size: 1.1rem; padding: 4px;
  transition: 0.2s;
}
.remove-item-btn:hover { color: #ff3b30; }

#cart-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  z-index: 1400; display: none;
}
#cart-overlay.show { display: block; }

/* -- CHATBOT -- */
#chat-trigger { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 60px; height: 60px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,0.3); z-index: 1999; }
#chatbot-container { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 380px; height: 600px; max-width: calc(100vw - 3rem); max-height: calc(100vh - 6rem); background: #000; border: 1px solid var(--accent); border-radius: 28px; z-index: 2000; display: none; flex-direction: column; overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,0.8); }
.chat-header { padding: 1rem 1.5rem; background: #000; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.chat-controls { display: flex; gap: 0.5rem; align-items: center; }
.chat-control-btn { 
  background: none; border: none; color: var(--text-secondary); 
  cursor: pointer; padding: 4px; border-radius: 6px; 
  transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.chat-control-btn:hover { background: var(--bg-elevated); color: #fff; }
.chat-control-btn svg { width: 16px; height: 16px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.chat-bubble { padding: 0.8rem 1.2rem; border-radius: 18px; font-size: 0.9rem; max-width: 85%; line-height: 1.4; }
.chat-bubble.bot { background: var(--bg-elevated); color: #fff; border-bottom-left-radius: 4px; }
.chat-bubble.user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-note { font-size: 0.7rem; color: var(--text-tertiary); text-align: center; margin: 0.5rem 0; font-style: italic; }
.chat-input-area { padding: 1.25rem; border-top: 1px solid var(--border); display: flex; gap: 0.75rem; }
.chat-input-area input { flex: 1; background: #111; border: 1px solid var(--border); border-radius: 12px; padding: 0.75rem 1rem; color: #fff; font-size: 0.9rem; outline: none; }

/* -- FOOTER -- */
footer { padding: 5rem 0 2rem; border-top: 1px solid var(--border); }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 3rem; }
.footer-col h4 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-secondary); margin-bottom: 1.5rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.75rem; }
.footer-col ul li a { color: var(--text-secondary); font-size: 0.85rem; text-decoration: none; transition: 0.2s; }
.footer-col ul li a:hover { color: var(--accent); }
.footer-bottom { margin: 4rem auto 0; padding-top: 2rem; border-top: 1px solid var(--border); display: flex; justify-content: space-between; color: var(--text-tertiary); font-size: 0.75rem; }

/* -- MODALS -- */
.modal-overlay { 
  position: fixed; inset: 0; background: rgba(0,0,0,0.9); backdrop-filter: blur(10px); 
  z-index: 2500; display: flex; align-items: center; justify-content: center; padding: 2rem; 
}
.modal-content {
  width: 100%; max-width: 1000px; max-height: 85vh; 
  background: var(--bg-elevated); border: 1px solid var(--border-strong); 
  border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden;
}
.machine-modal-grid { 
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); 
  gap: 8px; padding: 2rem; overflow-y: auto; flex: 1;
}
.machine-node { 
  aspect-ratio: 1; border-radius: 6px; background: #000; border: 1px solid var(--border); 
  display: flex; flex-direction: column; align-items: center; justify-content: center; 
  font-size: 10px; font-family: var(--font-mono); transition: 0.2s;
}
.machine-node.active { border-color: #34c759; color: #34c759; background: rgba(52, 199, 89, 0.05); }
.machine-node.busy { border-color: var(--accent); color: var(--accent); background: rgba(255, 107, 0, 0.05); }
.machine-node.offline { border-color: #3f3f46; color: #3f3f46; opacity: 0.4; }
.machine-node:hover { transform: scale(1.1); z-index: 2; }

/* -- MODEL VIEWER PROGRESS -- */
.progress-bar {
  display: block;
  width: 33%;
  height: 4px;
  max-height: 2%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 25px;
  box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background-color: rgba(0, 0, 0, 0.5);
}
.progress-bar.hide {
  visibility: hidden;
  transition: visibility 0.3s;
}
.update-bar {
  background-color: var(--accent);
  width: 0%;
  height: 100%;
  border-radius: 25px;
  transition: width 0.3s;
}
/* -- MOBILE NAVIGATION -- */
#mobile-menu-toggle {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-primary);
  z-index: 1100;
}

@media (max-width: 850px) {
  #mobile-menu-toggle { display: block; }
  .nav-links {
    display: none;
    position: fixed;
    top: 64px; left: 0; width: 100%; height: calc(100vh - 64px);
    background: var(--bg);
    flex-direction: column;
    padding: 2rem;
    gap: 2rem;
    margin: 0;
    z-index: 1050;
    align-items: center;
    justify-content: flex-start;
  }
  .nav-links.mobile-active { display: flex; }
  .nav-link { font-size: 1.5rem; }
  .nav-actions button { display: none; } /* Hide sign-in on super small if needed, or keep it */
}

/* -- MOBILE REFINEMENTS -- */
@media (max-width: 1024px) {
  .costing-grid { grid-template-columns: 1fr !important; }
  #page-profile > .container > div { grid-template-columns: 1fr !important; } /* Dashboard stack */
  .bureau-grid { grid-template-columns: 1fr !important; gap: 3rem !important; }
  .contact-grid { grid-template-columns: 1fr !important; gap: 2rem !important; }
}

.bureau-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6rem; align-items: center; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; margin-top: 3rem; }

@media (max-width: 600px) {
  .hero-text { font-size: 3rem !important; }
  .section { padding: 4rem 0; }
  .glass-card { padding: 1.5rem; }
  #chatbot-container { width: 100%; height: 100%; right: 0; bottom: 0; border-radius: 0; }
  .price-display { font-size: 3rem !important; }
}
