/* ============================================================
   PetLint — Brand CSS
   Tailwind handles utilities; this file handles:
   - CSS custom properties (brand tokens)
   - Custom animations & transitions
   - Component-specific overrides
   ============================================================ */

/* ---- Brand Tokens ---- */
:root {
  --color-forest:    #1B3A2E;
  --color-forest-90: rgba(27,58,46,0.9);
  --color-sage:      #4A9B76;
  --color-sage-light:#E8F5EE;
  --color-coral:     #E8603A;
  --color-coral-dark:#C94E2B;
  --color-cream:     #F9F7F3;
  --color-white:     #FFFFFF;
  --color-dark:      #1A1A1A;
  --color-gray:      #6B7280;
  --color-gray-light:#E5E7EB;
  --color-border:    #D1D5DB;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.14);

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-full:9999px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background-color: var(--color-cream);
  color: var(--color-dark);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Navigation ---- */
.nav-link {
  color: var(--color-forest);
  font-weight: 500;
  font-size: 0.9rem;
  transition: color var(--transition);
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: var(--color-coral);
  transition: width var(--transition);
}
.nav-link:hover { color: var(--color-coral); }
.nav-link:hover::after { width: 100%; }
.nav-link.active { color: var(--color-coral); }
.nav-link.active::after { width: 100%; }

/* ---- Cart Badge ---- */
.cart-badge {
  position: absolute;
  top: -8px; right: -8px;
  background: var(--color-coral);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  animation: badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes badge-pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ---- Buttons ---- */
.btn-primary {
  background: var(--color-coral);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary:hover {
  background: var(--color-coral-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(232, 96, 58, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--color-forest);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-forest);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-decoration: none;
  white-space: nowrap;
}
.btn-secondary:hover {
  background: var(--color-forest);
  color: white;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--color-gray);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.btn-ghost:hover {
  border-color: var(--color-forest);
  color: var(--color-forest);
}

/* ---- Product Cards ---- */
.product-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.product-card-img {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.product-card:hover .product-card-img {
  transform: scale(1.04);
}

/* ---- Badge ---- */
.product-badge {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--color-forest);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.product-badge.coral { background: var(--color-coral); }

/* ---- Stars ---- */
.stars { display: inline-flex; gap: 2px; }
.stars .star { color: #F59E0B; font-size: 0.9rem; }
.stars .star.empty { color: var(--color-gray-light); }
.stars .star.half { color: #F59E0B; opacity: 0.6; }

/* ---- Trust Badges ---- */
.trust-badge {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.85rem; font-weight: 500;
  color: var(--color-forest);
}
.trust-badge svg { flex-shrink: 0; }

/* ---- Section headings ---- */
.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-sage);
  margin-bottom: 0.5rem;
}
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--color-forest);
  line-height: 1.2;
}

/* ---- Hero ---- */
.hero-section {
  background: linear-gradient(135deg, var(--color-cream) 0%, #EEF7F2 100%);
  min-height: 80vh;
  display: flex; align-items: center;
}

/* ---- Feature icon ---- */
.feature-icon {
  width: 52px; height: 52px;
  background: var(--color-sage-light);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-sage);
  flex-shrink: 0;
}

/* ---- Testimonial card ---- */
.testimonial-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-gray-light);
}

/* ---- CTA Banner ---- */
.cta-banner {
  background: var(--color-forest);
  color: white;
}

/* ---- Footer ---- */
.footer {
  background: #111D17;
  color: rgba(255,255,255,0.7);
}
.footer a { color: rgba(255,255,255,0.7); transition: color var(--transition); }
.footer a:hover { color: white; }
.footer-heading { color: white; font-weight: 600; font-size: 0.9rem; margin-bottom: 1rem; }

/* ---- Quantity Input ---- */
.qty-input {
  display: inline-flex; align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.qty-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  font-size: 1.1rem; color: var(--color-forest);
  transition: background var(--transition);
}
.qty-btn:hover { background: var(--color-sage-light); }
.qty-number {
  width: 40px; text-align: center;
  font-weight: 600; font-size: 0.95rem;
  border: none; outline: none; background: transparent;
}

/* ---- Mobile Nav ---- */
.mobile-nav {
  display: none;
  position: fixed; top: 64px; left: 0; right: 0;
  background: white;
  z-index: 999;
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  flex-direction: column; gap: 1rem;
  border-top: 1px solid var(--color-gray-light);
}
.mobile-nav.open { display: flex; }

/* ---- Image Gallery ---- */
.gallery-thumb {
  width: 70px; height: 70px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
}
.gallery-thumb.active,
.gallery-thumb:hover {
  border-color: var(--color-coral);
}

/* ---- Toast Notification ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--color-forest);
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow-xl);
  z-index: 9999;
  display: flex; align-items: center; gap: 0.5rem;
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 320px;
}
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.toast.hide {
  animation: toast-out 0.2s ease forwards;
}
@keyframes toast-out {
  to { transform: translateY(20px); opacity: 0; }
}

/* ---- Loading spinner ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Form inputs ---- */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  color: var(--color-dark);
  background: white;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus {
  border-color: var(--color-sage);
  box-shadow: 0 0 0 3px rgba(74,155,118,0.15);
}
.form-label {
  display: block;
  font-size: 0.85rem; font-weight: 600;
  color: var(--color-forest);
  margin-bottom: 0.375rem;
}

/* ---- Empty cart ---- */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
}
.empty-state-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--color-forest); margin-bottom: 0.5rem;
}
.empty-state-text { color: var(--color-gray); margin-bottom: 2rem; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hero-section { min-height: auto; padding: 3rem 0; }
  .section-title { font-size: 1.75rem; }
}

/* ---- Utilities ---- */
.text-forest { color: var(--color-forest); }
.text-sage   { color: var(--color-sage); }
.text-coral  { color: var(--color-coral); }
.text-gray   { color: var(--color-gray); }
.bg-cream    { background: var(--color-cream); }
.bg-forest   { background: var(--color-forest); }
.bg-sage-light { background: var(--color-sage-light); }

/* ---- Page load fade-in ---- */
@keyframes body-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
body { animation: body-fade-in 0.35s ease forwards; }

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  will-change: transform, opacity;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}
.reveal-stagger > .reveal:nth-child(1) { transition-delay:   0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 120ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 360ms; }
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.visible {
    opacity: 1; transform: none; transition: none; will-change: auto;
  }
}

/* ---- Button ripple ---- */
.btn-primary, .btn-secondary { position: relative; overflow: hidden; }
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  animation: ripple-anim 0.55s linear;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: none;
}
@keyframes ripple-anim {
  to { transform: scale(4); opacity: 0; }
}

/* ---- Skeleton shimmer (used while JS populates grids) ---- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
  display: block;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Checkout modal: full-screen on mobile ---- */
@media (max-width: 480px) {
  #checkout-modal {
    padding: 0 !important;
    align-items: flex-start !important;
  }
  .checkout-modal-inner {
    border-radius: 0 !important;
    max-width: 100vw !important;
    min-height: 100dvh;
    margin: 0;
    padding: 24px 16px !important;
  }
}

/* ---- Cart: two-column collapses to single column on mobile ---- */
@media (max-width: 767px) {
  #cart-layout { display: block !important; }
  #cart-summary { display: block !important; position: static !important; }
}

/* ---- Admin tables: horizontally scrollable on mobile ---- */
.table-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

/* ---- Product card entrance (scale + fade) ---- */
.card-reveal {
  opacity: 0;
  transform: scale(0.94) translateY(16px);
  will-change: transform, opacity;
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.card-reveal.card-visible {
  opacity: 1;
  transform: none;
  will-change: auto;
}
@media (prefers-reduced-motion: reduce) {
  .card-reveal, .card-reveal.card-visible {
    opacity: 1; transform: none; transition: none; will-change: auto;
  }
}

/* ---- Image shimmer (shown while product images load) ---- */
img[data-fade-init] {
  background: linear-gradient(90deg, #efefef 25%, #f5f5f5 50%, #efefef 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* ---- Nav scroll effect ---- */
#site-header { transition: box-shadow 0.3s ease; }
#site-header.nav-scrolled {
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.09);
}

/* ---- Touch target: all buttons at least 44px ---- */
button, .btn-primary, .btn-secondary, .btn-ghost, .qty-btn {
  min-height: 44px;
}
.qty-btn { min-height: 36px; } /* qty stepper is intentionally compact */
