/* ==========================================================================
   Krovexotool — Base.org Swiss Architectural Design System
   Official Palette: Obsidian (#0A0B0D), Surface (#111216), Grid (#22242A),
   Accent: Base Cobalt Blue (#0052FF, Hover #0045D8), High-Contrast White (#FFFFFF)
   ========================================================================== */

:root {
  --bg-base: #0A0B0D;           /* Base Obsidian Black */
  --bg-surface: #111216;        /* Elevated Bento Grid Cell Surface */
  --bg-surface-hover: #16181D;  /* Cell Surface Hover State */
  --bg-input: #15171C;          /* Form Input Surface */
  --border-grid: #22242A;       /* Architectural 1px Hairline Grid */
  --border-grid-focus: #0052FF; /* Base Blue Focus Ring */
  --accent-blue: #0052FF;       /* Base Official Cobalt Blue */
  --accent-blue-hover: #0045D8; /* Base Blue Darker Hover */
  --accent-blue-tint: rgba(0, 82, 255, 0.12); /* Subtle Active Wash */
  --text-primary: #FFFFFF;      /* Pure White */
  --text-secondary: #8A919E;    /* Cool Grey */
  --text-muted: #5B616E;        /* Dim Muted Grey */
  --status-green: #00D395;      /* Operational Indicator */
}

/* Base Body & Reset */
html {
  scroll-behavior: smooth;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, .font-heading, .bento-header {
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif !important;
  letter-spacing: -0.035em;
  font-weight: 700 !important;
}

.font-mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

/* Subtle Canvas Stage Dot Grid */
.stage-dot-grid {
  background-color: #0A0B0D;
  background-image: radial-gradient(#22242A 1.2px, transparent 1.2px);
  background-size: 20px 20px;
}

/* Architectural Full-Bleed Bento Grid */
.bento-grid-full {
  display: grid;
  width: 100%;
  border-top: 1px solid var(--border-grid);
  border-bottom: 1px solid var(--border-grid);
}

.bento-cell {
  background-color: var(--bg-surface);
  position: relative;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.bento-cell-hover:hover {
  background-color: var(--bg-surface-hover);
}

.bento-index {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  user-select: none;
}

/* Hairline Grid Dividers */
.grid-hairline {
  border-color: var(--border-grid);
}

.bento-header {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.04em;
  font-weight: 700;
  line-height: 1.15;
}

.bento-cell-padded {
  padding: 2rem 2.5rem;
}

@media (min-width: 1024px) {
  .bento-cell-padded {
    padding: 2.5rem 3rem;
  }
}

/* Base.org High-Contrast Buttons */
.base-btn-white {
  background-color: #FFFFFF;
  color: #0A0B0D;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  border-radius: 9999px; /* Pill */
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.base-btn-white:hover {
  background-color: #F0F2F5;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.15);
}

.base-btn-white:active {
  transform: translateY(0);
}

.base-btn-blue {
  background-color: var(--accent-blue);
  color: #FFFFFF;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  border-radius: 9999px; /* Pill */
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.base-btn-blue:hover {
  background-color: var(--accent-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 82, 255, 0.35);
}

.base-btn-blue:active {
  transform: translateY(0);
}

.base-btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-grid);
  border-radius: 9999px;
  transition: all 0.15s ease;
}

.base-btn-ghost:hover {
  color: #FFFFFF;
  border-color: var(--accent-blue);
  background-color: var(--accent-blue-tint);
}

/* Base.org Form Controls */
.studio-input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-grid);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: #FFFFFF;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

.studio-input:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(0, 82, 255, 0.2);
  background-color: #1A1D24;
}

.studio-input::placeholder {
  color: var(--text-muted);
}

/* Sleek File Upload Triggers */
.base-upload-trigger {
  border: 1px dashed var(--border-grid);
  background-color: var(--bg-input);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.base-upload-trigger:hover {
  border-color: var(--accent-blue);
  color: #FFFFFF;
  background-color: var(--accent-blue-tint);
}

/* Segmented Control Pills */
.segmented-btn {
  transition: all 0.15s ease;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 6px 12px;
}

.segmented-btn:hover {
  color: #FFFFFF;
}

.segmented-btn.active {
  background-color: var(--accent-blue);
  color: #FFFFFF;
  box-shadow: 0 1px 4px rgba(0, 82, 255, 0.4);
}

/* Studio Navigation Tabs */
.studio-tab-btn {
  transition: all 0.15s ease;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  padding: 7px 16px;
}

.studio-tab-btn:hover {
  color: #FFFFFF;
  background-color: #16181D;
}

.studio-tab-btn.active {
  background-color: var(--accent-blue);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 82, 255, 0.4);
}

/* Platform Marquee Ticker */
.marquee-container {
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  user-select: none;
}

.marquee-content {
  display: flex;
  animation: marqueeScroll 28s linear infinite;
}

.marquee-content:hover {
  animation-play-state: paused;
}

@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Pulsing Operational Dot */
.pulse-green-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-green);
  box-shadow: 0 0 0 0 rgba(0, 211, 149, 0.7);
  animation: pulseGreen 2s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes pulseGreen {
  to {
    box-shadow: 0 0 0 8px rgba(0, 211, 149, 0);
  }
}

/* AdSense Grid Slot */
.adsense-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-grid);
  overflow: hidden;
  text-align: center;
}

.adsense-badge {
  font-size: 9px;
  letter-spacing: 0.1em;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 8px;
}

/* Compact Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #0A0B0D;
}
::-webkit-scrollbar-thumb {
  background: #22242A;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #0052FF;
}

/* Modal Backdrops */
.modal-backdrop {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
}
.modal-backdrop:not(.open) {
  display: none !important;
  pointer-events: none !important;
}
.modal-backdrop.open {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
.modal-content {
  transform: scale(0.97) translateY(6px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-backdrop.open .modal-content {
  transform: scale(1) translateY(0);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* FAQ Accordion */
.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.faq-item.active .faq-content {
  max-height: 480px;
}
.faq-item.active .faq-chevron {
  transform: rotate(180deg);
}

/* WhatsApp Pattern */
.whatsapp-chat-bg {
  background-color: #0B1014;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 14px 14px;
}

/* ==========================================================================
   Global High-Legibility Typography Enforcements (Anti-Thin Font Overrides)
   ========================================================================== */

/* Ban weak 300/400 weights on labels and form elements */
label, .form-label, .input-label {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif !important;
  font-weight: 600 !important;
  color: #D4D4D8 !important; /* High-contrast Zinc-300 */
  letter-spacing: 0.01em;
}

/* All Form Inputs & Selects: Pure White, Medium-Bold Weight */
input, select, textarea, .studio-input {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-weight: 600 !important;
  color: #FFFFFF !important;
}

input.font-mono, .studio-input.font-mono, select.font-mono, textarea.font-mono {
  font-family: 'JetBrains Mono', monospace !important;
  font-weight: 600 !important;
}

/* All Buttons and Interactive Tabs: Bold & High Contrast */
button, .base-btn-white, .base-btn-blue, .base-btn-ghost, .studio-tab-btn, .segmented-btn {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  font-weight: 700 !important;
  letter-spacing: -0.01em;
}

/* Banned weak classes */
.font-light, .font-thin, .font-extralight {
  font-weight: 500 !important;
}

/* ==========================================================================
   OmniAI Creator Chatbot Widget Styles
   ========================================================================== */

#omni-ai-chat-window {
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
}

#omni-ai-chat-window.chat-closed {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(16px) scale(0.96);
  pointer-events: none !important;
}

#omni-ai-chat-window.chat-open {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) scale(1);
  pointer-events: auto !important;
}

/* Chat Message Bubbles */
.omni-msg-user {
  background-color: #0052FF;
  color: #FFFFFF;
  border-radius: 16px 16px 4px 16px;
  font-weight: 500;
}

.omni-msg-bot {
  background-color: #111216;
  border: 1px solid #22242A;
  color: #FFFFFF;
  border-radius: 16px 16px 16px 4px;
}

/* OmniAI Typing Indicator */
.omni-typing-dot {
  width: 6px;
  height: 6px;
  background-color: #0052FF;
  border-radius: 50%;
  animation: omniBounce 1.4s infinite ease-in-out both;
}
.omni-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.omni-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes omniBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* OmniAI Markdown Styling */
.omni-prose p {
  margin-bottom: 0.5rem;
}
.omni-prose p:last-child {
  margin-bottom: 0;
}
.omni-prose strong {
  color: #FFFFFF;
  font-weight: 700;
}
.omni-prose ul {
  list-style-type: disc;
  margin-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.omni-prose ol {
  list-style-type: decimal;
  margin-left: 1.25rem;
  margin-bottom: 0.5rem;
}
.omni-prose li {
  margin-bottom: 0.25rem;
}
.omni-prose code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background-color: #15171C;
  border: 1px solid #22242A;
  padding: 1px 4px;
  border-radius: 4px;
  color: #00D8FF;
}
.omni-prose pre {
  background-color: #050608;
  border: 1px solid #22242A;
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 6px;
  margin-bottom: 6px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #00D395;
  position: relative;
}

/* ==========================================================================
   Comprehensive Device Optimization Suite: Phone, Tablet & PC
   ========================================================================== */

/* 1. Global Viewport, Safe-Areas & Overflow Protection */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

body {
  padding-left: var(--sal);
  padding-right: var(--sar);
  padding-bottom: var(--sab);
}

/* 2. Responsive Canvas & Stage Scaling (Zero Mobile Distortions) */
canvas {
  max-width: 100% !important;
  height: auto !important;
  display: block;
}

#tweet-stage-target,
#chat-stage-target,
#youtube-feed-stage-target {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#exportable-tweet-card,
#exportable-chat-card,
#exportable-feed-card {
  max-width: 100%;
}

/* 3. Mobile Device Specific Optimizations (< 640px: iPhone, Android) */
@media (max-width: 640px) {
  /* Prevent iOS Safari from forcing auto-zoom on input focus */
  input, select, textarea, .studio-input {
    font-size: 16px !important;
    min-height: 42px;
  }
  
  /* Finger-Friendly Touch Targets (42px-44px minimum touch height) */
  .studio-tab-btn,
  .segmented-btn,
  .base-btn-white,
  .base-btn-blue,
  .base-btn-ghost,
  .omni-ai-chip,
  .faq-toggle {
    min-height: 42px;
    touch-action: manipulation;
  }

  /* Padding tightening on mobile for maximum usable workspace */
  .bento-cell-padded {
    padding: 1.25rem 1rem !important;
  }

  /* Compact typography on small mobile screens */
  h1 {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
  }

  h2.bento-header {
    font-size: 1.35rem !important;
  }

  /* Responsive ad containers on mobile */
  .adsense-slot {
    width: 100% !important;
    max-width: 100% !important;
  }
  .adsense-modal ins {
    max-width: 100% !important;
  }

  /* OmniAI Chatbot Mobile Floating Drawer */
  #omni-ai-widget {
    bottom: max(0.75rem, env(safe-area-inset-bottom)) !important;
    right: max(0.75rem, env(safe-area-inset-right)) !important;
  }

  #omni-ai-chat-window {
    width: calc(100vw - 1.5rem) !important;
    max-width: calc(100vw - 1.5rem) !important;
    height: min(500px, calc(100dvh - 5.5rem)) !important;
    max-height: calc(100dvh - 5.5rem) !important;
    border-radius: 16px !important;
  }

  #omni-ai-toggle-btn {
    padding: 0.625rem 0.875rem !important;
    font-size: 0.75rem !important;
    box-shadow: 0 4px 18px rgba(0, 82, 255, 0.45) !important;
  }
}

/* 4. Tablet Device Specific Optimizations (641px - 1024px: iPad Mini, iPad Air, Android Tablets) */
@media (min-width: 641px) and (max-width: 1024px) {
  /* Balanced layout spacing */
  .bento-cell-padded {
    padding: 1.75rem !important;
  }

  /* Chat window dimensions on tablets */
  #omni-ai-chat-window {
    width: 380px !important;
    height: 520px !important;
    max-height: calc(100vh - 100px) !important;
  }

  /* Input sizing on tablets */
  input, select, textarea, .studio-input {
    font-size: 14px;
    min-height: 38px;
  }

  .segmented-btn, .studio-tab-btn {
    min-height: 38px;
  }
}

/* 5. PC & Desktop Specific Optimizations (1025px+: Laptops, Desktops, Ultrawide) */
@media (min-width: 1025px) {
  /* Full Swiss Grid 12-Column Precision */
  .stage-dot-grid {
    background-size: 24px 24px;
  }

  /* Fluid stage height for larger monitors */
  .stage-dot-grid {
    min-height: 680px;
  }

  /* Chat window sizing on PC */
  #omni-ai-chat-window {
    width: 400px;
    height: 540px;
  }

  /* Subtle micro-interaction hover transforms */
  .base-btn-white:hover,
  .base-btn-blue:hover {
    transform: translateY(-2px);
  }
}

/* 6. High-DPI / Retina Display Sharpness (@2x and @3x Screens) */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  canvas {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}
