/* ============================================
   RIZQIM - PROFESSIONAL CUSTOM STYLES
   ============================================ */

/* ===== ROOT VARIABLES ===== */
:root {
  /* Colors */
  --primary-color: #ff6b6b;
  --primary-dark: #ee5a52;
  --primary-light: #ff8787;
  --secondary-color: #4ecdc4;
  --success-color: #51cf66;
  --warning-color: #ffd43b;
  --danger-color: #ff6b6b;
  --info-color: #339af0;
  
  /* Neutrals */
  --white: #ffffff;
  --black: #1a1a1a;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #868e96;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ===== GLOBAL ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 300px;
  pointer-events: none;
}

/* Override Bootstrap 5: .toast:not(.show){opacity:0} conflicts with our custom toasts */
.toast-container .toast,
.toast-container .toast:not(.showing):not(.show) {
  opacity: 1 !important;
  display: flex !important;
  pointer-events: auto;
}

.toast {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 10px 14px;
  display: flex !important;
  align-items: center;
  gap: 8px;
  animation: slideInRight var(--transition-base) both;
  border-left: 3px solid var(--primary-color);
  min-width: 240px;
  opacity: 1 !important;
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast.error {
  border-left-color: var(--danger-color);
}

.toast.warning {
  border-left-color: var(--warning-color);
}

.toast.info {
  border-left-color: var(--info-color);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  color: var(--success-color);
}

.toast.error .toast-icon {
  color: var(--danger-color);
}

.toast.warning .toast-icon {
  color: var(--warning-color);
}

.toast.info .toast-icon {
  color: var(--info-color);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--gray-900);
  margin: 0 0 2px 0;
}

.toast-message {
  font-size: 11px;
  color: var(--gray-600);
  margin: 0;
}

.toast-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--gray-500);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--gray-700);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width var(--transition-slow), height var(--transition-slow);
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--primary-color);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--secondary-color);
  color: var(--white);
}

.btn-secondary:hover {
  background: #3db9b0;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-success {
  background: var(--success-color);
  color: var(--white);
}

.btn-success:hover {
  background: #40c057;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: var(--white);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  color: var(--gray-900);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.badge-success {
  background: #d3f9d8;
  color: #2b8a3e;
}

.badge-warning {
  background: #fff3bf;
  color: #e67700;
}

.badge-danger {
  background: #ffe3e3;
  color: #c92a2a;
}

.badge-info {
  background: #d0ebff;
  color: #1864ab;
}

/* ===== FORMS ===== */
.form-control {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  background: var(--white);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

.form-control:hover {
  border-color: var(--gray-400);
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-700);
}

.form-group {
  margin-bottom: 20px;
}

/* ===== LOADING SPINNER ===== */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== PRODUCT CARD ENHANCEMENTS ===== */
.product-card {
  animation: fadeIn var(--transition-base);
  animation-fill-mode: both;
}

.product-card:nth-child(1) { animation-delay: 0.05s; }
.product-card:nth-child(2) { animation-delay: 0.1s; }
.product-card:nth-child(3) { animation-delay: 0.15s; }
.product-card:nth-child(4) { animation-delay: 0.2s; }
.product-card:nth-child(5) { animation-delay: 0.25s; }
.product-card:nth-child(6) { animation-delay: 0.3s; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .toast {
    min-width: auto;
  }
}


/* ===== PRODUCT NOTIFICATION (POPUP) ===== */
.product-notification {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 380px;
  z-index: 9998;
  opacity: 0;
  transform: translateX(-100%);
  transition: all var(--transition-slow);
}

.product-notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.notification-close:hover {
  color: var(--gray-700);
}

.notification-image {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.notification-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.notification-content {
  flex: 1;
  padding-right: 20px;
}

.notification-message {
  font-size: 12px;
  color: var(--gray-600);
  margin: 0 0 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.notification-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.notification-meta {
  font-size: 12px;
  color: var(--gray-500);
  margin: 0;
}

.notification-meta time {
  font-weight: 600;
  color: var(--primary-color);
}

/* ===== IMPROVED BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--white);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::after {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
}

.btn-primary:active {
  transform: translateY(-1px);
}

/* ===== PRODUCT CARDS HOVER ===== */
.showcase {
  transition: all var(--transition-base);
}

.showcase:hover {
  transform: translateY(-8px);
}

.showcase-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.showcase-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.1) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 1;
}

.showcase:hover .showcase-banner::before {
  opacity: 1;
}

/* ===== SMOOTH SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  .product-notification {
    left: 10px;
    right: 10px;
    max-width: none;
    bottom: 80px;
  }
}

/* ===================================================
   PROFESSIONAL MOBILE DESIGN IMPROVEMENTS
   =================================================== */

/* ---- MOBILE HEADER IMPROVEMENTS ---- */
@media (max-width: 900px) {
  /* Safe area for bottom nav */
  .mobile-bottom-navigation {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  /* Toast on mobile: show above bottom nav */
  .toast-container {
    top: auto;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
    max-width: none;
    align-items: stretch;
  }

  .toast {
    min-width: unset;
    width: 100%;
  }

  /* Better header on mobile */
  .header-main .container {
    gap: 12px;
    padding: 12px 16px;
  }

  /* Search bar mobile */
  .search-field {
    font-size: 14px !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
  }

  /* Header logo */
  .header-logo h2 {
    font-size: 24px !important;
  }

  /* Header action buttons */
  .header-user-actions .action-btn {
    width: 40px;
    height: 40px;
  }
}

/* ---- PRODUCT CARDS MOBILE ---- */
@media (max-width: 640px) {
  .showcase-container {
    padding: 8px !important;
  }

  .showcase {
    border-radius: 12px !important;
  }

  .showcase-content {
    padding: 10px !important;
  }

  .showcase-title a {
    font-size: 13px !important;
  }

  .price-box .price {
    font-size: 14px !important;
  }
}

/* ---- CART PAGE MOBILE ---- */
@media (max-width: 640px) {
  .cart-container {
    padding: 12px 0 16px !important;
  }

  .cart-content {
    gap: 16px !important;
  }

  .cart-table tr td {
    padding: 8px !important;
  }

  .cart-img img {
    width: 64px !important;
    height: 64px !important;
  }
}

/* ---- ORDER STATUS BADGES MOBILE ---- */
.status-in_transit,
.status-picked_up {
  background: #ede9fe;
  color: #5b21b6;
}
.status-in_transit .status-dot,
.status-picked_up .status-dot {
  background: #8b5cf6;
}
.status-assigned {
  background: #fef3c7;
  color: #78350f;
}
.status-assigned .status-dot {
  background: #f59e0b;
}
.status-ready {
  background: #e0f2fe;
  color: #0c4a6e;
}
.status-ready .status-dot {
  background: #0ea5e9;
}

/* ---- MOBILE FORM IMPROVEMENTS ---- */
@media (max-width: 640px) {
  /* Prevent zoom on input focus on iOS */
  input[type="text"],
  input[type="tel"],
  input[type="email"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Better tap targets */
  .btn-action,
  .mob-nav-item,
  .status-tab {
    min-height: 44px;
  }
}

/* ---- TOAST POSITION ON MOBILE ---- */
@media (max-width: 640px) {
  #toast-container {
    top: auto !important;
    bottom: 76px !important;
    left: 12px !important;
    right: 12px !important;
    max-width: none !important;
  }
}

/* ---- BETTER SCROLLING ---- */
html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ---- SECTION HEADERS MOBILE ---- */
@media (max-width: 640px) {
  .product-container .container-title {
    font-size: 20px !important;
  }
}

/* ---- MOBILE CHECKOUT IMPROVEMENTS ---- */
@media (max-width: 640px) {
  .checkout-page {
    padding: 16px 0 80px !important;
  }

  .form-card,
  .summary-card {
    border-radius: 12px !important;
    padding: 16px !important;
  }
}

/* ---- PROFILE PAGE MOBILE ---- */
@media (max-width: 640px) {
  .profile-container {
    padding: 16px 0 80px;
  }

  .profile-content {
    flex-direction: column !important;
  }

  .profile-sidebar {
    width: 100% !important;
  }
}

/* ---- CATEGORY ICONS MOBILE ---- */
@media (max-width: 640px) {
  .category-item-title {
    font-size: 11px !important;
  }
}

/* ---- MOBILE ACTIVE STATES ---- */
@media (hover: none) {
  .showcase:hover,
  .order-card:hover {
    transform: none !important;
  }
}

/* ================================================================
   MOBILE PRODUCT CARD — always show action buttons (touch screens)
================================================================ */
@media (hover: none), (max-width: 900px) {
  /* Show action buttons always (no hover needed) */
  .product-grid .showcase-actions {
    transform: translateX(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* Make buttons smaller and tighter on mobile */
  .product-grid .btn-action {
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
    font-size: 16px !important;
  }
}

/* ================================================================
   WISHLIST BUTTON — correct active state (filled red heart)
================================================================ */
/* Override style-prefix: red bg + white icon → white bg + red icon */
.product-grid .btn-action.wishlist-btn.active {
  background: #fff !important;
  color: #ef4444 !important;
  border-color: #ef4444 !important;
}

/* Inactive: light gray */
.product-grid .btn-action.wishlist-btn:not(.active) {
  background: #fff;
  color: #6b7280;
  border-color: #e5e7eb;
}

/* Hover state on non-touch */
@media (hover: hover) {
  .product-grid .btn-action.wishlist-btn:not(.active):hover {
    color: #ef4444;
    border-color: #fca5a5;
    background: #fff5f5;
  }
}

/* ---- SAFE AREA HANDLING ---- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

/* ---- BETTER LOADING STATES ---- */
.btn:disabled,
button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
}

/* ---- SKELETON LOADING ANIMATION ---- */
@keyframes skeleton {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: 8px;
}

/* ---- SEARCH RESULTS MOBILE ---- */
@media (max-width: 640px) {
  .search-results-dropdown {
    max-height: 280px !important;
    border-radius: 0 0 16px 16px !important;
  }

  .search-result-item {
    padding: 10px 12px !important;
  }

  .search-result-image {
    width: 44px !important;
    height: 44px !important;
  }
}

/* ---- FOOTER: HIDE COMPLETELY ON MOBILE ---- */
@media (max-width: 767px) {
  footer {
    display: none !important;
  }
}

/* ================================================================
   WISHLIST HEART BUTTON GLOBAL FIX
   White background, red filled heart when active — everywhere
   ================================================================ */

/* In product GRID cards — default gray, active red icon */
.product-grid .btn-action.wishlist-btn,
.product-grid .showcase-actions .btn-action.wishlist-btn {
  background: rgba(255,255,255,0.92) !important;
  color: #9ca3af !important;
  border: none !important;
}

.product-grid .btn-action.wishlist-btn.active,
.product-grid .showcase-actions .btn-action.wishlist-btn.active {
  background: rgba(255,255,255,0.97) !important;
  color: #ef4444 !important;
  border: none !important;
  box-shadow: 0 0 0 2px rgba(239,68,68,0.25) !important;
}

/* Hover state on non-touch devices */
@media (hover: hover) {
  .product-grid .btn-action.wishlist-btn:hover {
    background: rgba(255,255,255,0.97) !important;
    color: #ef4444 !important;
    border: none !important;
  }
}

/* ================================================================
   FREE DELIVERY BANNER (mobile-only, defined in list.html HTML)
   ================================================================ */
.mob-delivery-banner {
  display: none;
}

@media (max-width: 767px) {
  .mob-delivery-banner {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border-top: 1px solid #fed7aa;
    border-bottom: 1px solid #fed7aa;
    padding: 10px 16px;
    font-size: 12.5px;
    color: #c2410c;
    font-weight: 600;
    text-align: center;
    line-height: 1.4;
  }

  .mob-delivery-banner i {
    font-size: 18px;
    color: #ea580c;
    flex-shrink: 0;
  }
}

/* ================================================================
   PRODUCT DETAIL PAGE — MOBILE
   ================================================================ */
@media (max-width: 767px) {
  .product-page {
    padding: 12px 0 90px !important;
  }

  .product-page .container {
    padding: 0 12px !important;
    max-width: 100% !important;
  }

  .breadcrumb {
    margin-bottom: 14px !important;
    font-size: 12px !important;
    gap: 4px !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
  }

  /* Stack image + info vertically */
  .product-page .product-main {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    margin-bottom: 24px !important;
  }

  .product-gallery {
    position: static !important;
    top: auto !important;
    width: 100% !important;
    margin-bottom: 16px !important;
  }

  .main-image-wrapper {
    max-width: 100% !important;
    border-radius: 12px !important;
    margin-bottom: 10px !important;
  }

  .image-nav-arrow {
    opacity: 1 !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 16px !important;
  }

  .thumbnail-gallery {
    max-width: 100% !important;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)) !important;
    gap: 8px !important;
  }

  .product-details {
    gap: 16px !important;
  }

  .product-name {
    font-size: 20px !important;
    line-height: 1.3 !important;
    margin: 0 !important;
  }

  .price-main {
    font-size: 26px !important;
    color: #ff5252 !important;
  }

  .price-old {
    font-size: 16px !important;
  }

  .price-discount {
    font-size: 12px !important;
    padding: 4px 10px !important;
  }

  .action-buttons {
    flex-direction: column !important;
    gap: 10px !important;
  }

  .btn-add-cart {
    width: 100% !important;
    padding: 14px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
  }

  .btn-wishlist {
    width: 100% !important;
    height: 48px !important;
    border-radius: 12px !important;
    font-size: 20px !important;
  }

  /* Tabs */
  .product-tabs-section {
    margin-bottom: 24px !important;
  }

  .tabs-header {
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0 !important;
  }

  .tabs-header::-webkit-scrollbar { display: none !important; }

  .tab-button {
    flex-shrink: 0 !important;
    padding: 12px 20px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
  }

  /* Related products - horizontal scroll */
  .related-products-section {
    margin-bottom: 24px !important;
  }

  .related-products-section .products-grid,
  .related-products-section .product-grid {
    display: flex !important;
    overflow-x: auto !important;
    gap: 12px !important;
    padding-bottom: 8px !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    width: auto !important;
  }

  .related-products-section .products-grid::-webkit-scrollbar { display: none !important; }

  .related-products-section .product-card,
  .related-products-section .showcase {
    flex: 0 0 150px !important;
    min-width: 150px !important;
  }
}

/* ================================================================
   CART PAGE — MOBILE
   ================================================================ */
@media (max-width: 767px) {
  .cart-container {
    padding: 16px 0 90px !important;
    background: #f5f5f5 !important;
    min-height: 100vh !important;
  }

  .cart-container .container {
    padding: 0 12px !important;
    max-width: 100% !important;
  }

  .cart-container .page-title {
    font-size: 20px !important;
    margin-bottom: 16px !important;
  }

  .cart-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .cart-items {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .cart-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px !important;
    background: #fff !important;
    border-radius: 14px !important;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06) !important;
    position: relative !important;
  }

  .item-image {
    flex-shrink: 0 !important;
    width: 72px !important;
    height: 72px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #f8f8f8 !important;
  }

  .item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .item-details {
    flex: 1 !important;
    min-width: 0 !important;
  }

  .item-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    margin-bottom: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .item-category {
    font-size: 11px !important;
    color: #ff5252 !important;
    margin-bottom: 4px !important;
  }

  .item-price {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #ff5252 !important;
    margin: 0 !important;
  }

  .item-controls {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 6px !important;
  }

  .item-total .total-price {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
  }

  .item-actions {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
  }

  .remove-btn {
    background: #fff0f0 !important;
    color: #ef4444 !important;
    border: none !important;
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    cursor: pointer !important;
  }

  .cart-summary {
    width: 100% !important;
  }

  .summary-card {
    background: #fff !important;
    border-radius: 16px !important;
    padding: 20px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
  }

  .summary-card h3 {
    font-size: 17px !important;
    font-weight: 700 !important;
    margin-bottom: 16px !important;
  }

  .summary-row {
    display: flex !important;
    justify-content: space-between !important;
    padding: 8px 0 !important;
    font-size: 14px !important;
    border-bottom: 1px solid #f0f0f0 !important;
  }

  .summary-row.total {
    font-size: 16px !important;
    font-weight: 700 !important;
    border-bottom: none !important;
    padding-top: 12px !important;
  }

  .checkout-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 14px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    border-radius: 12px !important;
    margin-top: 16px !important;
    text-decoration: none !important;
    text-align: center !important;
  }

  .continue-shopping {
    display: block !important;
    text-align: center !important;
    margin-top: 12px !important;
    font-size: 13px !important;
    color: #6b7280 !important;
  }

  .empty-cart {
    text-align: center !important;
    padding: 60px 20px !important;
  }

  .empty-icon {
    font-size: 64px !important;
    color: #d1d5db !important;
  }
}

/* ================================================================
   PROFILE PAGE — MOBILE
   ================================================================ */
@media (max-width: 767px) {
  .profile-container {
    padding: 16px 0 90px !important;
    background: #f5f5f5 !important;
  }

  .profile-container .container {
    padding: 0 12px !important;
    max-width: 100% !important;
  }

  .profile-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 16px !important;
  }

  .profile-header h1 {
    font-size: 20px !important;
  }

  .profile-content {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .profile-sidebar {
    width: 100% !important;
  }

  .profile-card {
    background: #fff !important;
    border-radius: 16px !important;
    padding: 20px !important;
    text-align: center !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
    margin-bottom: 12px !important;
  }

  .profile-avatar {
    width: 72px !important;
    height: 72px !important;
    margin: 0 auto 12px !important;
    font-size: 28px !important;
    border-radius: 50% !important;
    background: #ff5252 !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .profile-stats {
    display: flex !important;
    justify-content: center !important;
    gap: 32px !important;
    margin-top: 12px !important;
  }

  .profile-menu {
    background: #fff !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
  }

  .menu-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 14px 16px !important;
    font-size: 14px !important;
    border-bottom: 1px solid #f0f0f0 !important;
    text-decoration: none !important;
    color: #374151 !important;
  }

  .menu-item:last-child { border-bottom: none !important; }

  .menu-item.active {
    color: #ff5252 !important;
    background: #fff5f5 !important;
  }

  .profile-main {
    width: 100% !important;
  }
}

/* ================================================================
   MY ORDERS PAGE — MOBILE
   ================================================================ */
@media (max-width: 767px) {
  .my-orders-page {
    padding-bottom: 90px !important;
  }

  .my-orders-page .container {
    padding: 0 12px !important;
    max-width: 100% !important;
  }

  .page-header {
    margin-bottom: 16px !important;
  }

  .header-content {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 10px !important;
  }

  .page-title {
    font-size: 18px !important;
    margin: 0 !important;
  }

  .page-subtitle {
    font-size: 12px !important;
    color: #6b7280 !important;
    margin: 0 !important;
  }

  /* Status filter — horizontal scroll */
  .status-filter {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 8px !important;
    padding: 0 0 10px !important;
    margin-bottom: 16px !important;
    flex-wrap: nowrap !important;
  }

  .status-filter::-webkit-scrollbar { display: none !important; }

  .status-tab {
    flex-shrink: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    min-width: auto !important;
    background: #fff !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
    text-decoration: none !important;
    color: #555 !important;
  }

  .status-tab.active {
    background: #ff5252 !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(255,82,82,0.3) !important;
  }

  .tab-icon {
    font-size: 16px !important;
    width: auto !important;
    height: auto !important;
    background: none !important;
    border-radius: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .status-tab .tab-count {
    background: rgba(0,0,0,0.1) !important;
    border-radius: 20px !important;
    padding: 1px 6px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
  }

  .orders-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .order-card {
    background: #fff !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    border: 1px solid #f0f0f0 !important;
  }

  .order-card-header {
    padding: 14px 16px !important;
    border-bottom: 1px solid #f5f5f5 !important;
  }

  .header-stats .stat-item {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    align-items: baseline !important;
  }
}

/* ================================================================
   WISHLIST PAGE — MOBILE
   ================================================================ */
@media (max-width: 767px) {
  .wishlist-container {
    padding: 16px 0 16px !important;
    background: #f5f5f5 !important;
    min-height: auto !important;
  }

  .wishlist-container .container {
    padding: 0 12px !important;
    max-width: 100% !important;
  }

  .wishlist-container .page-title {
    font-size: 20px !important;
    text-align: left !important;
    margin-bottom: 16px !important;
  }

  .wishlist-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .wishlist-item {
    background: #fff !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .wishlist-item .item-image {
    width: 100% !important;
    height: 0 !important;
    padding-top: 100% !important;
    position: relative !important;
    overflow: hidden !important;
    background: #f8f8f8 !important;
  }

  .wishlist-item .item-image a {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
  }

  .wishlist-item .item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .remove-wishlist-btn {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,0.9) !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    color: #ef4444 !important;
    cursor: pointer !important;
    z-index: 2 !important;
  }

  .wishlist-item .item-details {
    padding: 8px 10px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
  }

  .wishlist-item .item-name {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #1a1a1a !important;
    margin-bottom: 2px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  .wishlist-item .item-category {
    font-size: 10px !important;
    color: #ff5252 !important;
    margin-bottom: 4px !important;
  }

  .wishlist-item .current-price {
    font-size: 14px !important;
    font-weight: 800 !important;
    color: #ff5252 !important;
    display: block !important;
  }

  .wishlist-item .old-price {
    font-size: 10px !important;
    color: #aaa !important;
    text-decoration: line-through !important;
    display: block !important;
  }

  .wishlist-item .item-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    margin-top: 8px !important;
  }

  .add-to-cart-btn {
    width: 100% !important;
    background: #ff5252 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 7px 8px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
  }

  .view-product-btn {
    display: none !important;
  }

  .empty-wishlist {
    text-align: center !important;
    padding: 60px 20px !important;
    grid-column: 1 / -1 !important;
  }
}

/* ================================================================
   CHECKOUT PAGE — MOBILE
   ================================================================ */
@media (max-width: 767px) {
  .checkout-page {
    padding: 16px 0 16px !important;
  }

  .checkout-page .container {
    padding: 0 12px !important;
    max-width: 100% !important;
  }

  .checkout-page-title {
    font-size: 18px !important;
    margin-bottom: 16px !important;
  }

  .checkout-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }

  .form-card {
    border-radius: 16px !important;
    padding: 16px !important;
  }

  .autofill-banner {
    padding: 10px 12px !important;
  }

  .autofill-btn {
    padding: 6px 10px !important;
    font-size: 11px !important;
  }
}

/* ================================================================
   PAGE PADDING (all pages need bottom padding for mobile nav)
   ================================================================ */
@media (max-width: 767px) {
  /* Any page content div */
  .page-content,
  .main-content {
    padding-bottom: 90px !important;
  }
}

/* ================================================================
   FIX: Remove forced min-heights on mobile to prevent blank scroll space.
   Content should determine page height — body already handles bottom-nav offset.
   ================================================================ */
@media (max-width: 767px) {
  .cart-container,
  .wishlist-container,
  .my-orders-page,
  .order-done-page,
  .checkout-page,
  .profile-container {
    min-height: auto !important;
  }

  /* order-done-page has 80px inline padding-bottom — body already adds 64px,
     so 80+64=144px gap. Reduce to just enough for the bottom nav. */
  .order-done-page {
    padding-bottom: 20px !important;
  }
}

/* ================================================================
   EMPTY STATE VERTICAL CENTERING (cart, wishlist, my-orders)
   JS in base.html measures the real header and sets --header-h.
   We subtract that + bottom-nav (68px) so the page fits exactly one screen.
   ================================================================ */
:root { --header-h: 88px; } /* safe fallback; overridden by JS */

@media (max-width: 900px) {
  /* ── outer wrappers: no extra padding ── */
  .cart-container {
    padding: 0 !important;
  }
  .wishlist-container {
    padding: 0 !important;
  }

  /* ── hide the page title when showing an empty state ── */
  .cart-container .container:has(.empty-cart) .page-title,
  .wishlist-container .container:has(.empty-wishlist) .page-title {
    display: none !important;
  }

  /* ── strip container padding so empty state can fill the space ── */
  .cart-container .container:has(.empty-cart),
  .wishlist-container .container:has(.empty-wishlist) {
    padding: 0 !important;
    max-width: 100% !important;
  }

  /* ── the empty state itself: fill remaining height + center content ── */
  .empty-cart,
  .empty-wishlist {
    height: calc(100dvh - var(--header-h) - 68px);
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px !important;
    text-align: center;
    overflow: hidden;
  }

  /* ── compact card on mobile ── */
  .empty-cart-content,
  .empty-wishlist-content {
    padding: 2rem 1.5rem !important;
    max-width: 320px !important;
    width: 100% !important;
    border-radius: 20px !important;
  }

  /* ── smaller icon ── */
  .empty-cart .empty-icon,
  .empty-wishlist .empty-icon {
    font-size: 3rem !important;
    margin-bottom: 0.75rem !important;
  }

  /* ── smaller heading ── */
  .empty-cart h2,
  .empty-wishlist h2 {
    font-size: 1.25rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* ── smaller body text ── */
  .empty-cart p,
  .empty-wishlist p {
    font-size: 0.875rem !important;
    margin-bottom: 1.25rem !important;
    color: #6b7280 !important;
  }

  /* ── my-orders empty state ── */
  .empty-state {
    height: calc(100dvh - var(--header-h) - 68px - 120px); /* 120px for page header + chips */
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
  }
}
