/*
Theme Name: IndiMarket
Theme URI: https://example.com
Author: Your Team
Description: Mobile-first multi-vendor marketplace theme for the Indian market. Built for WooCommerce + Dokan. Implements homepage, PDP, checkout and vendor-dashboard patterns from the IndiMarket design spec (Phases 1-5).
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
Tested up to: 6.6
Text Domain: indimarket
WC requires at least: 8.0
WC tested up to: 9.0
*/

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root{
  --im-brand: #C0392B;          /* festive accent - override in Customizer */
  --im-brand-dark: #922B21;
  --im-gold: #D4A017;
  --im-success: #1E8E3E;
  --im-danger: #D93025;
  --im-warning: #E8A33D;
  --im-text: #1A1A1A;
  --im-text-muted: #6B6B6B;
  --im-border: #E5E5E5;
  --im-bg: #FFFFFF;
  --im-bg-alt: #F7F7F7;
  --im-radius-sm: 6px;
  --im-radius-md: 12px;
  --im-radius-lg: 20px;
  --im-header-h: 56px;
  --im-bottomnav-h: 60px;
  --im-shadow-1: 0 2px 8px rgba(0,0,0,0.08);
  --im-shadow-2: 0 4px 16px rgba(0,0,0,0.12);
  --im-transition-fast: 120ms ease;
  --im-transition-med: 250ms ease;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--im-text);
  font-size: 15px;
  line-height: 1.5;
  background: var(--im-bg-alt);
  margin: 0;
  padding-bottom: var(--im-bottomnav-h); /* space for persistent bottom nav */
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font-family: inherit; font-size: 16px; } /* 16px prevents iOS auto-zoom on focus */

/* ==========================================================================
   2. STICKY HEADER + PIN STRIP  (Phase 3 - Homepage / global)
   ========================================================================== */
.im-header{
  position: sticky; top: 0; z-index: 40;
  height: var(--im-header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--im-bg);
  transition: box-shadow var(--im-transition-med);
}
.im-header.is-scrolled{ box-shadow: var(--im-shadow-1); }
.im-header__logo{ flex-shrink: 0; font-weight: 700; font-size: 18px; }
.im-header__search{
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: var(--im-bg-alt); border-radius: var(--im-radius-lg);
  padding: 8px 14px; min-width: 0;
}
.im-header__search input{ border: none; background: transparent; width: 100%; outline: none; }
.im-header__icons{ display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.im-cart-badge{ position: relative; }
.im-cart-badge .count{
  position: absolute; top: -6px; right: -8px;
  background: var(--im-brand); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--im-transition-fast);
}
.im-cart-badge.bump .count{ transform: scale(1.3); }

.im-pin-strip{
  display: flex; align-items: center; justify-content: space-between;
  height: 32px; padding: 0 16px; font-size: 13px;
  background: #FFF6E5; border-bottom: 1px solid var(--im-border);
}
.im-pin-strip button{ background: none; border: none; color: var(--im-brand); font-weight: 600; }
.im-pin-strip.state-success{ background: #E9F7EE; color: var(--im-success); }
.im-pin-strip.state-error{ background: #FCECEA; color: var(--im-danger); }

/* ==========================================================================
   3. BOTTOM NAVIGATION (thumb-zone, 5 items max)
   ========================================================================== */
.im-bottom-nav{
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  height: var(--im-bottomnav-h);
  display: flex;
  background: var(--im-bg);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.im-bottom-nav a{
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; color: var(--im-text-muted);
  min-height: 44px;
}
.im-bottom-nav a.is-active{ color: var(--im-brand); font-weight: 600; }
.im-bottom-nav .icon{ font-size: 20px; line-height: 1; }
.im-bottom-nav .badge{
  position: absolute; margin-left: 12px; margin-top: -6px;
  background: var(--im-danger); color: #fff; font-size: 9px;
  border-radius: 50%; min-width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
}

/* ==========================================================================
   4. CATEGORY BUBBLES (Blinkit style)
   ========================================================================== */
.im-category-bubbles{
  display: flex; gap: 16px; overflow-x: auto; padding: 16px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.im-category-bubbles::-webkit-scrollbar{ display: none; }
.im-bubble{ flex-shrink: 0; text-align: center; width: 72px; scroll-snap-align: start; }
.im-bubble__img{
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--im-bg-alt); transition: transform var(--im-transition-fast);
}
.im-bubble:active .im-bubble__img{ transform: scale(0.92); }
.im-bubble__label{ font-size: 12px; font-weight: 500; margin-top: 6px; }

/* Skeleton shimmer (used for bubbles, product cards, rails) */
.im-skeleton{
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 37%, #eee 63%);
  background-size: 400% 100%;
  animation: im-shimmer 1.2s ease infinite;
}
@keyframes im-shimmer{ 0%{background-position:100% 50%} 100%{background-position:0 50%} }
.im-bubble__img.im-skeleton{ border-radius: 50%; }

/* ==========================================================================
   5. FLASH SALE / FESTIVE STRIP
   ========================================================================== */
.im-flash-sale{
  background: linear-gradient(135deg, var(--im-brand-dark), var(--im-brand));
  color: #fff; padding: 14px 16px; margin: 12px 0;
}
.im-flash-sale__header{ display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.im-flash-sale__title{ font-weight: 700; font-size: 15px; }
.im-flash-sale__timer{ font-family: 'Courier New', monospace; font-weight: 700; background: rgba(0,0,0,0.2); padding: 4px 8px; border-radius: var(--im-radius-sm); }
.im-flash-sale__rail{ display: flex; gap: 10px; overflow-x: auto; }

/* ==========================================================================
   6. PRODUCT CARD (grids + rails)
   ========================================================================== */
.im-product-grid{ display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 12px; }
.im-product-rail{ display: flex; gap: 12px; overflow-x: auto; padding: 0 12px 4px; }
.im-product-card{
  background: var(--im-bg); border-radius: var(--im-radius-md);
  overflow: hidden; border: 1px solid var(--im-border);
  transition: transform var(--im-transition-fast), box-shadow var(--im-transition-fast);
  flex-shrink: 0; width: 165px;
}
.im-product-grid .im-product-card{ width: auto; }
.im-product-card:active{ transform: translateY(1px); box-shadow: var(--im-shadow-1); }
.im-product-card__img-wrap{ position: relative; aspect-ratio: 4/5; background: var(--im-bg-alt); }
.im-product-card__img-wrap img{ width: 100%; height: 100%; object-fit: cover; }
.im-badge-discount{
  position: absolute; top: 8px; left: 8px;
  background: var(--im-success); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 6px; border-radius: var(--im-radius-sm);
}
.im-product-card__body{ padding: 8px 10px 12px; }
.im-product-card__title{ font-size: 13px; margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.im-price{ display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.im-price__sale{ font-weight: 700; font-size: 15px; }
.im-price__mrp{ text-decoration: line-through; color: var(--im-text-muted); font-size: 12px; }
.im-price__off{ color: var(--im-success); font-size: 12px; font-weight: 600; }
.im-stock-urgency{ color: var(--im-danger); font-size: 11px; font-weight: 600; margin-top: 4px; }

/* ==========================================================================
   7. VENDOR TRUST STRIP + BADGES (PDP)
   ========================================================================== */
.im-vendor-strip{ display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--im-bg-alt); }
.im-vendor-strip__name a{ font-weight: 600; }
.im-vendor-rating{ font-size: 13px; color: var(--im-warning); }
.im-badge-chip{
  display: inline-flex; align-items: center; gap: 4px;
  background: #EAF6EF; color: var(--im-success);
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px;
  margin-right: 6px;
}
.im-trust-badges{ display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--im-border); border-bottom: 1px solid var(--im-border); }
.im-trust-badges .item{ display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--im-text-muted); }

/* ==========================================================================
   8. PIN CODE CHECKER (PDP + Checkout)
   ========================================================================== */
.im-pin-checker{ padding: 12px 16px; border: 1px dashed var(--im-border); border-radius: var(--im-radius-md); margin: 12px 16px; }
.im-pin-checker__row{ display: flex; gap: 8px; }
.im-pin-checker input{ flex: 1; border: 1px solid var(--im-border); border-radius: var(--im-radius-sm); padding: 10px 12px; }
.im-pin-checker button{
  background: var(--im-text); color: #fff; border: none; border-radius: var(--im-radius-sm);
  padding: 0 16px; font-weight: 600;
}
.im-pin-checker__result{ margin-top: 8px; font-size: 13px; }
.im-pin-checker__result.success{ color: var(--im-success); }
.im-pin-checker__result.error{ color: var(--im-danger); }

/* ==========================================================================
   9. STICKY ADD-TO-CART FOOTER (PDP)
   ========================================================================== */
.im-pdp-sticky-footer{
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 12px;
  background: var(--im-bg); box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.im-pdp-sticky-footer .icon-btn{
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--im-border); border-radius: 50%; flex-shrink: 0; font-size: 18px;
}
.im-pdp-sticky-footer .icon-btn.whatsapp{ color: #25D366; border-color: #25D366; }
.im-add-to-cart-btn{
  flex: 1; height: 46px; border: none; border-radius: var(--im-radius-md);
  background: var(--im-brand); color: #fff; font-weight: 700; font-size: 15px;
  transition: transform var(--im-transition-fast), background var(--im-transition-fast);
}
.im-add-to-cart-btn:active{ transform: scale(0.98); background: var(--im-brand-dark); }
.im-add-to-cart-btn.is-loading{ opacity: 0.7; pointer-events: none; }
.im-add-to-cart-btn.is-added{ background: var(--im-success); }
.im-add-to-cart-btn:disabled{ background: #C9C9C9; }

/* ==========================================================================
   10. CHECKOUT (Phase 3 - one page flow)
   ========================================================================== */
.im-checkout-section{ background: var(--im-bg); margin: 8px 0; padding: 16px; border-radius: var(--im-radius-md); }
.im-checkout-section h3{ font-size: 14px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--im-text-muted); margin: 0 0 12px; }
.im-address-chip-row{ display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.im-address-chip{ flex-shrink: 0; border: 1px solid var(--im-border); border-radius: 20px; padding: 6px 14px; font-size: 13px; }
.im-address-chip.is-selected{ border-color: var(--im-brand); color: var(--im-brand); background: #FCECEA; }
.im-radio-card{
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--im-border); border-radius: var(--im-radius-md);
  padding: 12px; margin-bottom: 8px; cursor: pointer;
}
.im-radio-card.is-selected{ border-color: var(--im-brand); background: #FCECEA; }
.im-cod-warning{ font-size: 12px; color: var(--im-warning); background: #FFF6E5; padding: 8px 10px; border-radius: var(--im-radius-sm); margin-top: 8px; }
.im-checkout-sticky-footer{
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 16px; background: var(--im-bg);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.im-checkout-sticky-footer .im-place-order-btn{
  background: var(--im-brand); color: #fff; border: none; border-radius: var(--im-radius-md);
  padding: 12px 24px; font-weight: 700;
}
.im-checkout-sticky-footer .im-place-order-btn.shake{ animation: im-shake 200ms; }
@keyframes im-shake{ 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }

/* ==========================================================================
   11. VENDOR DASHBOARD (mobile)
   ========================================================================== */
.im-vendor-header{ display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--im-bg); }
.im-store-toggle{ display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.im-store-toggle .dot{ width: 8px; height: 8px; border-radius: 50%; background: var(--im-success); }
.im-store-toggle.is-paused .dot{ background: var(--im-text-muted); }
.im-earnings-card{ margin: 12px 16px; padding: 16px; border-radius: var(--im-radius-lg); background: linear-gradient(135deg, var(--im-brand-dark), var(--im-brand)); color: #fff; }
.im-earnings-card__amount{ font-size: 26px; font-weight: 700; }
.im-earnings-card__sub{ font-size: 12px; opacity: 0.85; margin-top: 4px; }
.im-earnings-card__cta{ margin-top: 12px; background: #fff; color: var(--im-brand); border: none; border-radius: var(--im-radius-sm); padding: 8px 14px; font-weight: 700; }
.im-stats-row{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 16px; }
.im-stat-card{ background: var(--im-bg); border-radius: var(--im-radius-md); padding: 12px; text-align: center; border: 1px solid var(--im-border); }
.im-stat-card.alert{ border-color: var(--im-warning); background: #FFF6E5; }
.im-stat-card.danger{ border-color: var(--im-danger); background: #FCECEA; }
.im-quick-actions{ display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 16px; }
.im-quick-action{ display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; text-align: center; }
.im-quick-action .icon{ width: 48px; height: 48px; border-radius: 50%; background: var(--im-bg); border: 1px solid var(--im-border); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.im-order-card{ background: var(--im-bg); border-radius: var(--im-radius-md); padding: 12px; margin: 0 16px 10px; border: 1px solid var(--im-border); }
.im-order-card__actions{ display: flex; gap: 8px; margin-top: 10px; }
.im-order-card__actions button{ flex: 1; padding: 10px; border-radius: var(--im-radius-sm); font-weight: 600; border: 1px solid var(--im-border); }
.im-order-card__actions .accept{ background: var(--im-success); color: #fff; border: none; }
.im-order-card__actions .reject{ background: transparent; color: var(--im-danger); border-color: var(--im-danger); }

/* ==========================================================================
   12. UTILITIES / LOW-BANDWIDTH BANNER
   ========================================================================== */
.im-low-bandwidth-banner{ background: #333; color: #fff; text-align: center; font-size: 12px; padding: 6px; }
.im-cls-guard{ aspect-ratio: 4/5; background: var(--im-bg-alt); }
.im-visually-hidden{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (min-width: 768px){
  .im-product-grid{ grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================================
   13. FIXED-BOTTOM-ELEMENT STACKING GUARD
   The bottom nav owns the true bottom:0 position. The PDP sticky
   add-to-cart bar must sit ABOVE it, not overlap it. Any third-party
   plugin bar (free-shipping bar, mini-cart drawer, cookie banner, etc.)
   that also uses position:fixed; bottom:0 will otherwise stack on top
   of both — this is what caused the "Shop More Than $100" bar to sit
   over the bottom nav on axobee.in. Raise the theme's own bottom-anchored
   elements above the nav height, and nudge any generic fixed bottom
   bar the same amount as a safety net.
   ========================================================================== */
.im-pdp-sticky-footer{ bottom: var(--im-bottomnav-h); }
.im-checkout-sticky-footer{ bottom: var(--im-bottomnav-h); }

/* Generic safety net for third-party bars we don't control the markup
   of. If your free-shipping-bar / sticky-cart plugin lets you set a
   custom CSS class, add "im-third-party-fixed-bar" to it; otherwise
   ask the plugin author for a bottom-offset setting instead of relying
   on this — !important is a last resort, not a first choice. */
.im-third-party-fixed-bar{ bottom: var(--im-bottomnav-h) !important; z-index: 39 !important; }
/* Force grid layout to win over WooCommerce defaults */ ul.products.im-product-grid{ display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; padding: 12px !important; margin: 0 !important; } ul.products.im-product-grid li.product{ float: none !important; width: auto !important; margin: 0 !important; clear: none !important; } .im-product-grid .im-product-card{ width: auto !important; } .im-product-card__title{ white-space: normal !important; overflow: visible !important; text-overflow: clip !important; display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden !important; }
.im-hero-slider{ position: relative; overflow: hidden; }
.im-hero-track{ display: flex; transition: transform 0.4s ease; }
.im-hero-slide{
	flex: 0 0 100%;
	min-height: 200px;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 20px;
	text-decoration: none;
	position: relative;
	overflow: hidden;
}
.im-hero-badge{
	display: inline-block;
	width: fit-content;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 20px;
	margin-bottom: 10px;
}
.im-hero-headline{
	color: #fff;
	font-size: 22px;
	font-weight: 700;
	margin: 0 0 4px;
	line-height: 1.25;
}
.im-hero-sub{
	color: rgba(255,255,255,0.85);
	font-size: 13px;
	margin: 0 0 14px;
}
.im-hero-cta{
	display: inline-block;
	width: fit-content;
	background: #fff;
	color: #222;
	font-size: 13px;
	font-weight: 600;
	padding: 9px 18px;
	border-radius: 20px;
}
.im-hero-dots{
	position: absolute;
	bottom: 12px;
	right: 16px;
	display: flex;
	gap: 6px;
}
.im-hero-dot{
	width: 16px;
	height: 4px;
	border-radius: 2px;
	background: rgba(255,255,255,0.4);
	border: none;
	padding: 0;
}
.im-hero-dot.is-active{ background: #fff; width: 22px; }
 /* Force correct 2-column placement for every product grid item */ .im-product-grid .im-grid-item:nth-child(odd){ grid-column: 1 !important; } .im-product-grid .im-grid-item:nth-child(even){ grid-column: 2 !important; }