/**
 * Aangan Aura — Phase 2: Core Components System
 * Brand: Aangan Aura ("Bring Positive Energy Home")
 * 
 * Includes:
 * 1. Buttons (Primary, Secondary, Ghost, Sweep Shine, Loading/Success States)
 * 2. Luxury 1:1 Product Cards (Hover Crossfade, Shimmer, Wishlist Pop, Slide-up Cart)
 * 3. Flying Cart Thumbnail & Badge Bounce Animations
 * 4. Mini-Cart Drawer (Slide-in from right, Overlay, Progress Bar)
 * 5. Interactive Tabs with Sliding Underline & Smooth Accordions
 * 6. Sticky Header Shrink (64px -> 56px) & Mobile Smart Hide/Show
 * 7. WhatsApp Floating Button with 5s gentle pulse
 */

/* ========================================================
   1. BUTTONS SYSTEM (14px Radius, Micro-Interactions)
   ======================================================== */
.aa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 180ms var(--ease), 
              box-shadow 180ms var(--ease), 
              background 180ms var(--ease), 
              border-color 180ms var(--ease),
              color 180ms var(--ease);
  text-align: center;
  user-select: none;
  position: relative;
  overflow: hidden;
  line-height: 1.3;
}

.aa-btn:hover {
  transform: translateY(-2px);
}

.aa-btn:active {
  transform: scale(0.97);
}

.aa-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* Primary Button (Terracotta with 700ms sweep shine) */
.aa-btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 14px -2px rgba(194, 65, 12, 0.3);
}

.aa-btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 8px 22px -3px rgba(194, 65, 12, 0.45);
}

.aa-btn-primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(25deg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
}

.aa-btn-primary:hover::after {
  opacity: 1;
  animation: sweepShine 700ms ease forwards;
}

/* Secondary Button (Hairline Sand Border) */
.aa-btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.aa-btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-subtle);
  box-shadow: var(--shadow-md);
}

/* Ghost Button */
.aa-btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.aa-btn-ghost:hover {
  color: var(--primary);
  background: var(--primary-subtle);
}

/* Button Loading & Success States */
.aa-btn.is-loading {
  pointer-events: none;
  color: transparent !important;
}

.aa-btn.is-loading::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: btnSpinner 600ms linear infinite;
}

.aa-btn-secondary.is-loading::before,
.aa-btn-ghost.is-loading::before {
  border-color: rgba(194, 65, 12, 0.2);
  border-top-color: var(--primary);
}

@keyframes btnSpinner {
  to { transform: rotate(360deg); }
}

.aa-btn.is-success {
  background: var(--success) !important;
  color: #FFFFFF !important;
  border-color: var(--success) !important;
}

/* ========================================================
   2. LUXURY 1:1 PRODUCT CARD COMPONENT
   ======================================================== */
.aa-product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--duration-base) var(--ease), 
              box-shadow var(--duration-base) var(--ease), 
              border-color var(--duration-base) var(--ease);
  position: relative;
  overflow: hidden;
}

.aa-product-card:hover {
  transform: translateY(-4px);
  border-color: rgba(194, 65, 12, 0.28);
  box-shadow: var(--shadow-hover);
}

/* 1:1 Image Frame on Warm Cream Background */
.aa-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background-color: var(--bg);
}

.aa-card-img-primary,
.aa-card-img-secondary {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms var(--ease), opacity 350ms var(--ease);
}

.aa-card-img-secondary {
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  .aa-product-card:hover .aa-card-img-primary {
    transform: scale(1.05);
  }
  .aa-product-card:hover .aa-card-img-secondary {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* Image Fade-in on Load & Shimmer Skeleton */
.aa-img-loading {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Wishlist Heart Button with Pop Animation */
.aa-wishlist-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  min-height: 32px !important;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: transform 180ms var(--ease), background 180ms ease, color 180ms ease;
}

html.dark .aa-wishlist-btn {
  background: rgba(30, 26, 23, 0.85);
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.1);
}

.aa-wishlist-btn:hover {
  transform: scale(1.15);
  color: #E11D48;
}

.aa-wishlist-btn.is-active {
  color: #E11D48;
  animation: heartPop 350ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Charcoal Discount Badge */
.aa-badge-discount-charcoal {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--dark);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 5;
}

/* Card Content Typography */
.aa-card-content {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Short Lab Certified Label */
.aa-card-lab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 4px;
}

.aa-card-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--duration-fast) ease;
}

.aa-product-card:hover .aa-card-title {
  color: var(--primary);
}

/* Card Price Row */
.aa-card-price-row {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.aa-card-price {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.aa-card-mrp {
  font-size: 12px;
  color: var(--muted-light);
  text-decoration: line-through;
}

.aa-card-save {
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
}

/* Desktop Slide-up Add to Cart / Mobile Compact Button */
.aa-card-action {
  margin-top: 12px;
  position: relative;
}

@media (min-width: 768px) {
  .aa-desktop-slide-btn {
    transform: translateY(8px);
    opacity: 0.9;
    transition: transform var(--duration-base) var(--ease), opacity var(--duration-base) var(--ease), background var(--duration-fast) var(--ease);
  }
  .aa-product-card:hover .aa-desktop-slide-btn {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========================================================
   3. FLY TO CART ANIMATION & BADGE BOUNCE
   ======================================================== */
.aa-flying-clone {
  position: fixed;
  z-index: 10000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(194, 65, 12, 0.4);
  transition: all 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes badgeBounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.45); }
  65% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.badge-bounce {
  animation: badgeBounce 500ms cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* ========================================================
   4. MINI-CART DRAWER (Slide-in from Right)
   ======================================================== */
.aa-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 9, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9990;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms var(--ease), visibility 300ms var(--ease);
}

.aa-drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.aa-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  color: var(--text);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.25);
  z-index: 9995;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 300ms var(--ease);
}

.aa-cart-drawer.is-open {
  transform: translateX(0);
}

/* Free Shipping Progress Bar */
.aa-shipping-meter {
  background: var(--primary-subtle);
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
}

.aa-meter-track {
  width: 100%;
  height: 6px;
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 6px;
}

.aa-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--primary));
  border-radius: var(--radius-pill);
  transition: width 500ms var(--ease);
}

/* ========================================================
   5. INTERACTIVE TABS & ACCORDION
   ======================================================== */
.aa-tabs-nav {
  display: flex;
  position: relative;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}

.aa-tab-btn {
  padding: 12px 4px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: color var(--duration-fast) ease;
}

.aa-tab-btn:hover {
  color: var(--text);
}

.aa-tab-btn.is-active {
  color: var(--primary);
  font-weight: 600;
}

.aa-tab-slider {
  position: absolute;
  bottom: -1px;
  height: 2px;
  background: var(--primary);
  transition: left 250ms var(--ease), width 250ms var(--ease);
  border-radius: 2px;
}

/* Accordion Component */
.aa-accordion-item {
  border-bottom: 1px solid var(--border);
}

.aa-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.aa-accordion-chevron {
  transition: transform 250ms var(--ease);
  color: var(--muted);
}

.aa-accordion-item.is-open .aa-accordion-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.aa-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms var(--ease);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.aa-accordion-item.is-open .aa-accordion-content {
  max-height: 400px;
  padding-bottom: 16px;
}

/* Coupon Ticket with One-Click Copy */
.aa-coupon-ticket {
  background: var(--primary-subtle);
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-btn);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ========================================================
   6. HEADER SHRINK & LINK UNDERLINE MOTIF
   ======================================================== */
header.aa-header {
  height: 64px;
  transition: height 200ms var(--ease), transform 250ms var(--ease), background 200ms var(--ease), box-shadow 200ms var(--ease);
}

header.aa-header.is-scrolled {
  height: 56px;
  box-shadow: var(--shadow-sm);
}

/* Header Navigation Standardized Pill & Baseline Alignment */
.aa-header-nav-link {
  display: inline-flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  height: 36px !important;
  line-height: 1 !important;
  padding: 0 10px !important;
  border-radius: 8px !important;
  font-family: var(--font-body, 'Poppins', sans-serif);
  font-size: 13px !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  border: none !important;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  vertical-align: middle !important;
  box-sizing: border-box !important;
  -webkit-appearance: none;
  appearance: none;
}

.aa-header-nav-link:hover {
  background-color: rgba(254, 242, 242, 0.8) !important;
  color: #C2410C !important;
}

/* Mobile smart hide on scroll down, show on scroll up */
@media (max-width: 1023px) {
  header.aa-header.is-hidden {
    transform: translateY(-100%);
  }
}

/* Link underline grows from left on hover */
.aa-nav-link {
  position: relative;
}

.aa-nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 200ms var(--ease);
  border-radius: 1px;
}

.aa-nav-link:hover::after {
  width: 100%;
}

/* ========================================================
   7. WHATSAPP FLOATING BUTTON (5s Gentle Pulse)
   ======================================================== */
.aa-whatsapp-btn {
  position: fixed;
  bottom: 84px; /* Above mobile sticky bottom bar */
  right: 16px;
  width: 48px;
  height: 48px;
  min-height: 48px !important;
  border-radius: 50%;
  background: #25D366;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.4);
  z-index: 40;
  transition: transform var(--duration-fast) var(--ease);
}

@media (min-width: 768px) {
  .aa-whatsapp-btn {
    bottom: 24px;
    right: 24px;
    width: 52px;
    height: 52px;
  }
}

.aa-whatsapp-btn:hover {
  transform: scale(1.08);
}

@keyframes gentlePulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6); }
  70% { box-shadow: 0 0 0 14px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.aa-whatsapp-pulse {
  animation: gentlePulse 1.8s ease-out;
}
