/* ==========================================================================
   NexusAI Storefront - Custom Enhancements & Fcode Resemblance Styles
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --font-primary: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --color-primary: #0284c7;
  --color-primary-hover: #0369a1;
  --color-accent: #cc2027;
}

body {
  font-family: var(--font-primary) !important;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(156, 163, 175, 0.4);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(156, 163, 175, 0.7);
}
.dark ::-webkit-scrollbar-thumb {
  background: rgba(113, 113, 122, 0.4);
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(113, 113, 122, 0.7);
}

/* Sidebar & Navigation SVG Icon Sizing */
#main-sidebar svg,
.sidebar-cat-btn svg {
  width: 1.25rem !important;
  height: 1.25rem !important;
  min-width: 1.25rem !important;
  min-height: 1.25rem !important;
  max-width: 1.25rem !important;
  max-height: 1.25rem !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

header svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* Approved signature flame: accessible text, crisp SVG, compact mobile lockup. */
.nexus-brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.nexus-brand-mark { display: block; width: 32px; height: 36px; flex-shrink: 0; }
.nexus-brand-wordmark { font-family: Arial, Helvetica, sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -1px; line-height: 1; white-space: nowrap; color: #141c2d; }
.nexus-brand-ai { color: #ee7822; }
.nexus-brand-store { color: #657184; font-weight: 700; }
.dark .nexus-brand-wordmark { color: #f1f5f9; }
.dark .nexus-brand-store { color: #b2bccb; }
@media (max-width: 639px) {
  .nexus-brand { gap: 5px; }
  .nexus-brand-mark { width: 24px; height: 30px; }
  .nexus-brand-wordmark { font-size: 14px; letter-spacing: -.4px; }
  .nexus-brand-store { display: block; margin-top: 2px; font-size: 10px; letter-spacing: 1px; }
}

/* Mobile Sidebar Sliding Drawer */
@media (max-width: 1023px) {
  #main-sidebar {
    transform: translateX(-100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: block !important;
  }
  #main-sidebar.is-open {
    transform: translateX(0) !important;
  }
}
@media (min-width: 1024px) {
  #main-sidebar {
    transform: translateX(0) !important;
  }
}

/* Active Sidebar Category Item */
.sidebar-cat-btn {
  transition: all 0.2s ease;
}
.sidebar-cat-btn:hover {
  transform: translateX(2px);
}
.sidebar-cat-btn.active {
  background-color: #e0f2fe !important;
  color: #0284c7 !important;
  font-weight: 700 !important;
}
.sidebar-cat-btn.active svg {
  color: #0284c7 !important;
}
.dark .sidebar-cat-btn.active {
  background-color: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}
.dark .sidebar-cat-btn.active svg {
  color: #ffffff !important;
}

/* Product Card Styling */
.product-card {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
  background-color: #ffffff;
}
.dark .product-card {
  background-color: #202024;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px -10px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}
.dark .product-card:hover {
  box-shadow: 0 16px 30px -10px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}
.product-card .img-zoom {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-card:hover .img-zoom {
  transform: scale(1.06);
}

/* Multiline clamp */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal and Drawer Animations */
.modal-backdrop {
  animation: fadeIn 0.2s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUpCentered {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes modalFadeInScale {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Cart entry/exit is coordinated by ModalManager, including interrupted exits. */
#modal-cart .modal-backdrop {
  animation: none;
}

.catalog-submenu {
  box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
  #catalog-navigation .cat-chevron svg,
  #main-sidebar {
    transition-duration: 0s !important;
  }
}

#modal-login.is-open > div:last-child {
  animation: scaleUpCentered 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#modal-product-detail.is-open > div:last-child {
  animation: modalFadeInScale 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Variation Pills */
.var-btn {
  transition: all 0.15s ease;
}
.var-btn.active {
  background-color: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}

/* Category Filter Pills */
.pill-btn {
  transition: all 0.15s ease;
}
.pill-btn.active {
  background-color: #0284c7 !important;
  color: #ffffff !important;
}

/* Smooth dark mode switch */
html.theme-transition,
html.theme-transition *,
html.theme-transition *:before,
html.theme-transition *:after {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
  transition-delay: 0 !important;
}

/* ==========================================================================
   FIX A & D: Floating Support, Toast Notifications & Support Modal Actions
   ========================================================================== */

/* Floating Support Button */
#floating-support,
a[aria-label="Hỗ trợ Telegram"].fixed {
  position: fixed !important;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)) !important;
  right: calc(1.5rem + env(safe-area-inset-right, 0px)) !important;
  z-index: 30 !important;
  width: 3rem !important;
  height: 3rem !important;
  border-radius: 9999px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -4px rgba(0, 0, 0, 0.1) !important;
  transition: transform 0.2s ease, background-color 0.2s ease, opacity 0.2s ease !important;
}

#floating-support:hover,
a[aria-label="Hỗ trợ Telegram"].fixed:hover {
  background-color: #0369a1 !important;
  transform: scale(1.08) !important;
}

#floating-support:active,
a[aria-label="Hỗ trợ Telegram"].fixed:active {
  transform: scale(0.96) !important;
}

/* Isolate floating support pointer events when any modal dialog or mobile drawer is open */
body.modal-open #floating-support,
body.has-modal-open #floating-support,
body[data-modal-open="true"] #floating-support,
body.sidebar-open #floating-support {
  pointer-events: none !important;
  opacity: 0.25 !important;
}

/* Toast Container - bottom right on desktop, bottom centered on mobile */
#toast-container {
  position: fixed !important;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)) !important;
  right: calc(1.5rem + env(safe-area-inset-right, 0px)) !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.5rem !important;
  pointer-events: none !important;
  max-width: calc(100vw - 2rem) !important;
}

@media (max-width: 640px) {
  #toast-container {
    left: 1rem !important;
    right: 1rem !important;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    align-items: center !important;
  }
}

/* FIX D: Support Center Ticket Buttons & Action Contrast */
#btn-new-ticket-toggle {
  background-color: #7c3aed !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  padding: 0.375rem 0.75rem !important;
  border-radius: 0.5rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background-color 0.15s ease, transform 0.15s ease !important;
  cursor: pointer !important;
}
#btn-new-ticket-toggle:hover {
  background-color: #6d28d9 !important;
  transform: translateY(-1px) !important;
}
#btn-new-ticket-toggle:active {
  background-color: #5b21b6 !important;
  transform: translateY(0) !important;
}

#btn-submit-ticket-create {
  background-color: #7c3aed !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  padding: 0.375rem 1rem !important;
  border-radius: 0.5rem !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background-color 0.15s ease, opacity 0.15s ease !important;
  cursor: pointer !important;
}
#btn-submit-ticket-create:hover:not(:disabled) {
  background-color: #6d28d9 !important;
}
#btn-submit-ticket-create:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
}

#btn-cancel-ticket-create {
  padding: 0.375rem 0.75rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.75rem !important;
  color: #71717a !important;
  background-color: transparent !important;
  border: 1px solid #d4d4d8 !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
  cursor: pointer !important;
}
.dark #btn-cancel-ticket-create {
  color: #a1a1aa !important;
  border-color: #3f3f46 !important;
}
#btn-cancel-ticket-create:hover {
  background-color: #f4f4f5 !important;
  color: #18181b !important;
}
.dark #btn-cancel-ticket-create:hover {
  background-color: #27272a !important;
  color: #ffffff !important;
}

#btn-submit-reply {
  background-color: #2563eb !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  padding: 0.5rem 1rem !important;
  border-radius: 0.5rem !important;
  transition: background-color 0.15s ease !important;
  cursor: pointer !important;
}
#btn-submit-reply:hover:not(:disabled) {
  background-color: #1d4ed8 !important;
}
#btn-submit-reply:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
}

/* Additional storefront utility coverage */
.size-4\.5 {
  width: 1.125rem !important;
  height: 1.125rem !important;
}
.bg-\[\#0099ff\] {
  background-color: #0099ff !important;
}
.text-\[\#039be5\] {
  color: #039be5 !important;
}
.text-\[\#2962ff\] {
  color: #2962ff !important;
}
.text-\[\#cc2027\] {
  color: #cc2027 !important;
}
.active\:scale-98:active {
  transform: scale(0.98) !important;
}
.min-h-\[calc\(100vh-128px\)\] {
  min-height: calc(100vh - 128px) !important;
}
.container-fluid {
  width: 100% !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

/* Explicit colors keep profile contrast independent of Tailwind gradient versions. */
.auth-profile-avatar {
  background: #2563eb linear-gradient(45deg, #2563eb, #4f46e5);
  color: #fff;
}
.auth-wallet-card {
  background: #1d4ed8 linear-gradient(135deg, #1d4ed8, #4338ca);
  color: #fff;
}
.auth-wallet-card > div { color: #fff; }


