/* Apple-grade Minimalism & Elegance for T-Nesting */

@layer utilities {
  .ai-text-shimmer {
    background: linear-gradient(
      90deg,
      #38bdf8 0%,
      #818cf8 25%,
      #c084fc 50%,
      #f472b6 75%,
      #38bdf8 100%
    );
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: shimmer 5s linear infinite;
  }
}

@keyframes shimmer {
  to {
    background-position: 200% center;
  }
}

/* Custom Minimalist Scrollbars */
.scrollbar-thin::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Apple Smooth Animations */
.chat-fade-in {
  animation: appleFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* Typing Indicator */
.typing-dot {
  animation: appleTyping 1.4s infinite ease-in-out both;
}
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
.typing-dot:nth-child(3) { animation-delay: 0s; }

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

/* Rapid toolpath line */
.sim-rapid-line {
  stroke-dasharray: 4, 4;
  animation: toolpathDash 20s linear infinite;
}

@keyframes toolpathDash {
  to {
    stroke-dashoffset: -120;
  }
}

/* Interactive SVG hover */
#simSvg .sheet-part {
  cursor: pointer;
  transition: transform 0.25s ease, filter 0.25s ease;
}

#simSvg .sheet-part:hover path,
#simSvg .sheet-part:hover circle,
#simSvg .sheet-part:hover polygon,
#simSvg .sheet-part:hover rect {
  stroke: #ffffff !important;
  stroke-width: 2 !important;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}


/* ==========================================================================
   APPLE LIGHT CLEAN THEME (ACTIVATED WHEN <html class="light">)
   ========================================================================== */

html.light,
html.light body {
  background-color: #fbfbfd !important;
  color: #1d1d1f !important;
}

/* Header & Glass Navbar */
html.light header {
  background: rgba(255, 255, 255, 0.88) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 1px 12px rgba(0, 0, 0, 0.04) !important;
}

html.light header nav a {
  color: #515154 !important;
}

html.light header nav a:hover {
  color: #000000 !important;
}

html.light header nav a.text-neutral-200 {
  color: #1d1d1f !important;
}

html.light header nav a.text-cyan-300 {
  color: #0284c7 !important;
}

html.light #langSelect {
  background-color: #ffffff !important;
  color: #1d1d1f !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

html.light #btnHeaderCart {
  color: #1d1d1f !important;
}

html.light #btnHeaderCart:hover {
  background-color: rgba(0, 0, 0, 0.06) !important;
}

html.light #btnThemeToggle {
  color: #1d1d1f !important;
}

html.light #btnThemeToggle:hover {
  background-color: rgba(0, 0, 0, 0.06) !important;
}

/* General Typography in Light Mode */
html.light .text-white {
  color: #1d1d1f !important;
}

html.light .text-neutral-100,
html.light .text-neutral-200 {
  color: #1d1d1f !important;
}

html.light .text-neutral-300 {
  color: #3a3a3c !important;
}

html.light .text-neutral-400 {
  color: #6e6e73 !important;
}

html.light .text-neutral-500 {
  color: #86868b !important;
}

html.light .text-apple-subtext {
  color: #6e6e73 !important;
}

/* General Backgrounds in Light Mode */
html.light .bg-black {
  background-color: #fbfbfd !important;
}

html.light .bg-\[\#09090b\],
html.light .bg-\[\#0a0a0c\] {
  background-color: #f5f5f7 !important;
}

html.light .bg-\[\#121215\],
html.light .bg-\[\#151518\],
html.light .bg-apple-card {
  background-color: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04) !important;
}

html.light .bg-neutral-900 {
  background-color: #f5f5f7 !important;
  color: #1d1d1f !important;
}

html.light .bg-white\/5 {
  background-color: rgba(0, 0, 0, 0.04) !important;
  color: #1d1d1f !important;
}

html.light .bg-white\/10 {
  background-color: rgba(0, 0, 0, 0.06) !important;
  color: #1d1d1f !important;
}

html.light .bg-white\/15 {
  background-color: rgba(0, 0, 0, 0.08) !important;
  color: #1d1d1f !important;
}

/* Borders in Light Mode */
html.light .border-white\/10,
html.light .border-white\/15,
html.light .border-white\/20,
html.light .border-white\/\[0\.06\],
html.light .border-white\/\[0\.08\] {
  border-color: rgba(0, 0, 0, 0.08) !important;
}

html.light .border-neutral-800 {
  border-color: rgba(0, 0, 0, 0.1) !important;
}

/* Primary Action Buttons */
html.light a[href="#download"].bg-white.text-black {
  background-color: #1d1d1f !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
}

html.light a[href="#download"].bg-white.text-black:hover {
  background-color: #000000 !important;
}

html.light .bg-white\/5.text-neutral-400 {
  background-color: rgba(0, 0, 0, 0.04) !important;
  color: #86868b !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

/* Store Cards in Light Mode */
html.light .bg-gradient-to-b.from-amber-500\/\[0\.08\] {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, #ffffff 100%) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.1) !important;
}

html.light .store-filter-btn {
  color: #6e6e73 !important;
}

html.light .store-filter-btn.bg-white {
  background-color: #1d1d1f !important;
  color: #ffffff !important;
}

/* Cart Drawer in Light Mode */
html.light #cartDrawerPanel {
  background-color: #ffffff !important;
  border-left-color: rgba(0, 0, 0, 0.1) !important;
  color: #1d1d1f !important;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1) !important;
}

html.light #cartDrawerItems > div {
  background-color: #f9f9fb !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

html.light #cartCouponInput {
  background-color: #f5f5f7 !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
  color: #1d1d1f !important;
}

/* Checkout Modal in Light Mode */
html.light #checkoutModal > div {
  background-color: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #1d1d1f !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18) !important;
}

html.light #checkoutPaymentArea {
  background-color: #f9f9fb !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

html.light #checkoutModal input {
  background-color: #f5f5f7 !important;
  border-color: rgba(0, 0, 0, 0.15) !important;
  color: #1d1d1f !important;
}

/* Legal Modal in Light Mode */
html.light #legalModal > div {
  background-color: #ffffff !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #1d1d1f !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18) !important;
}

html.light #legalModal #modalBody {
  color: #3a3a3c !important;
}

/* Footer in Light Mode */
html.light footer {
  background-color: #f5f5f7 !important;
  border-top-color: rgba(0, 0, 0, 0.08) !important;
}

html.light footer a:hover,
html.light footer button:hover {
  color: #000000 !important;
}

/* Scrollbar in Light Mode */
html.light .scrollbar-thin::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
}

html.light .scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.32);
}


/* Explicit Light Mode styling for PRO 1-Year No-Dongle Warning Box */
html.light .store-pro-1y-box {
  background-color: #fff7ed !important;
  border-color: #f97316 !important;
  color: #c2410c !important;
}

html.light .store-pro-1y-box svg {
  color: #ea580c !important;
}

html.light .store-pro-1y-box span {
  color: #c2410c !important;
  font-weight: 700 !important;
}


/* Explicit Light Mode styling for PRO 1-Year No-Dongle Tag Badge */
html.light .store-tag-no-dongle {
  background-color: #fef2f2 !important;
  color: #b91c1c !important;
  border-color: #f87171 !important;
}


/* ==========================================================================
   1.0.69 — PHỦ NỐT CHẾ ĐỘ SÁNG (html.light)
   - chữ accent pastel (xanh lá/cyan/vàng… dành cho nền tối) → đậm hơn để đọc được trên nền sáng
   - các khối còn nền tối (gradient section, thẻ bg-neutral-900/90, bg-black/40…) → nền sáng
   ========================================================================== */
html.light { color-scheme: light; }

/* Chữ accent đậm hơn trên nền sáng */
html.light .text-emerald-200, html.light .text-emerald-300 { color: #047857 !important; }
html.light .text-emerald-400 { color: #059669 !important; }
html.light .text-cyan-200, html.light .text-cyan-300 { color: #0e7490 !important; }
html.light .text-cyan-400 { color: #0e7490 !important; }
html.light .text-amber-200, html.light .text-amber-300, html.light .text-amber-400 { color: #b45309 !important; }
html.light .text-orange-300, html.light .text-orange-400 { color: #c2410c !important; }
html.light .text-yellow-300, html.light .text-yellow-400 { color: #a16207 !important; }
html.light .text-blue-300, html.light .text-blue-400 { color: #1d4ed8 !important; }
html.light .text-sky-200, html.light .text-sky-300, html.light .text-sky-400 { color: #0369a1 !important; }
html.light .text-teal-300, html.light .text-teal-400 { color: #0f766e !important; }
html.light .text-purple-300, html.light .text-purple-400, html.light .text-violet-300, html.light .text-violet-400 { color: #6d28d9 !important; }
html.light .text-pink-300, html.light .text-pink-400 { color: #be185d !important; }
html.light .text-red-300, html.light .text-red-400 { color: #b91c1c !important; }
html.light .text-green-300, html.light .text-green-400 { color: #15803d !important; }
html.light .text-apple-lightsubtext { color: #6e6e73 !important; }
html.light .text-apple-blue { color: #0071e3 !important; }
html.light .text-neutral-600 { color: #6e6e73 !important; }
html.light .text-neutral-700 { color: #515154 !important; }

/* Chữ gradient trắng của tiêu đề → gradient tối */
html.light .bg-clip-text.text-transparent.from-white {
  background-image: linear-gradient(180deg, #1d1d1f 0%, #3a3a3c 55%, #86868b 100%) !important;
}

/* Khối nền tối → sáng */
html.light #trial.bg-gradient-to-b,
html.light .bg-gradient-to-b.from-black.via-neutral-950.to-black {
  background-image: linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 50%, #fbfbfd 100%) !important;
  border-top-color: rgba(5, 150, 105, 0.25) !important;
}
html.light .bg-gradient-to-r.from-emerald-950\/40.via-neutral-900.to-teal-950\/40 {
  background-image: linear-gradient(90deg, rgba(16, 185, 129, 0.08), #ffffff 50%, rgba(20, 184, 166, 0.08)) !important;
  border-color: rgba(5, 150, 105, 0.35) !important;
  box-shadow: 0 10px 30px rgba(5, 150, 105, 0.08) !important;
}
html.light .bg-gradient-to-b.from-cyan-500\/\[0\.08\].to-apple-card {
  background-image: linear-gradient(180deg, rgba(6, 182, 212, 0.08) 0%, #ffffff 100%) !important;
  border-color: rgba(8, 145, 178, 0.35) !important;
}
html.light .bg-neutral-900\/90, html.light .bg-neutral-900\/60, html.light .bg-neutral-900\/80 {
  background-color: #f0f0f3 !important;
  color: #1d1d1f !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html.light .bg-black\/40, html.light .bg-black\/30, html.light .bg-black\/20 {
  background-color: rgba(0, 0, 0, 0.035) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html.light .bg-neutral-800, html.light .bg-neutral-800\/50, html.light .bg-neutral-800\/60 {
  background-color: #e8e8ed !important;
  color: #1d1d1f !important;
}
html.light .border-white\/5, html.light .border-white\/\[0\.05\], html.light .border-white\/\[0\.1\], html.light .border-white\/\[0\.07\], html.light .border-white\/\[0\.12\] {
  border-color: rgba(0, 0, 0, 0.08) !important;
}
html.light .border-t.border-white\/\[0\.06\] { border-top-color: rgba(0, 0, 0, 0.08) !important; }

/* Biến thể có độ mờ (text-emerald-500/80…) */
html.light [class*="text-emerald-500/"], html.light [class*="text-emerald-400/"], html.light [class*="text-emerald-300/"] { color: #047857 !important; }
html.light [class*="text-purple-400/"], html.light [class*="text-purple-300/"] { color: #6d28d9 !important; }
html.light [class*="text-amber-300/"], html.light [class*="text-amber-400/"] { color: #b45309 !important; }
html.light [class*="text-cyan-300/"], html.light [class*="text-cyan-400/"] { color: #0e7490 !important; }
html.light [class*="text-blue-300/"], html.light [class*="text-blue-400/"] { color: #1d4ed8 !important; }

/* Lớp phủ tối trên ảnh/mô phỏng (bg-black/60..90, khung bg-neutral-950, bg-apple-surface): GIỮ chữ sáng */
html.light [class*="bg-black/6"] .text-white, html.light [class*="bg-black/7"] .text-white, html.light [class*="bg-black/8"] .text-white, html.light [class*="bg-black/9"] .text-white,
html.light [class*="bg-black/6"].text-white, html.light [class*="bg-black/7"].text-white, html.light [class*="bg-black/8"].text-white, html.light [class*="bg-black/9"].text-white,
html.light .bg-neutral-950 .text-white, html.light .bg-apple-surface .text-white, html.light [class*="bg-\[\#0a0a0a\]"] .text-white { color: #ffffff !important; }
html.light [class*="bg-black/6"] .text-neutral-300, html.light [class*="bg-black/7"] .text-neutral-300, html.light [class*="bg-black/8"] .text-neutral-300, html.light [class*="bg-black/9"] .text-neutral-300,
html.light [class*="bg-black/6"].text-neutral-300, html.light [class*="bg-black/7"].text-neutral-300, html.light [class*="bg-black/8"].text-neutral-300, html.light [class*="bg-black/9"].text-neutral-300,
html.light .bg-neutral-950 .text-neutral-300, html.light .bg-neutral-950 .text-neutral-400 { color: #d4d4d8 !important; }

/* Tab/pill đang chọn trong thanh lọc (nền trắng khi tối) → chữ đen trên nền trắng có viền */
html.light .bg-neutral-900\/90 .bg-white, html.light .bg-neutral-900\/90 button.bg-white {
  background-color: #1d1d1f !important;
  color: #ffffff !important;
}

/* Fix light mode text contrast inside modals (bg-black/80 backdrop -> white modal card) */
html.light [class*="bg-black/"] .bg-\[\#151518\] .text-white:not([class*="bg-emerald-"]):not([class*="bg-blue-"]):not([class*="bg-cyan-"]):not([class*="bg-red-"]):not([class*="bg-gradient-"]):not(.bg-black),
html.light [class*="bg-black/"] .bg-\[\#121215\] .text-white:not([class*="bg-emerald-"]):not([class*="bg-blue-"]):not([class*="bg-cyan-"]):not([class*="bg-red-"]):not([class*="bg-gradient-"]):not(.bg-black),
html.light [class*="bg-black/"] .bg-apple-card .text-white:not([class*="bg-emerald-"]):not([class*="bg-blue-"]):not([class*="bg-cyan-"]):not([class*="bg-red-"]):not([class*="bg-gradient-"]):not(.bg-black) {
  color: #1d1d1f !important;
}
html.light [class*="bg-black/"] .bg-\[\#151518\] .text-amber-300,
html.light [class*="bg-black/"] .bg-\[\#121215\] .text-amber-300,
html.light [class*="bg-black/"] .bg-apple-card .text-amber-300,
html.light [class*="bg-black/"] .bg-\[\#151518\] .text-amber-400,
html.light [class*="bg-black/"] .bg-\[\#121215\] .text-amber-400,
html.light [class*="bg-black/"] .bg-apple-card .text-amber-400 {
  color: #b45309 !important;
}
html.light [class*="bg-black/"] .bg-\[\#151518\] .text-neutral-300,
html.light [class*="bg-black/"] .bg-\[\#121215\] .text-neutral-300,
html.light [class*="bg-black/"] .bg-apple-card .text-neutral-300 {
  color: #3a3a3c !important;
}
