/* ===== OK MART - SMART SEARCH STYLES ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2ecc71;
  --primary-dark: #27ae60;
  --primary-light: #e8f8ef;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1a1e2b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,.06);
  --radius: 16px;
  --transition: all .2s cubic-bezier(.4,0,.2,1);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container { max-width: 480px; margin: 0 auto; position: relative; min-height: 100vh; }

/* ===== HEADER ===== */
.search-page-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}

.header-inner { display: flex; align-items: center; gap: 8px; }

.back-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 1.3rem; font-weight: 600;
  color: var(--text); flex-shrink: 0; transition: var(--transition);
}
.back-btn:active { background: var(--border); transform: scale(.92); }

.search-input-wrapper { flex: 1; position: relative; }
.search-icon-header {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 1rem; pointer-events: none; z-index: 1;
}
.search-input-header {
  width: 100%; padding: 12px 40px 12px 40px; background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 30px;
  font-size: .95rem; font-family: inherit; transition: var(--transition);
}
.search-input-header:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46,204,113,.1);
}
.clear-search-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); font-size: 1rem;
  cursor: pointer; padding: 6px; display: none; z-index: 1;
}
.clear-search-btn.visible { display: block; }

.cart-btn {
  width: 38px; height: 38px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 1.1rem; flex-shrink: 0; 
  position: relative; transition: var(--transition);
}
.cart-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--primary); color: white; font-size: .55rem; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; border: 2px solid white;
}

/* ===== MAIN ===== */
.search-main { padding: 0 14px 100px; }

/* ===== INITIAL STATE ===== */
.initial-state { text-align: center; padding: 40px 20px; }
.initial-icon { font-size: 4rem; opacity: .4; display: block; margin-bottom: 16px; }
.initial-state h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.initial-state p { color: var(--muted); margin-bottom: 30px; }

.trending-section { text-align: left; margin-bottom: 30px; }
.trending-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.trending-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.trending-tag {
  background: var(--card); border: 1.5px solid var(--border);
  padding: 10px 18px; border-radius: 40px; font-size: .85rem;
  font-weight: 500; cursor: pointer; transition: var(--transition);
}
.trending-tag:active { background: var(--primary); color: white; border-color: var(--primary); }

.quick-categories-section { text-align: left; }
.quick-categories-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.quick-categories-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-cat-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 8px;
  text-align: center; text-decoration: none; font-size: .8rem; font-weight: 600;
  color: var(--text); box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  transition: var(--transition);
}
.quick-cat-card:active { transform: scale(.95); background: var(--primary-light); }
.quick-cat-card span { display: block; margin-top: 4px; font-size: .75rem; }

/* ===== SUGGESTIONS PANEL ===== */
.suggestions-panel {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-md); margin-bottom: 16px; animation: slideDown .2s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.suggestions-header {
  padding: 10px 16px; font-size: .7rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border);
}
.suggestions-list { max-height: 300px; overflow-y: auto; }
.suggestion-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: background .15s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:active { background: var(--bg); }
.suggestion-image {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: #f1f5f9;
}
.suggestion-info { flex: 1; }
.suggestion-name { font-weight: 600; font-size: .9rem; }
.suggestion-name .highlight { background: rgba(46,204,113,.2); padding: 0 2px; border-radius: 4px; font-weight: 700; }
.suggestion-category { font-size: .7rem; color: var(--muted); }

/* ===== LOADING ===== */
.loading-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; color: var(--muted);
}
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin-bottom: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== SEARCH RESULTS ===== */
.results-header-bar {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 16px 0 12px;
}
.results-header-bar h2 { font-size: 1.1rem; font-weight: 700; }
.results-count { color: var(--muted); font-size: .85rem; }

.section-label { font-size: 1rem; font-weight: 700; margin-bottom: 12px; }

.slider-section { margin-bottom: 24px; }
.product-slider {
  display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 0; -ms-overflow-style: none; scroll-snap-type: x mandatory;
}
.product-slider::-webkit-scrollbar { display: none; }

.grid-section { margin-bottom: 24px; }
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

/* ===== PRODUCT CARD ===== */
.product-card {
  background: var(--card); border-radius: var(--radius); padding: 10px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  position: relative; cursor: pointer; transition: var(--transition);
}
.product-slider .product-card { flex: 0 0 150px; scroll-snap-align: start; }
.product-card:active { transform: scale(.98); }
.product-image {
  width: 100%; aspect-ratio: 1/1; object-fit: cover;
  border-radius: 12px; margin-bottom: 8px; background: #f1f5f9;
}
.product-name { font-weight: 700; font-size: .85rem; line-height: 1.3; margin-bottom: 2px; }
.product-unit { font-size: .65rem; color: var(--muted); display: block; margin-bottom: 6px; }
.price-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.current-price { font-weight: 800; font-size: .9rem; }
.mrp-price { font-size: .65rem; color: var(--muted); text-decoration: line-through; }
.discount-badge { margin-left: auto; background: #fee2e2; color: #dc2626; font-size: .6rem; font-weight: 700; padding: 2px 6px; border-radius: 20px; }
.add-btn {
  width: 100%; padding: 8px; background: var(--primary-light);
  border: 1.5px solid var(--primary); border-radius: 30px;
  color: var(--primary-dark); font-weight: 700; font-size: .7rem;
  text-transform: uppercase; cursor: pointer; transition: var(--transition);
}
.add-btn:active { background: var(--primary); color: white; }
.wishlist-mini, .share-mini {
  position: absolute; top: 6px; background: white;
  border: 1px solid var(--border); border-radius: 50%;
  width: 26px; height: 26px; display: flex; align-items: center;
  justify-content: center; cursor: pointer; font-size: .75rem; z-index: 2;
}
.wishlist-mini { right: 36px; }
.share-mini { right: 6px; }
.product-badge {
  position: absolute; top: 6px; left: 6px;
  background: var(--primary-dark); color: white; padding: 3px 8px;
  border-radius: 20px; font-size: .6rem; font-weight: 600; z-index: 2;
}

/* ===== NO RESULTS ===== */
.no-results { text-align: center; padding: 40px 20px; }
.no-results-icon { font-size: 4rem; opacity: .5; display: block; margin-bottom: 16px; }
.no-results h2 { font-size: 1.3rem; margin-bottom: 8px; }
.no-results p { color: var(--muted); margin-bottom: 24px; }
.popular-section { text-align: left; margin-bottom: 24px; }
.popular-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.browse-all-btn {
  display: inline-block; background: var(--primary); color: white;
  padding: 14px 28px; border-radius: 40px; text-decoration: none; font-weight: 600;
}

/* ===== FLOATING CART BAR ===== */
.floating-cart-bar {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%) translateY(20px);
  width: calc(100% - 28px); max-width: 452px; background: var(--card);
  padding: 12px 16px; border-radius: 16px; box-shadow: 0 -4px 20px rgba(0,0,0,.1);
  z-index: 95; border: 1px solid var(--border);
  opacity: 0; visibility: hidden; transition: all .3s cubic-bezier(.4,0,.2,1);
}
.floating-cart-bar.visible { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.cart-bar-inner { display: flex; align-items: center; justify-content: space-between; }
.cart-bar-info { display: flex; align-items: center; gap: 8px; }
.cart-bar-icon { font-size: 1.3rem; }
.cart-bar-count { font-weight: 600; font-size: .9rem; }
.cart-bar-btn {
  background: var(--primary); color: white; padding: 10px 20px;
  border-radius: 30px; font-weight: 700; font-size: .85rem;
  text-decoration: none; transition: var(--transition);
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); padding: 8px 16px;
  display: flex; justify-content: space-around; z-index: 90;
  max-width: 480px; margin: 0 auto;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: var(--muted); font-size: .65rem;
  gap: 2px; padding: 6px 12px; border-radius: 40px; transition: var(--transition);
}
.nav-item.active { color: var(--primary); font-weight: 600; background: var(--primary-light); }
.nav-item span:first-child { font-size: 1.1rem; }

/* ===== TOAST ===== */
.toast-message {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(100px);
  padding: 12px 24px; border-radius: 40px; font-weight: 500; z-index: 999;
  opacity: 0; transition: all .3s; white-space: nowrap; pointer-events: none;
}
.toast-message.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== RESPONSIVE ===== */
@media (min-width: 500px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
