/* ================================================================
   APEX DIGITAL HUB – STYLE.CSS (V4.0 – Final, Professional)
   Complete, polished, no missing styles
   ================================================================ */

:root {
  --primary: #f68b1e;
  --primary-dark: #e07b10;
  --primary-light: #fff3e6;
  --white: #ffffff;
  --bg: #f5f5f5;
  --text: #1a1a1a;
  --text-secondary: #666;
  --border: #e0e0e0;
  --success: #4caf50;
  --danger: #e74c3c;
  --warning: #ffc107;
  --info: #17a2b8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --header-height: 56px;
  --bottom-nav-height: 64px;
  --fab-size: 56px;
  --fab-bottom: 80px;
  --action-bar-height: 70px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  padding-top: var(--header-height);
  padding-bottom: var(--bottom-nav-height);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
}

/* DARK MODE */
body.dark {
  --bg: #121212;
  --white: #1e1e1e;
  --text: #e0e0e0;
  --text-secondary: #aaa;
  --border: #333;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
}
body.dark .header { background: #1a1a1a; }
body.dark .product-card,
body.dark .card,
body.dark .cart-list,
body.dark .auth-form { background: #1e1e1e; }

/* HEADER */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.header-left { display: flex; align-items: center; gap: 0.75rem; }
.header-left h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.3px; }
.back-btn {
  font-size: 1.25rem; cursor: pointer; color: white;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; transition: background 0.2s;
}
.back-btn:hover { background: rgba(255,255,255,0.15); }
.header-right { display: flex; align-items: center; gap: 1.25rem; }
.wallet-pill {
  cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 0.25rem;
  color: white; background: rgba(255,255,255,0.15); padding: 0.35rem 0.75rem;
  border-radius: 20px; transition: background 0.2s;
}
.wallet-pill:hover { background: rgba(255,255,255,0.25); }
.wallet-pill i { font-size: 1rem; }
.notif-bell {
  position: relative; cursor: pointer; font-size: 1.3rem; color: white;
}
.notif-badge {
  position: absolute; top: -6px; right: -10px;
  background: var(--danger); color: white; border-radius: 50%;
  width: 18px; height: 18px; font-size: 0.65rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* FLOATING CART */
.fab-cart {
  position: fixed; bottom: var(--fab-bottom); right: 16px; z-index: 99;
  width: var(--fab-size); height: var(--fab-size); border-radius: 50%;
  background: var(--primary); color: white; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(246,139,30,0.4); cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none; font-size: 1.5rem;
}
.fab-cart:active { transform: scale(0.95); }
.fab-cart-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: white; border-radius: 50%;
  width: 22px; height: 22px; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.fab-cart.bounce { animation: bounce 0.3s; }
@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* PAGES */
.page {
  display: none;
  padding: 1rem;
  min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
  animation: fadeIn 0.25s ease;
}
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* BOTTOM ACTION BAR */
.bottom-action-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white); padding: 0.75rem 1rem;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 99;
  display: flex; gap: 0.5rem; align-items: center;
  height: var(--action-bar-height);
}
.bottom-action-bar .btn { flex: 1; }

/* BANNER */
.banner-slider { display: flex; overflow-x: auto; margin-bottom: 1.25rem; scroll-snap-type: x mandatory; }
.banner-slide { min-width: 100%; height: 160px; scroll-snap-align: start; }
.banner-slide img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }

/* CATEGORY TABS */
.category-tabs { display: flex; gap: 0.5rem; overflow-x: auto; padding: 0.5rem 0 1rem; }
.category-tab {
  padding: 0.4rem 1.25rem; border-radius: 20px; background: var(--white);
  border: 1px solid var(--border); cursor: pointer; white-space: nowrap;
  font-size: 0.85rem; font-weight: 500; color: var(--text);
  transition: all 0.2s; box-shadow: var(--shadow-sm);
}
.category-tab.active { background: var(--primary); color: white; border-color: var(--primary); }

/* PRODUCT GRID */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.product-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s; position: relative;
  border: 1px solid transparent;
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.product-card img { width: 100%; height: 130px; object-fit: cover; }
.product-info { padding: 0.75rem; }
.product-info h3 { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; line-height: 1.3; }
.product-info .price { font-weight: 700; color: var(--primary); font-size: 1rem; margin-bottom: 0.25rem; }
.product-info .rating { font-size: 0.75rem; color: #f39c12; display: flex; align-items: center; gap: 3px; }
.btn-add {
  background: var(--primary); color: white; border: none;
  padding: 0.4rem; border-radius: 6px; cursor: pointer; width: 100%;
  font-size: 0.8rem; font-weight: 600; margin-top: 0.5rem;
}
.btn-add:active { transform: scale(0.97); }
.wish-heart {
  position: absolute; top: 8px; right: 8px; color: rgba(255,255,255,0.8); font-size: 1.2rem;
  cursor: pointer; transition: color 0.2s; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.wish-heart.active { color: var(--danger); transform: scale(1.1); }

/* PRODUCT DETAIL */
.product-detail { background: var(--white); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.main-image { width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--radius-sm); margin-bottom: 1.5rem; background: #fafafa; cursor: zoom-in; }
.product-detail h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
.product-detail .price { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.product-detail .rating { margin-bottom: 1rem; color: #f39c12; }
.product-detail p { color: var(--text-secondary); margin-bottom: 1.5rem; line-height: 1.6; }
.reviews-section { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.reviews-section h3 { margin-bottom: 1rem; }
.star-rating span { font-size: 1.8rem; cursor: pointer; color: #ddd; transition: color 0.1s; }
.star-rating span.active, .star-rating span:hover { color: #f39c12; }
textarea {
  width: 100%; padding: 0.75rem; margin: 0.75rem 0; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--white); color: var(--text);
  font-size: 0.9rem; resize: vertical; min-height: 80px;
}

/* CART */
.cart-list { background: var(--white); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.cart-item { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-info h4 { font-size: 0.95rem; margin-bottom: 0.15rem; }
.cart-item-info span { font-size: 0.85rem; color: var(--text-secondary); }
.qty-controls { display: flex; align-items: center; gap: 0.4rem; }
.qty-controls button {
  width: 32px; height: 32px; background: #f0f0f0; border: none; border-radius: 6px;
  cursor: pointer; font-weight: bold; font-size: 1rem; transition: background 0.2s; color: var(--text);
}
.qty-controls button:hover { background: #ddd; }
.remove-btn { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 1.1rem; padding: 0.3rem; border-radius: 50%; transition: background 0.2s; }
.remove-btn:hover { background: #fdecea; }
.cart-summary { text-align: right; font-size: 1.2rem; font-weight: 700; margin: 1.25rem 0; }
.coupon-input { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.coupon-input input { flex: 1; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; }
.coupon-input button { background: var(--primary); color: white; border: none; border-radius: var(--radius-sm); padding: 0.6rem 1.25rem; font-weight: 600; cursor: pointer; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-secondary); }
.empty-state i { font-size: 4rem; margin-bottom: 1rem; display: block; }

/* FORMS & CARDS */
.card { background: var(--white); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-weight: 600; font-size: 0.9rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 0.75rem 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.95rem; background: var(--white); color: var(--text); transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(246,139,30,0.1); outline: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--primary); color: white; border: none;
  padding: 0.75rem 1.5rem; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer;
  font-size: 0.95rem; transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 2px 4px rgba(246,139,30,0.2);
}
.btn:hover { background: var(--primary-dark); box-shadow: 0 4px 8px rgba(246,139,30,0.3); }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); box-shadow: none; }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--danger); box-shadow: 0 2px 4px rgba(231,76,60,0.2); }
.btn-danger:hover { background: #c0392b; }
button.danger { background: var(--danger); color: white; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

/* OTP */
.otp-boxes { display: flex; justify-content: center; gap: 0.5rem; margin: 1.5rem 0; }
.otp-boxes input {
  width: 44px; height: 52px; text-align: center; font-size: 1.5rem; font-weight: 600;
  border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--white);
  color: var(--text); transition: border-color 0.2s, box-shadow 0.2s;
}
.otp-boxes input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(246,139,30,0.15); outline: none; }

/* STATUS BADGES */
.status-badge {
  display: inline-block; padding: 0.25rem 0.75rem; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.2px;
}
.pending, .awaiting_otp { background: #fff3cd; color: #856404; }
.approved, .processing { background: #fff3e0; color: #e65100; }
.paid, .completed, .delivered { background: #d4edda; color: #155724; }

/* TIMELINE */
.timeline { display: flex; justify-content: space-between; margin: 1.5rem 0; position: relative; }
.timeline::before { content: ''; position: absolute; top: 17px; left: 0; right: 0; height: 2px; background: var(--border); z-index: 0; }
.timeline-step { display: flex; flex-direction: column; align-items: center; z-index: 1; position: relative; }
.timeline-step .circle {
  width: 34px; height: 34px; border-radius: 50%; background: var(--white);
  border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 0.9rem; margin-bottom: 0.3rem; color: var(--text-secondary);
}
.timeline-step.active .circle { background: var(--primary); border-color: var(--primary); color: white; }
.timeline-step span { font-size: 0.75rem; color: var(--text-secondary); }
.timeline-step.active span { color: var(--primary); font-weight: 600; }

/* ORDERS */
.filter-tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; overflow-x: auto; }
.filter-tabs span {
  padding: 0.4rem 1.25rem; border-radius: 20px; background: var(--white);
  border: 1px solid var(--border); cursor: pointer; font-size: 0.8rem; font-weight: 500;
  white-space: nowrap; transition: all 0.2s;
}
.filter-tabs span.active { background: var(--primary); color: white; border-color: var(--primary); }
.order-card {
  background: var(--white); border-radius: var(--radius); padding: 1rem 1.25rem;
  margin-bottom: 0.75rem; box-shadow: var(--shadow-sm); cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  transition: box-shadow 0.2s, transform 0.2s;
}
.order-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* PROFILE */
.profile-header { text-align: center; padding: 2rem 1rem 1.5rem; }
.avatar {
  width: 90px; height: 90px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #f7a64a);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; font-weight: 600; margin: 0 auto 0.75rem;
  box-shadow: 0 4px 12px rgba(246,139,30,0.3);
}
.profile-header h3 { font-size: 1.2rem; margin-bottom: 0.2rem; }
.profile-header p { color: var(--text-secondary); font-size: 0.9rem; }

/* ACCORDION */
details.card { cursor: pointer; }
details.card summary { list-style: none; display: flex; justify-content: space-between; align-items: center; font-weight: 600; padding: 0.5rem 0; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: '\f107'; font-family: 'Font Awesome 6 Free'; font-weight: 900; transition: transform 0.2s; }
details.card[open] summary::after { transform: rotate(180deg); }

/* WALLET */
.wallet-card {
  background: linear-gradient(135deg, var(--primary), #f7a64a);
  color: white; border-radius: var(--radius); padding: 2rem; text-align: center; margin-bottom: 1rem;
  box-shadow: 0 8px 20px rgba(246,139,30,0.25);
}
.wallet-card h2 { font-size: 1rem; opacity: 0.9; margin-bottom: 0.5rem; }
.wallet-card h1 { font-size: 2.5rem; font-weight: 700; }
#walletAmount { font-size: 2.2rem; font-weight: 700; }

/* TRANSACTION ITEMS */
.tx-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.tx-item:hover { background: var(--light-gray); }
.tx-item small { color: var(--text-secondary); font-size: 0.75rem; }

/* AMOUNT OPTIONS */
.amount-options { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.amount-options button {
  flex: 1; min-width: 70px; padding: 0.6rem; background: var(--white);
  border: 1px solid var(--primary); border-radius: 8px; color: var(--primary);
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.amount-options button:hover { background: var(--primary); color: white; }

/* NOTIFICATIONS */
.notif-item { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.2s; }
.notif-item.unread { background: #fff9f0; font-weight: 500; border-left: 3px solid var(--primary); }
.notif-item:hover { background: #fcfcfc; }

/* RECENT SEARCHES */
.recent-searches { margin: 0.5rem 0 1rem; }
.recent-searches h4 { font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--text-secondary); }
.recent-searches span {
  display: inline-block; background: var(--white); padding: 0.2rem 0.7rem; border-radius: 15px;
  border: 1px solid var(--border); margin: 0.2rem; font-size: 0.8rem; cursor: pointer;
}
.recent-searches button { background: none; border: none; color: var(--primary); font-size: 0.8rem; cursor: pointer; }

/* AUTH */
.auth-tabs { display: flex; justify-content: center; margin-bottom: 1.5rem; }
.auth-tab { padding: 0.5rem 1.5rem; cursor: pointer; font-weight: 600; color: var(--text-secondary); border-bottom: 3px solid transparent; transition: all 0.2s; }
.auth-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.auth-form { background: var(--white); padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.auth-form input { width: 100%; padding: 0.8rem 0.9rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.95rem; }
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(246,139,30,0.1); outline: none; }
.auth-form.hidden { display: none; }
#passwordStrength { font-size: 0.8rem; margin-bottom: 0.5rem; }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottom-nav-height);
  background: var(--white); display: flex; justify-content: space-around;
  align-items: center; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 99;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  text-decoration: none; color: var(--text-secondary); font-size: 0.7rem;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0.5rem 0; transition: color 0.2s;
  flex: 1; text-align: center;
}
.bottom-nav a i { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--primary); font-weight: 600; }

/* TOAST */
.toast {
  position: fixed; top: 70px; right: 16px; z-index: 9999;
  background: #333; color: white; padding: 0.8rem 1.2rem; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2); animation: slideIn 0.3s ease;
  max-width: calc(100% - 32px); font-size: 0.9rem; backdrop-filter: blur(10px);
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: #333; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* COOKIE BANNER */
.cookie-banner {
  position: fixed; bottom: var(--bottom-nav-height); left: 0; right: 0;
  background: rgba(0,0,0,0.85); color: white; backdrop-filter: blur(10px);
  padding: 1rem; text-align: center; z-index: 98; display: flex;
  justify-content: center; align-items: center; gap: 1rem; font-size: 0.9rem;
}
.cookie-banner button { background: var(--primary); color: white; border: none; padding: 0.5rem 1.25rem; border-radius: 20px; font-weight: 600; cursor: pointer; }
.cookie-banner.hidden { display: none; }

/* SPLASH */
#splash {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--primary), #f7a64a);
  display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9999;
  transition: opacity 0.5s;
}
#splash.hidden { opacity: 0; pointer-events: none; }
#splash img { width: 130px; margin-bottom: 1rem; }
#splash h2 { color: white; font-size: 1.5rem; opacity: 0.9; }

/* LIGHTBOX */
.lightbox {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.9); display: flex; align-items: center; justify-content: center;
  z-index: 999; flex-direction: column;
}
.lightbox img { max-width: 90%; max-height: 80%; border-radius: var(--radius); }
.lightbox span { position: absolute; top: 20px; right: 30px; font-size: 2rem; color: white; cursor: pointer; }

/* MODAL */
.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-content {
  background: var(--white); border-radius: var(--radius); padding: 2rem;
  width: 90%; max-width: 400px; box-shadow: var(--shadow-lg);
  position: relative;
}
.modal-content span { position: absolute; top: 10px; right: 15px; font-size: 1.5rem; cursor: pointer; color: var(--text-secondary); }

/* SKELETON */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--light-gray) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  height: 20px; margin: 0.5rem 0;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* UTILITIES */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.font-bold { font-weight: 700; }