/* ============================================================
   OhSens — Custom CSS
   Animations & styles that Tailwind CDN can't cover
   ============================================================ */

/* ── Root variables ────────────────────────────────────────── */
:root {
  --coral:     #FF4D4D;
  --coral-dark:#E03E3E;
  --teal:      #0ECECE;
  --teal-dark: #0AB0B0;
  --dark:      #1A1A2E;
  --dark-2:    #16213E;
  --radius:    1rem;
}

/* ── Smooth scroll ──────────────────────────────────────────── */
html { scroll-behavior: smooth; }

/* ── Coral colour helpers (Tailwind CDN doesn't know them) ── */
.text-coral        { color: var(--coral); }
.text-coral-dark   { color: var(--coral-dark); }
.bg-coral          { background-color: var(--coral); }
.bg-coral-dark     { background-color: var(--coral-dark); }
.hover\:bg-coral-dark:hover { background-color: var(--coral-dark); }
.border-coral      { border-color: var(--coral); }
.focus\:border-coral:focus  { border-color: var(--coral); }
.ring-coral        { --tw-ring-color: var(--coral); }

.text-teal         { color: var(--teal); }
.bg-teal           { background-color: var(--teal); }
.border-teal       { border-color: var(--teal); }
.hover\:text-teal:hover { color: var(--teal); }

/* ── Neon glow helpers ──────────────────────────────────────── */
.glow-coral {
  text-shadow: 0 0 20px rgba(255,77,77,.7), 0 0 40px rgba(255,77,77,.4);
}
.glow-teal {
  text-shadow: 0 0 20px rgba(14,206,206,.7), 0 0 40px rgba(14,206,206,.4);
}
.shadow-coral {
  box-shadow: 0 8px 30px rgba(255,77,77,.35);
}
.shadow-teal {
  box-shadow: 0 8px 30px rgba(14,206,206,.35);
}

/* ── Slide-out Cart ─────────────────────────────────────────── */
#cart-drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: #fff;
  z-index: 9999;
  transform: translateX(110%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.18);
}
#cart-drawer.is-open {
  transform: translateX(0);
}
#cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
#cart-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* free-shipping progress bar */
#shipping-bar-fill {
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ── Product card hover image swap ──────────────────────────── */
.product-card { position: relative; overflow: hidden; }
.product-card .img-primary,
.product-card .img-hover {
  transition: opacity .35s ease;
}
.product-card .img-hover { opacity: 0; position: absolute; inset: 0; }
.product-card:hover .img-primary { opacity: 0; }
.product-card:hover .img-hover   { opacity: 1; }

/* Add-to-cart button pulse on click */
.btn-atc.adding {
  animation: atc-pulse .4s ease;
}
@keyframes atc-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(.93); }
  100% { transform: scale(1); }
}

/* ── Hero section ───────────────────────────────────────────── */
.hero-bg {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 60%, #0a0a1a 100%);
}

/* floating particles in hero */
.hero-particle {
  position: absolute;
  border-radius: 50%;
  animation: float-up linear infinite;
  pointer-events: none;
}
@keyframes float-up {
  0%   { transform: translateY(0)   scale(1);   opacity: .6; }
  100% { transform: translateY(-80vh) scale(.4); opacity: 0; }
}

/* ── Flash sale countdown ───────────────────────────────────── */
.countdown-unit {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 3rem;
}
.countdown-digit {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  /* prevent layout shift when digits change */
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 900;
  color: var(--coral);
  line-height: 1;
}

/* ── Reviews carousel ───────────────────────────────────────── */
#reviews-track {
  display: flex;
  gap: 1.5rem;
  will-change: transform;
}
.review-card {
  flex: 0 0 300px;
  scroll-snap-align: start;
}

/* ── Category card gradient overlay ────────────────────────── */
.cat-card-overlay {
  background: linear-gradient(to top, rgba(26,26,46,.9) 0%, transparent 60%);
  transition: background .3s;
}
.cat-card-wrap:hover .cat-card-overlay {
  background: linear-gradient(to top, rgba(255,77,77,.7) 0%, transparent 70%);
}

/* ── Flash messages ─────────────────────────────────────────── */
.flash-msg {
  animation: flash-in .35s ease, flash-out .35s ease 4.65s forwards;
}
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes flash-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}

/* ── Star rating ────────────────────────────────────────────── */
.stars-input input[type="radio"] { display: none; }
.stars-input label {
  cursor: pointer;
  font-size: 1.5rem;
  color: #d1d5db;
  transition: color .15s;
}
.stars-input input:checked ~ label,
.stars-input label:hover,
.stars-input label:hover ~ label { color: #fbbf24; }

/* ── Gallery thumbs ─────────────────────────────────────────── */
.gallery-thumb {
  cursor: pointer;
  opacity: .6;
  transition: opacity .2s, ring .2s;
}
.gallery-thumb.active,
.gallery-thumb:hover { opacity: 1; }

/* ── Skeleton loader ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: .5rem;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Quantity stepper ───────────────────────────────────────── */
.qty-stepper button {
  width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: .5rem;
  font-size: 1.1rem;
  font-weight: 700;
  background: #f3f4f6;
  transition: background .15s, color .15s;
  border: none; cursor: pointer;
}
.qty-stepper button:hover { background: var(--coral); color: #fff; }
.qty-stepper input {
  width: 2.8rem; text-align: center;
  border: 2px solid #e5e7eb;
  border-radius: .5rem;
  font-weight: 700;
  padding: .25rem 0;
  -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Mobile nav overlay ─────────────────────────────────────── */
#mobile-menu {
  transform: translateY(-110%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
#mobile-menu.is-open {
  transform: translateY(0);
}

/* ── Smooth page transitions ────────────────────────────────── */
.page-enter { animation: page-in .3s ease; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Admin sidebar active ────────────────────────────────────── */
.admin-nav-item.active {
  background: rgba(255,77,77,.12);
  color: var(--coral);
  border-right: 3px solid var(--coral);
}

/* ── Tooltip ─────────────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  padding: .3rem .6rem;
  border-radius: .4rem;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
  z-index: 100;
}
[data-tip]:hover::after { opacity: 1; }

/* ── Scrollbar thin ─────────────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: #f1f1f1; }
::-webkit-scrollbar-thumb  { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--coral); }

/* ── Responsive tweaks ──────────────────────────────────────── */
@media (max-width: 640px) {
  #cart-drawer { width: 100vw; }
}
