/* ============================================
   site.css — ShopAutomate shared styles
   Single source of truth for all custom styles.
   
   Color system uses CSS custom properties so
   theme-light.css only needs to swap values.
   ============================================ */

/* --- Color Tokens (Dark = default) --- */
:root {
  --bg-primary: #0A0A0A;
  --bg-secondary: #0d0d0d;
  --bg-tertiary: #050505;
  --bg-nav: rgba(10, 10, 10, 0.8);
  --bg-card: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.01) 100%);
  --bg-card-hover: linear-gradient(135deg, rgba(62, 130, 247, 0.05) 0%, rgba(255,255,255,0.02) 100%);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.05);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-code: #1e1e1e;
  --bg-code-header: #2d2d2d;
  --bg-drawer: #0A0A0A;

  --text-primary: #ffffff;
  --text-secondary: #d1d5db;     /* gray-300 */
  --text-tertiary: #9ca3af;      /* gray-400 */
  --text-muted: #6b7280;         /* gray-500 */
  --text-faint: #4b5563;         /* gray-600 */
  --text-placeholder: #4b5563;

  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-card: rgba(255, 255, 255, 0.06);
  --border-card-hover: rgba(62, 130, 247, 0.3);

  --accent: rgb(62, 130, 247);
  --accent-soft: rgba(62, 130, 247, 0.1);

  --scrollbar-track: #0A0A0A;
  --scrollbar-thumb: #333;
  --scrollbar-hover: #555;
}

/* --- Light Mode Overrides --- */
[data-theme="light"] {
  --bg-primary: #FAFAFA;
  --bg-secondary: #F0F0F0;
  --bg-tertiary: #F0F0F0;
  --bg-nav: rgba(250, 250, 250, 0.85);
  --bg-card: linear-gradient(135deg, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.01) 100%);
  --bg-card-hover: linear-gradient(135deg, rgba(62, 130, 247, 0.05) 0%, rgba(0,0,0,0.01) 100%);
  --bg-glass: rgba(255, 255, 255, 0.8);
  --bg-glass-hover: rgba(0, 0, 0, 0.05);
  --bg-input: #ffffff;
  --bg-drawer: #FAFAFA;

  --text-primary: #111111;
  --text-secondary: #555555;
  --text-tertiary: #666666;
  --text-muted: #777777;
  --text-faint: #888888;
  --text-placeholder: #aaaaaa;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-light: rgba(0, 0, 0, 0.1);
  --border-card: rgba(0, 0, 0, 0.08);
  --border-card-hover: rgba(62, 130, 247, 0.3);

  --scrollbar-track: #f5f5f5;
  --scrollbar-thumb: #cccccc;
  --scrollbar-hover: #aaaaaa;
}

/* --- Base --- */
html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

img,
svg,
input,
textarea,
select,
table {
  max-width: 100%;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* --- Logo text --- */
.logo-text {
  font-family: 'Montserrat', sans-serif;
  letter-spacing: 0.2em;
  font-weight: 500;
}

/* --- Scan line animation (index.html) --- */
.scan-line {
  background: linear-gradient(to bottom, rgba(62, 130, 247, 0), rgba(62, 130, 247, 0.7), rgba(62, 130, 247, 0));
  box-shadow: 0 0 20px rgba(62, 130, 247, 0.4);
  position: absolute; left: 0; right: 0; height: 3px; z-index: 10;
  animation: scanSweep 3s ease-in-out infinite;
}
[data-theme="light"] .scan-line {
  background: linear-gradient(to bottom, rgba(62, 130, 247, 0), rgba(62, 130, 247, 0.4), rgba(62, 130, 247, 0));
  box-shadow: 0 0 10px rgba(62, 130, 247, 0.2);
}
@keyframes scanSweep { 0% { top: 0%; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { top: 100%; opacity: 0; } }

/* --- JSON code block --- */
.json-key { color: #9cdcfe; }
.json-string { color: #ce9178; }
.json-number { color: #b5cea8; }
.json-bool { color: #569cd6; }

.code-line {
  display: block;
  opacity: 0.3;
  transition: opacity 0.3s ease, background-color 0.3s ease;
  padding: 0 4px;
  border-radius: 2px;
  white-space: pre;
}
.code-line.active { opacity: 1; background: rgba(62, 130, 247, 0.1); }
.code-line.revealed { opacity: 1; }

/* --- Invoice paper --- */
.invoice-paper {
  background: linear-gradient(135deg, #f5f5f0 0%, #ebe8e0 50%, #f0ede5 100%);
  box-shadow: 2px 3px 12px rgba(0,0,0,0.4), inset 0 0 40px rgba(0,0,0,0.03);
  position: relative;
  transform: rotate(0deg);
}
.invoice-paper::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; border-radius: inherit;
}

/* --- Flow arrows --- */
.flow-arrow { animation: pulseArrow 2s ease-in-out infinite; }
@keyframes pulseArrow { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* --- CCC ONE mock grid --- */
.ccc-grid-header th {
  padding: 4px 5px;
  font-size: 9px;
  font-weight: 600;
  color: white;
  background: #4472C4;
  text-align: left;
  white-space: nowrap;
}
.ccc-grid-row td {
  padding: 3px 5px;
  font-size: 9px;
  color: #222;
  border-bottom: 1px solid #ddd;
  white-space: nowrap;
}
.ccc-grid-row:nth-child(even) td { background: #e8f0fe; }
.ccc-grid-row:nth-child(odd) td { background: #fff; }
.ccc-grid-row.hidden-row td { color: transparent; background: #f8f8f8 !important; }
.ccc-grid-row.hidden-row:nth-child(even) td { background: #f0f4f8 !important; }
.ccc-grid-row.revealed-row td { transition: color 0.4s ease, background-color 0.4s ease; }
.ccc-grid-row.active-row td { background: rgba(62, 130, 247, 0.15) !important; transition: background-color 0.3s ease; }
.ccc-field { transition: all 0.4s ease; }
.ccc-field.hidden-field { color: transparent; }
.ccc-field.revealed-field { color: #222; }

/* --- Roadmap badges (shared across v1/v2/v3) --- */
.badge-research {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.25);
}
.badge-planned {
  background: rgba(62, 130, 247, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(62, 130, 247, 0.25);
}
.badge-active {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

/* --- Roadmap feature cards (v1 grid style) --- */
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 2.5rem;
  transition: all 0.3s ease;
}
.feature-card:hover {
  border-color: var(--border-card-hover);
  background: var(--bg-card-hover);
  transform: translateY(-4px);
}
[data-theme="light"] .feature-card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.feature-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 1.5rem;
}

/* --- Roadmap timeline (v2 style) --- */
.timeline-line {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, rgba(62,130,247,0.3), rgba(139,92,246,0.3));
  transform: translateX(-50%);
}
.timeline-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}
.dot-active { background: #4ade80; box-shadow: 0 0 12px rgba(74, 222, 128, 0.5); }
.dot-planned { background: #60a5fa; box-shadow: 0 0 12px rgba(96, 165, 250, 0.4); }
.dot-research { background: #a78bfa; box-shadow: 0 0 12px rgba(167, 139, 250, 0.4); }

.feature-block {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 2rem 2.5rem;
  transition: all 0.3s ease;
}
.feature-block:hover {
  border-color: rgba(62, 130, 247, 0.25);
  transform: translateY(-2px);
}
[data-theme="light"] .feature-block {
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

@media (max-width: 768px) {
  .timeline-line { left: 24px; }
  .timeline-dot { left: 24px; }
  .timeline-item { padding-left: 56px !important; padding-right: 0 !important; text-align: left !important; }
}

/* --- Roadmap feature sections (v3 style) --- */
.feature-section {
  border-bottom: 1px solid var(--border-subtle);
  padding: 5rem 0;
}
.feature-section:last-of-type { border-bottom: none; }

.feature-icon-lg {
  width: 80px; height: 80px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.problem-box {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}
.solution-box {
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.15);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

/* --- Support page --- */
.section-content { max-height: 0; overflow: hidden; transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.section-content.open { max-height: 5000px; transition: max-height 0.7s cubic-bezier(0.4, 0, 0.2, 1); }
.qa-content { max-height: 0; overflow: hidden; transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.qa-content.open { max-height: 2000px; transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.chevron { transition: transform 0.3s ease; }
.chevron.rotated { transform: rotate(180deg); }
.section-header:hover { background: rgba(62, 130, 247, 0.05); }
.qa-header:hover { background: var(--bg-glass-hover); }
.faq-section { transition: opacity 0.35s ease, margin 0.35s ease; }
.faq-section.hidden-filter { opacity: 0; max-height: 0 !important; overflow: hidden; margin-top: 0 !important; margin-bottom: 0 !important; border-color: transparent !important; pointer-events: none; }
.qa-item { transition: opacity 0.25s ease, max-height 0.3s ease; }
.qa-item.hidden-filter { opacity: 0; max-height: 0 !important; overflow: hidden; margin: 0 !important; border-color: transparent !important; pointer-events: none; }
mark.search-hl { background: rgba(62, 130, 247, 0.3); color: inherit; border-radius: 2px; padding: 0 1px; }

/* --- Theme toggle button --- */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  opacity: 0.5;
  transition: opacity 0.2s;
  color: var(--text-muted);
}
.theme-toggle-btn:hover { opacity: 1; }

/* --- Nav (shared) --- */
.site-nav {
  background-color: var(--bg-nav);
}

/* Nav switches to hamburger below 1024px (lg breakpoint) */
@media (max-width: 1023px) {
  .site-nav > div {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    gap: 0.75rem;
  }

  .site-nav a:first-child {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100vw - 5.5rem);
  }

  .site-nav a:first-child img {
    height: 1.75rem !important;
    width: auto !important;
    max-width: 100%;
    object-fit: contain;
  }

  button[onclick="openMobileMenu()"] {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
    flex-shrink: 0;
    margin-left: auto;
    padding: 0.5rem !important;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
  }

  button[onclick="openMobileMenu()"] svg {
    display: block;
    width: 1.25rem !important;
    height: 1.25rem !important;
    stroke: currentColor;
  }
}

/* Desktop nav spacing tuning at large screens */
@media (min-width: 1024px) {
  .site-nav > div {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Phone-only content hardening */
@media (max-width: 767px) {
  main,
  header,
  section,
  footer,
  .feature-card,
  .feature-block,
  .feature-tile {
    max-width: 100%;
  }

  h1,
  h2,
  h3,
  p,
  span,
  a,
  label,
  button {
    overflow-wrap: anywhere;
  }

  .feature-card,
  .feature-block,
  .feature-tile,
  .problem-box,
  .solution-box {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }

  .badge-research,
  .badge-planned,
  .badge-active {
    white-space: normal;
    text-align: center;
  }
}

/* --- Light mode: typography overrides for Tailwind utilities --- */
[data-theme="light"] .text-white { color: var(--text-primary) !important; }
[data-theme="light"] .text-gray-200 { color: #333 !important; }
[data-theme="light"] .text-gray-300 { color: var(--text-secondary) !important; }
[data-theme="light"] .text-gray-400 { color: var(--text-tertiary) !important; }
[data-theme="light"] .text-gray-500 { color: var(--text-muted) !important; }
[data-theme="light"] .text-gray-600 { color: var(--text-faint) !important; }

/* --- Light mode: border overrides --- */
[data-theme="light"] .border-white\/5,
[data-theme="light"] .border-white\/10,
[data-theme="light"] .border-white\/20 {
  border-color: var(--border-subtle) !important;
}

/* --- Light mode: background overrides for Tailwind arbitrary values --- */
[data-theme="light"] .bg-white\/5 { background-color: rgba(0, 0, 0, 0.03) !important; }
[data-theme="light"] .bg-white\/10 { background-color: rgba(0, 0, 0, 0.05) !important; }
[data-theme="light"] .bg-white\/10:hover { background-color: rgba(0, 0, 0, 0.1) !important; }
[data-theme="light"] .bg-white\/\[0\.02\],
[data-theme="light"] .bg-white\/\[0\.03\],
[data-theme="light"] .bg-white\/\[0\.05\] {
  background-color: var(--bg-glass) !important;
}

/* --- Light mode: form inputs --- */
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] textarea {
  background-color: var(--bg-input) !important;
  border-color: var(--border-light) !important;
  color: var(--text-primary) !important;
}
[data-theme="light"] input::placeholder,
[data-theme="light"] textarea::placeholder {
  color: var(--text-placeholder) !important;
}

/* --- Light mode: CTA button inversion --- */
[data-theme="light"] a.bg-white.text-black {
  background-color: #111 !important;
  color: #fff !important;
}
[data-theme="light"] a.bg-white.text-black:hover {
  background-color: #333 !important;
}

/* --- Light mode: hero glow orbs — soften --- */
[data-theme="light"] .hero-glow { opacity: 0.15 !important; }
[data-theme="light"] .hero-glow.from-\[\#0A0A0A\] {
  --tw-gradient-from: #FAFAFA var(--tw-gradient-from-position) !important;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}
[data-theme="light"] .hero-glow.via-\[\#0A0A0A\] {
  --tw-gradient-stops: var(--tw-gradient-from), #FAFAFA var(--tw-gradient-via-position), var(--tw-gradient-to) !important;
}

/* --- Light mode: bounce arrow --- */
[data-theme="light"] .animate-bounce svg { color: #bbb !important; }

/* --- Light mode: CIECA badge --- */
[data-theme="light"] img[alt="CIECA Member"] { opacity: 0.7 !important; }

/* --- Mobile drawer --- */
[data-theme="light"] #mobileDrawer {
  background: var(--bg-drawer) !important;
  border-left-color: var(--border-light) !important;
}
[data-theme="light"] #mobileDrawer a { color: var(--text-secondary) !important; }
[data-theme="light"] #mobileDrawer button { color: var(--text-primary) !important; }
