/**
 * JoDeals Mobile Redesign - Tailwind Utilities & Custom Styles
 * Optimized for 430x932 mobile devices
 *
 * Design tokens are defined in mobile-design-system.css (loaded first).
 * This file uses those tokens via var() references throughout.
 */
/* stylelint-disable at-rule-no-unknown */
/* noinspection CssUnknownAtRule */
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  /* ── Legacy aliases for backward compatibility ──
     These map old token names to the canonical design system tokens.
     New code should use var(--ds-*) names directly. */
  --primary-color:      var(--ds-color-primary, #FF4D4D);
  --secondary-color:    var(--ds-color-secondary, #FF9F0A);
  --background-color:   var(--ds-color-bg, #F8F9FA);
  --card-background:    var(--ds-color-card, #FFFFFF);
  --text-primary:       var(--ds-color-text-primary, #222222);
  --text-secondary:     var(--ds-color-text-secondary, #777777);
  --font-arabic:        var(--ds-font-arabic, 'Cairo', 'Droid Arabic Naskh', 'Arial', sans-serif);
  --font-english:       var(--ds-font-english, 'Inter', 'Poppins', 'Arial', sans-serif);
}

body.mobile-theme-active {
  background-color: var(--background-color);
  color: var(--text-primary);
  @apply text-mobile-body font-normal;
  font-family: var(--font-english);
}
html[lang="ar"] body.mobile-theme-active, body.mobile-theme-active[dir="rtl"] {
  font-family: var(--font-arabic);
  line-height: 1.6;
  letter-spacing: 0.01em;
}

/* ========== MOBILE DEAL CARDS (PREMIUM MARKETPLACE STYLE) ========== */

.mobile-deal-card {
  background-color: var(--ds-color-card, #ffffff);
  border-radius: var(--ds-radius-card, 16px);
  overflow: hidden;
  box-shadow: var(--ds-shadow-card, 0 2px 8px rgba(0,0,0,0.08));
  border: 1px solid var(--ds-color-border-light, rgba(241, 245, 249, 0.8));
  transition: transform var(--ds-anim-fast, 150ms) var(--ds-ease-smooth, cubic-bezier(0.16, 1, 0.3, 1)),
              box-shadow var(--ds-anim-fast, 150ms) ease;
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
  margin-bottom: 0.25rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dark .mobile-deal-card {
  background-color: #0f172a;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border-color: rgba(30, 41, 59, 0.8);
}

.mobile-deal-card:active {
  transform: scale(0.975);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.mobile-deal-card-image-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: var(--ds-color-bg, #f8fafc);
  aspect-ratio: 1/1;
  border-top-left-radius: var(--ds-radius-card, 16px);
  border-top-right-radius: var(--ds-radius-card, 16px);
}
.dark .mobile-deal-card-image-wrapper {
  background-color: #1e293b;
}

.mobile-deal-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: fadeInImage 0.4s ease-in-out forwards;
  transition: transform 0.3s ease;
}

@keyframes fadeInImage {
  to { opacity: 1; }
}

/* Subtle zoom effect on tap/active */
.mobile-deal-card-image-wrapper:active .mobile-deal-card-image {
  transform: scale(1.04);
}

.mobile-deal-discount-badge {
  position: absolute;
  top: 0.75rem;
  inset-inline-start: 0.75rem;
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: var(--ds-radius-sm, 8px);
  background: linear-gradient(135deg, var(--ds-color-primary, #FF4D4D), #FF3B3B);
  color: #ffffff;
  font-size: var(--ds-text-badge, 12px);
  font-weight: var(--ds-fw-extrabold, 800);
  box-shadow: var(--ds-shadow-primary-glow, 0 4px 10px rgba(255,77,77,0.25));
  z-index: 10;
  pointer-events: none;
}

.mobile-deal-favorite-btn {
  position: absolute;
  top: 0.75rem;
  inset-inline-end: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--ds-radius-pill, 999px);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  transition: all var(--ds-anim-fast, 150ms) cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
  box-shadow: var(--ds-shadow-sm, 0 2px 8px rgba(0,0,0,0.08));
  border: 1px solid rgba(255, 255, 255, 0.8);
}
.dark .mobile-deal-favorite-btn {
  background-color: rgba(15, 23, 42, 0.9);
  color: #94a3b8;
  border-color: rgba(255, 255, 255, 0.05);
}

.mobile-deal-favorite-btn:active {
  transform: scale(0.85);
}

.mobile-deal-favorite-btn.favorited {
  color: var(--ds-color-primary, #FF4D4D);
  background-color: #ffffff;
}
.mobile-deal-favorite-btn.favorited i {
  animation: heartPop var(--ds-anim-fast, 150ms) ease;
}
@keyframes heartPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

.mobile-deal-card-content {
  display: flex;
  flex-direction: column;
  padding: 10px;
  flex: 1;
}

.mobile-deal-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  color: #222222;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
  min-height: 40px;
  letter-spacing: 0;
}
.dark .mobile-deal-card-title {
  color: #f1f5f9;
}

.mobile-deal-card-brand {
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  color: #777777;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}
.dark .mobile-deal-card-brand {
  color: #94a3b8;
}

.mobile-deal-card-price-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.mobile-deal-original-price {
  font-size: 13px;
  line-height: 18px;
  color: #999999;
  text-decoration: line-through;
  font-weight: 400;
}
.dark .mobile-deal-original-price {
  color: #64748b;
}

.mobile-deal-current-price {
  font-size:   var(--ds-text-price, clamp(18px, 5vw, 20px));
  font-weight: var(--ds-fw-bold, 700);
  line-height: var(--ds-lh-price, 24px);
  color:       var(--ds-color-text-price, #FF4D4D);
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.dark .mobile-deal-current-price {
  color: var(--ds-color-text-price, #FF6B6B);
}

.currency-label {
  font-size:   var(--ds-text-price-old, 13px);
  font-weight: var(--ds-fw-semibold, 600);
  color:       var(--ds-color-text-price, #FF4D4D);
}
.dark .currency-label {
  color: var(--ds-color-text-price, #FF6B6B);
}

/* Bottom Metadata (Countdown & Views) */
.mobile-deal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #f1f5f9;
  padding-top: 8px;
  margin-top: auto;
}
.dark .mobile-deal-card-footer {
  border-top-color: #1e293b;
}

.mobile-deal-card-countdown {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: #777777;
}
.dark .mobile-deal-card-countdown {
  color: #94a3b8;
}

.mobile-deal-card-countdown.expiring-soon {
  color: #ff9f0a;
  font-weight: 600;
}
.mobile-deal-card-countdown.urgent {
  color: #ff3b30;
  font-weight: 600;
}

.mobile-deal-card-views {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  color: #999999;
}
.dark .mobile-deal-card-views {
  color: #64748b;
}

/* Skeleton Loading styles */
.mobile-deal-card.skeleton {
  pointer-events: none;
  border-color: #f1f5f9;
  box-shadow: none;
}
.dark .mobile-deal-card.skeleton {
  border-color: #1e293b;
}

.skeleton-image {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
}

/* ========== MOBILE HEADER ========== */
.mobile-header-sticky {
  @apply sticky top-0 z-40 bg-white/95 dark:bg-slate-950/95 backdrop-blur-xl border-b border-slate-200/60 dark:border-slate-800/60 shadow-sm transition-all duration-200;
}

.mobile-header-top {
  @apply flex items-center justify-between gap-3 px-4 py-3 h-16;
}

.mobile-logo-btn {
  @apply flex-shrink-0 h-8 w-auto flex items-center;
}

.mobile-logo-btn img {
  @apply h-full w-auto;
}

.mobile-header-center {
  @apply flex-1 flex items-center justify-center;
}

.mobile-header-actions {
  @apply flex items-center gap-2.5;
}

.mobile-icon-btn {
  @apply w-10 h-10 rounded-full flex items-center justify-center text-slate-600 dark:text-slate-400 bg-slate-100/60 dark:bg-slate-800/60 border border-slate-200/60 dark:border-slate-700/50 hover:text-brand-500 active:scale-90 transition-all duration-200;
}

.mobile-icon-btn.active {
  @apply text-brand-500 bg-brand-50/60 dark:bg-brand-950/20 border-brand-200/60 dark:border-brand-900/40;
}

/* ========== MOBILE SEARCH BAR ========== */
.mobile-search-bar {
  @apply mx-4 mb-4 px-4 py-3.5 rounded-2xl bg-white dark:bg-slate-900 border-2 border-slate-200 dark:border-slate-800 flex items-center gap-3 text-slate-600 dark:text-slate-400 shadow-sm transition-all duration-200 touch-target-44;
}

.mobile-search-bar:focus-within {
  @apply border-brand-500 shadow-md dark:border-brand-600;
}

.mobile-search-bar input {
  @apply flex-1 bg-transparent border-none outline-none text-mobile-body font-medium placeholder-slate-400 dark:placeholder-slate-500 text-slate-900 dark:text-white;
}

.mobile-search-bar i {
  @apply text-mobile-body text-slate-400 dark:text-slate-500 transition-colors;
}

.mobile-search-bar:focus-within i {
  @apply text-brand-500 dark:text-brand-400;
}

/* ========== MOBILE HERO BANNER ========== */
.mobile-hero-banner {
  @apply relative overflow-hidden bg-gradient-to-br from-brand-500 via-brand-600 to-red-600 text-white px-4 py-6;
  min-height: 180px;
}

.mobile-hero-banner-content {
  @apply absolute inset-0 flex flex-col items-center justify-center text-center z-10 gap-3;
}

.mobile-hero-discount {
  @apply text-mobile-hero-large font-black drop-shadow-lg;
}

.mobile-hero-title {
  @apply text-mobile-hero font-black drop-shadow-md;
}

.mobile-hero-cta {
  @apply px-6 py-3 rounded-xl bg-white text-brand-500 font-black text-mobile-button shadow-lg active:scale-95 transition-all;
}

/* ========== MOBILE CATEGORY CARDS ========== */
.mobile-category-card {
  @apply flex flex-col items-center justify-center rounded-2xl overflow-hidden aspect-square bg-slate-100 dark:bg-slate-800 border border-slate-200/60 dark:border-slate-700/60 shadow-sm hover:shadow-card transition-all duration-300 active:scale-95;
}

.mobile-category-card-image {
  @apply w-full h-full object-cover transition-transform duration-500;
}

.mobile-category-card:hover .mobile-category-card-image {
  @apply scale-110;
}

.mobile-category-card-overlay {
  @apply absolute inset-0 bg-gradient-to-t from-black/50 via-black/20 to-transparent flex items-end justify-center pb-3 text-center;
}

.mobile-category-card-label {
  @apply text-white font-black text-mobile-body-secondary drop-shadow-md;
}

/* Premium Mobile Category Grid */
.premium-cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 10px;
  row-gap: 12px;
  padding: 10px var(--ds-space-3, 12px);
  overflow: hidden;
  transition: max-height var(--ds-anim-standard, 250ms) var(--ds-ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
  will-change: max-height;
}

.premium-cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 6px;
  border-radius: var(--ds-radius-card-sm, 12px);
  background-color: var(--ds-color-bg, #F8FAFC);
  border: 1px solid var(--ds-color-border-light, rgba(241, 245, 249, 0.8));
  transition: all var(--ds-anim-fast, 150ms) var(--ds-ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dark .premium-cat-card {
  background-color: rgba(30, 41, 59, 0.4);
  border-color: rgba(51, 65, 85, 0.4);
}

.premium-cat-card:active {
  transform: scale(0.94);
  background-color: #F1F5F9;
}

.dark .premium-cat-card:active {
  background-color: rgba(51, 65, 85, 0.6);
}

.premium-cat-icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background-color: #FFFFFF;
  border: 1px solid rgba(241, 245, 249, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  margin-bottom: 6px;
  transition: transform 0.2s ease;
  color: #ef4444; /* Brand red or secondary color */
}

.dark .premium-cat-icon-container {
  background-color: #0f172a;
  border-color: rgba(51, 65, 85, 0.5);
  color: #f87171;
}

.premium-cat-card:hover .premium-cat-icon-container {
  transform: scale(1.06);
}

.premium-cat-label {
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  color: #222222;
  text-align: center;
  width: 100%;
  padding: 0 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dark .premium-cat-label {
  color: #cbd5e1;
}

/* Expansion transition for late items */
.premium-cat-card.late-item {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

.premium-cat-grid.expanded .premium-cat-card.late-item {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}



/* ========== TOUCH TARGETS & ACCESSIBILITY ========== */
.touch-target-44 {
  @apply min-h-[44px] min-w-[44px] flex items-center justify-center;
}

/* Ensure all interactive elements meet touch target requirements */
button, a, [role="button"] {
  @apply transition-all duration-200;
}

/* Mobile-optimized touch targets with proper spacing */
.mobile-icon-btn {
  @apply w-12 h-12 md:w-10 md:h-10 rounded-full flex items-center justify-center transition-all duration-200 active:scale-90;
}

.mobile-deal-favorite-btn {
  @apply w-12 h-12 md:w-10 md:h-10 active:scale-90 transition-all;
}

.mobile-deal-card-cta {
  @apply py-3 px-4 min-h-[44px] active:scale-95 transition-all;
}

/* Button spacing for mobile */
.mobile-button-group {
  @apply flex gap-2 md:gap-3;
}

.mobile-button-group > button,
.mobile-button-group > a {
  @apply flex-1 min-h-[44px];
}

/* Form input accessibility */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  @apply min-h-[44px] text-base; /* Prevents zoom on iOS */
}

/* Focus states for keyboard navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  @apply outline-2 outline-offset-2 outline-brand-500;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  .mobile-deal-card {
    @apply border-2;
  }
  
  .mobile-deal-discount-badge {
    @apply border-2 border-white;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    @apply animation-none transition-none !important;
  }
}

/* Dark mode high contrast */
@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
  .mobile-deal-card {
    @apply border-slate-400;
  }
}

/* ========== SPACING & LAYOUT ========== */
.mobile-section-spacing {
  @apply py-4 px-4 md:py-6 md:px-6;
}

.mobile-section-gap {
  @apply gap-3 md:gap-4;
}

.mobile-card-grid {
  @apply grid grid-cols-2 md:grid-cols-3 gap-3 md:gap-4;
}

/* Mobile-specific padding for different sections */
.mobile-page-padding {
  @apply px-4 py-4 md:px-6 md:py-8;
}

.mobile-section-divider {
  @apply border-t border-slate-200 dark:border-slate-800 my-4 md:my-8;
}

/* Reduce spacing on hero banners for mobile */
@media (max-width: 430px) {
  .mobile-hero-banner {
    min-height: 180px !important;
    padding: 0.875rem !important;
  }
  
  .mobile-page-padding {
    @apply px-3 py-3;
  }
  
  .mobile-section-divider {
    @apply my-3;
  }
}

/* ========== TYPOGRAPHY MOBILE ========== */
.mobile-heading-1 {
  @apply text-mobile-h1 text-slate-900 dark:text-white;
}

.mobile-heading-2 {
  @apply text-mobile-h2 text-slate-900 dark:text-white;
}

.mobile-deal-title-text {
  @apply text-mobile-body font-bold text-slate-900 dark:text-white leading-tight;
}

.mobile-price-text {
  @apply text-mobile-price text-brand-500 dark:text-brand-400;
}

.mobile-discount-badge-text {
  @apply text-mobile-body font-bold text-white;
}

.mobile-body-text {
  @apply text-mobile-body text-slate-800 dark:text-slate-300;
}

.mobile-small-text {
  @apply text-mobile-body-secondary text-slate-600 dark:text-slate-400;
}

/* ========== SAFE AREA SUPPORT ========== */
.mobile-safe-area-top {
  @apply pt-[env(safe-area-inset-top)];
}

.mobile-safe-area-bottom {
  @apply pb-[calc(env(safe-area-inset-bottom,0px)+64px)];
}

/* ========== RTL/LTR BIDIRECTIONAL SUPPORT ========== */
/* Directional utilities for RTL languages */
[dir="rtl"] .mobile-deal-card-image-wrapper {
  @apply mr-0 ml-0;
}

[dir="rtl"] .mobile-deal-card-badge-container {
  @apply left-auto right-3;
}

[dir="rtl"] .mobile-deal-favorite-btn {
  @apply left-auto right-3;
}

[dir="rtl"] .mobile-search-bar {
  @apply direction-rtl;
}

[dir="rtl"] .mobile-header-actions {
  @apply flex-row-reverse;
}

[dir="rtl"] .mobile-deal-card-location {
  @apply flex-row-reverse;
}

[dir="rtl"] .mobile-deal-current-price {
  @apply text-right;
}

[dir="rtl"] .mobile-deal-card-prices {
  @apply flex-row-reverse;
}

[dir="rtl"] .mobile-deal-card-cta {
  @apply text-center justify-center;
}

[dir="rtl"] .mobile-bottom-nav-item {
  @apply flex-row-reverse;
}

/* LTR specific alignment */
[dir="ltr"] .mobile-deal-badge-container {
  @apply left-3 right-auto;
}

[dir="ltr"] .mobile-deal-favorite-btn {
  @apply right-3 left-auto;
}

[dir="ltr"] .mobile-header-actions {
  @apply flex-row;
}

[dir="ltr"] .mobile-deal-card-prices {
  @apply flex-row;
}

/* Font support for Arabic and English */
[dir="rtl"] {
  font-family: 'Cairo', 'Droid Arabic Naskh', 'Arial', sans-serif !important;
}

[dir="ltr"] {
  font-family: 'Inter', 'Poppins', 'Arial', sans-serif !important;
}

/* ========== RESPONSIVE ADJUSTMENTS ========== */
/* 360px Small Mobile (Samsung J2, older iPhones) */
@media (max-width: 360px) {
  .mobile-deal-card {
    @apply rounded-2xl;
  }
  
  .mobile-deal-card-content {
    @apply p-2 gap-1;
  }

  .mobile-deal-card-title {
    @apply text-mobile-body-small leading-snug min-h-[28px] mb-0.5;
  }
  
  .mobile-deal-current-price {
    @apply text-mobile-h2 font-black;
  }

  .mobile-deal-original-price {
    @apply text-mobile-nav;
  }
  
  .mobile-deal-discount-badge {
    @apply px-1 py-0.5 text-mobile-badge rounded-md gap-0.5;
  }

  .mobile-deal-favorite-btn {
    @apply w-6 h-6 text-mobile-nav;
  }

  .mobile-deal-card-location {
    @apply text-mobile-nav;
  }

  .mobile-deal-card-cta {
    @apply py-1 text-mobile-nav rounded-md;
  }

  .mobile-deal-card-image-wrapper {
    aspect-ratio: 1/1;
  }
  
  .mobile-hero-banner {
    min-height: 200px !important;
    @apply px-3 py-6;
  }
  
  .mobile-section-spacing {
    @apply px-3 py-4;
  }
  
  .touch-target-44 {
    @apply min-h-[42px] min-w-[42px];
  }
}

/* 390px Standard Mobile (iPhone 12, 13) */
@media (min-width: 361px) and (max-width: 430px) {
  .mobile-deal-card {
    @apply rounded-2xl;
  }
  
  .mobile-deal-card-content {
    @apply p-2.5 gap-1.5;
  }

  .mobile-deal-card-title {
    @apply text-mobile-body-secondary leading-snug min-h-[40px] mb-0.5;
  }

  .mobile-deal-current-price {
    @apply text-mobile-body font-black;
  }

  .mobile-deal-original-price {
    @apply text-mobile-nav;
  }

  .mobile-deal-discount-badge {
    @apply px-1.5 py-0.5 text-mobile-nav rounded-lg gap-0.5;
  }

  .mobile-deal-favorite-btn {
    @apply w-10 h-10 text-mobile-body-secondary;
  }

  .mobile-deal-card-location {
    @apply text-mobile-nav;
  }

  .mobile-deal-card-cta {
    @apply py-2 min-h-[44px] text-mobile-button rounded-lg;
  }

  .mobile-deal-card-image-wrapper {
    aspect-ratio: 1/1;
  }
  
  .mobile-hero-banner {
    min-height: 190px;
  }
}

/* 430px Large Mobile (iPhone 14, 15 Pro Max, Pixel 6) */
@media (min-width: 431px) and (max-width: 767px) {
  .mobile-hero-banner {
    min-height: 200px;
  }
  
  .mobile-deal-card-title {
    @apply text-base;
  }
}

/* Hide mobile-specific styles on tablets and up */
@media (min-width: 768px) {
  .md-hide-mobile {
    display: none;
  }
  
  .mobile-safe-area-bottom {
    @apply pb-0;
  }
}

/* Custom Template Helper Styles */
.active-pill {
  background-color: var(--ds-color-primary, #FF4D4D) !important;
  color: #ffffff !important;
  border-color: var(--ds-color-primary, #FF4D4D) !important;
}
.active-city {
  background-color: var(--ds-color-primary, #FF4D4D) !important;
  color: #ffffff !important;
  border-color: var(--ds-color-primary, #FF4D4D) !important;
}
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
/* ========== TAILWIND UTILITY FALLBACKS ========== */
/* Added to ensure layout works without Tailwind CDN */
.grid { display: grid !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.gap-3\.5 { gap: 0.875rem !important; }
.absolute { position: absolute !important; }
.top-2\.5 { top: 0.625rem !important; }
.right-2\.5 { right: 0.625rem !important; }
.left-2\.5 { left: 0.625rem !important; }
.z-10 { z-index: 10 !important; }
.pointer-events-none { pointer-events: none !important; }
.text-amber-500 { color: #f59e0b !important; }
.text-brand-500 { color: #ff3b30 !important; }
.text-\[10px\] { font-size: 10px !important; }

/* ========== MOBILE SEARCH HEADER & FILTERS ========== */
.mobile-active-deals-badge {
  @apply inline-flex items-center gap-1 bg-brand-50 text-brand-600 dark:bg-brand-900/30 dark:text-brand-400 px-2 py-0.5 rounded-full text-mobile-badge font-bold border border-brand-100 dark:border-brand-800/50;
}

.mobile-city-selector {
  @apply flex items-center gap-1.5 bg-slate-100 dark:bg-slate-800 px-3 py-1.5 rounded-full text-mobile-body-secondary font-semibold text-slate-700 dark:text-slate-300 active:scale-95 transition-all;
}

.mobile-quick-filters-container {
  @apply overflow-x-auto scrollbar-hide py-2 px-4 flex gap-2 w-full bg-white dark:bg-slate-950 border-b border-slate-100 dark:border-slate-800 shadow-sm sticky z-30 transition-all duration-300;
  top: var(--header-height, 64px); /* Adjust based on header height */
}

.mobile-filter-chip {
  @apply whitespace-nowrap px-3 py-1.5 rounded-full bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-300 text-mobile-body-secondary font-medium border border-slate-200 dark:border-slate-700 active:scale-95 transition-all flex items-center gap-1.5 flex-shrink-0;
}

.mobile-filter-chip.active {
  @apply bg-brand-50 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400 border-brand-200 dark:border-brand-800/50 font-bold shadow-sm;
}

/* ========== MOBILE CATEGORY CAROUSEL ========== */
.mobile-category-carousel-container {
  @apply overflow-x-auto scrollbar-hide py-4 px-4 flex gap-3;
}

.mobile-category-chip {
  @apply flex flex-col items-center justify-center gap-2 flex-shrink-0 w-[72px] active:scale-95 transition-all;
}

.mobile-category-chip-icon {
  @apply w-14 h-14 rounded-2xl bg-white dark:bg-slate-800 shadow-sm border border-slate-100 dark:border-slate-700 flex items-center justify-center text-slate-500 dark:text-slate-400 text-xl relative overflow-hidden;
}

.mobile-category-chip.active .mobile-category-chip-icon {
  @apply bg-brand-500 text-white border-brand-600 shadow-md shadow-brand-500/20;
}

.mobile-category-chip-label {
  @apply text-mobile-body-small font-semibold text-slate-600 dark:text-slate-300 text-center w-full truncate px-1;
}

/* ========== FLOATING PREMIUM BOTTOM NAVIGATION ========== */
.mobile-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--ds-height-bottom-nav, 60px);
  padding-left: 10px;
  padding-right: 10px;
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  width: calc(100% - 24px);
  border-radius: var(--ds-radius-bottom-nav, 20px);
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(241, 245, 249, 1);
  box-shadow: var(--ds-shadow-float, 0 4px 16px rgba(0,0,0,0.12));
  transition: transform var(--ds-transition-spring), box-shadow var(--ds-anim-spring, 500ms);
}
@media (min-width: 768px) {
  .mobile-bottom-nav { display: none; }
}
.dark .mobile-bottom-nav {
  background-color: rgba(2, 6, 23, 0.95);
  border-top-color: rgba(30, 41, 59, 0.8);
  box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
}

/* Added extra padding for the body to accommodate the floating nav */
body {
  padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

.mobile-bottom-nav-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  color: #94a3b8;
  position: relative;
  transition: all 0.3s;
  touch-action: none;
  z-index: 10;
  min-width: 48px;
}

/* Expanding Pill Container */
.mobile-bottom-nav-icon-wrapper {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  height: 40px;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 9999px;
  padding: 0;
}

.mobile-bottom-nav-item.active {
  flex-grow: 1.5;
}

.mobile-bottom-nav-item.active .mobile-bottom-nav-icon-wrapper {
  background-color: var(--ds-color-primary-light, rgba(255, 77, 77, 0.10));
  color:            var(--ds-color-primary, #FF4D4D);
  padding-left: 16px;
  padding-right: 16px;
  box-shadow:       var(--ds-shadow-primary-glow, 0 4px 12px rgba(255,77,77,0.20));
}
.dark .mobile-bottom-nav-item.active .mobile-bottom-nav-icon-wrapper {
  background-color: rgba(255, 77, 77, 0.15);
  color:            var(--ds-color-primary, #FF4D4D);
  box-shadow:       0 4px 12px rgba(255, 77, 77, 0.25);
}

.mobile-bottom-nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-bottom-nav-item.active .mobile-bottom-nav-icon {
  transform: scale(1.05);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* Hidden Label that Expands */
.mobile-bottom-nav-item .mobile-bottom-nav-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.01em;
  overflow: hidden;
  white-space: nowrap;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 0;
  opacity: 0;
  margin-left: 0;
}

.mobile-bottom-nav-item.active .mobile-bottom-nav-label {
  font-weight: 600;
  max-width: 100px;
  opacity: 1;
  margin-left: 6px;
}
[dir="rtl"] .mobile-bottom-nav-item.active .mobile-bottom-nav-label {
  margin-left: 0;
  margin-right: 6px;
}

.ease-spring {
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Mobile Loader Screen Styles */
@media (max-width: 768px) {
  #mobile-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #f8fafc;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s;
    opacity: 1;
    visibility: visible;
  }
  .dark #mobile-loader {
    background: #020617;
  }
  #mobile-loader.loaded {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.05);
    pointer-events: none;
  }
  .loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
  }
  .spinner-box {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .spinner-ring-outer {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #FF4D4D;
    border-right-color: #FF9F0A;
    border-radius: 50%;
    animation: spin-clockwise 1.5s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  }
  .spinner-ring-inner {
    position: absolute;
    width: 80%;
    height: 80%;
    border: 3px solid transparent;
    border-bottom-color: #FF9F0A;
    border-left-color: #FF4D4D;
    border-radius: 50%;
    animation: spin-counter-clockwise 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    opacity: 0.8;
  }
  .loader-logo-wrapper {
    position: absolute;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-logo 2s ease-in-out infinite;
  }
  .loader-text {
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    animation: pulse-text 1.8s ease-in-out infinite;
    padding: 0 1rem;
    letter-spacing: 0.05em;
  }
  .dark .loader-text {
    color: #f1f5f9;
  }
  .loader-subtext {
    font-size: 0.95rem;
    font-weight: 500;
    color: #64748b;
    text-align: center;
    margin-top: -0.75rem;
  }
  .dark .loader-subtext {
    color: #94a3b8;
  }
  @keyframes spin-clockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  @keyframes spin-counter-clockwise {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
  }
  @keyframes pulse-logo {
    0%, 100% { transform: scale(0.92); opacity: 0.95; }
    50% { transform: scale(1.08); opacity: 1; filter: drop-shadow(0 0 8px rgba(255, 77, 77, 0.4)); }
  }
  @keyframes pulse-text {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
  }
}
@media (min-width: 769px) {
  #mobile-loader {
    display: none !important;
  }
}

/* ========== MOBILE BOTTOM SHEET ========== */
.mobile-sheet-overlay {
  @apply fixed inset-0 bg-slate-900/60 backdrop-blur-sm z-[999] opacity-0 transition-opacity duration-300 hidden;
}

.mobile-bottom-sheet {
  @apply fixed bottom-0 left-0 right-0 bg-white dark:bg-slate-900 z-[1000] rounded-t-3xl shadow-[0_-8px_30px_rgba(0,0,0,0.12)] transform translate-y-full transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] flex flex-col max-h-[90vh];
}

.mobile-bottom-sheet.sheet-open {
  @apply translate-y-0;
}

.mobile-sheet-header {
  @apply flex items-center justify-between px-5 py-4 border-b border-slate-100 dark:border-slate-800 shrink-0;
}

.mobile-sheet-title {
  @apply font-display font-black text-lg text-slate-900 dark:text-white;
}

.mobile-sheet-close {
  @apply w-8 h-8 flex items-center justify-center rounded-full bg-slate-100 dark:bg-slate-800 text-slate-500 dark:text-slate-400 hover:bg-slate-200 dark:hover:bg-slate-700 active:scale-95 transition-all;
}

.mobile-sheet-content {
  @apply flex-1 overflow-y-auto px-5 py-4 overscroll-contain pb-[env(safe-area-inset-bottom,16px)];
}

.mobile-sheet-drag-handle {
  @apply w-12 h-1.5 rounded-full bg-slate-200 dark:bg-slate-700 mx-auto mt-2 mb-1;
}

/* ========== MOBILE FIXED HEADER & NAV PADDING ========== */
@media (max-width: 767px) {
  body, body.has-bottom-nav, body.mobile-theme-active {
    padding-top: calc(64px + env(safe-area-inset-top)) !important;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }
}
/* ========== PREMIUM MOBILE SEARCH EXPERIENCE (NOON STYLE) ========== */

#mobile-search-overlay {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.08);
}

#mobile-search-overlay.search-open {
  transform: translate3d(0, 0, 0) !important;
}

/* Suggestion Group Styles */
.suggestion-group-header {
  @apply text-xxs font-black tracking-wider uppercase text-slate-400 dark:text-slate-500 mb-2 mt-4 px-1 flex items-center justify-between;
}

.suggestion-item {
  @apply flex items-center gap-3.5 py-3.5 px-2.5 rounded-2xl active:bg-slate-100 dark:active:bg-slate-800/80 transition-all cursor-pointer;
}

.suggestion-item-icon {
  @apply w-10 h-10 rounded-xl flex items-center justify-center bg-white dark:bg-slate-800 border border-slate-100 dark:border-slate-700/50 text-slate-500 dark:text-slate-400 text-sm flex-shrink-0 shadow-sm;
}

.suggestion-item-text {
  @apply text-xs font-semibold text-slate-700 dark:text-slate-300 flex-1 truncate;
}

.suggestion-item-highlight {
  @apply text-brand-500 font-extrabold;
}

.suggestion-item-badge {
  @apply text-[9px] font-black uppercase px-2 py-0.5 rounded bg-slate-100 dark:bg-slate-800 text-slate-500 dark:text-slate-400;
}

.suggestion-arrow {
  @apply text-slate-350 dark:text-slate-650 text-xs ltr:ml-auto rtl:mr-auto rtl:rotate-180;
}

/* Recent & Trending Tags (Noon Style) */
.search-tags-container {
  @apply flex flex-wrap gap-2.5 py-2 px-1 mb-4;
}

.search-tag-chip {
  @apply inline-flex items-center gap-1.5 px-4 py-2 bg-white dark:bg-slate-900 border border-slate-200/50 dark:border-slate-800 rounded-full text-xs font-bold text-slate-750 dark:text-slate-300 hover:bg-slate-50 active:scale-95 transition-all cursor-pointer shadow-sm;
}

.search-tag-chip.trending-tag {
  @apply bg-amber-50/40 dark:bg-amber-950/10 border-amber-200/30 dark:border-amber-900/20 text-slate-850 dark:text-amber-300;
}

.search-tag-chip i {
  @apply text-[10px] opacity-70;
}

.search-history-clear-btn {
  @apply text-xxs font-black text-brand-500 hover:underline cursor-pointer border-none bg-transparent p-0;
}

/* Coupon Suggestion Card */
.coupon-suggestion-card {
  @apply border border-dashed border-brand-350/50 dark:border-brand-900/60 rounded-2xl bg-brand-50/10 dark:bg-brand-950/5 p-3.5 my-2 flex items-center justify-between gap-3 active:scale-[0.98] transition-all;
}

.coupon-card-info {
  @apply flex items-center gap-3 flex-1 min-w-0;
}

.coupon-card-meta {
  @apply flex flex-col min-w-0;
}

.coupon-card-title {
  @apply text-xs font-bold text-slate-800 dark:text-slate-200 truncate;
}

.coupon-card-store {
  @apply text-xxs text-slate-400 dark:text-slate-500 font-semibold mt-0.5;
}

.coupon-card-code-wrap {
  @apply flex items-center gap-1.5 mt-1.5;
}

.coupon-code-badge {
  @apply inline-block text-[10px] font-black font-mono tracking-wider px-2 py-0.5 bg-brand-50 dark:bg-brand-950/40 text-brand-550 border border-brand-100 dark:border-brand-900/40 rounded-md uppercase;
}

.coupon-copy-btn {
  @apply text-[10px] font-extrabold text-slate-500 hover:text-brand-500 border border-slate-200 dark:border-slate-800 rounded-lg px-2.5 py-1.5 bg-white dark:bg-slate-900 shadow-sm active:scale-95 transition-all flex-shrink-0 cursor-pointer;
}

/* ========== HORIZONTAL SNAP SCROLLER ========== */
.horizontal-scroller {
  display: flex !important;
  gap: 10px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-snap-type: x mandatory !important;
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE 10+ */
  padding: 4px 16px 6px !important;
  margin-left: -16px !important;
  margin-right: -16px !important;
  /* Native momentum scrolling on iOS */
  -webkit-overflow-scrolling: touch !important;
  /* Contain horizontal overscroll — prevent pull-to-refresh while swiping card row */
  overscroll-behavior-x: contain !important;
  overscroll-behavior-y: auto !important;
  /* GPU compositing for smooth scroll — compositor thread handles it */
  will-change: scroll-position !important;
  /* Layout containment: recalcs stay inside scroller, don't bubble up */
  contain: layout style !important;
  /* Allow both pan-x for horizontal card scrolling and pan-y for vertical page scrolling */
  touch-action: pan-x pan-y !important;
  /* Prevent text selection during drag */
  user-select: none !important;
  -webkit-user-select: none !important;
}

.horizontal-scroller.hidden,
.horizontal-scroller[hidden],
.mobile-deals-skeleton.hidden,
.mobile-deals-skeleton[hidden] {
  display: none !important;
}

.horizontal-scroller::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Opera */
}

.horizontal-scroller > * {
  scroll-snap-align: start !important;
  flex: 0 0 160px !important; /* Standard card width */
  width: 160px !important;
  max-width: 160px !important;
  /* Allow links and buttons inside cards to receive taps */
  touch-action: manipulation !important;
}

/* Store Scroller has smaller cards */
.horizontal-scroller.store-scroller > * {
  flex: 0 0 96px !important;
  width: 96px !important;
  max-width: 96px !important;
}

/* Global mobile padding rules — reset, spacing handled per-section via mb-* classes */
.mobile-section-spacing {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ════════════════════════════════════════════════════════════════
   DESIGN SYSTEM BRIDGE — component aliases mapping old classes
   to the canonical design system tokens.
   ════════════════════════════════════════════════════════════════ */

/* Search box border radius from design system */
.mobile-search-bar {
  border-radius: var(--ds-radius-search, 16px);
}

/* Input height from design system */
.mobile-search-bar input {
  min-height: var(--ds-height-input, 48px);
}

/* Hero CTA button from design system */
.mobile-hero-cta {
  height:        var(--ds-height-button, 48px);
  border-radius: var(--ds-radius-button, 12px);
  background:    var(--ds-color-primary, #FF4D4D);
  color:         #FFFFFF;
  font-size:     var(--ds-text-button, 14px);
  font-weight:   var(--ds-fw-semibold, 600);
  transition:    all var(--ds-transition-fast);
}

/* Card footer dividers */
.mobile-deal-card-footer {
  border-top-color: var(--ds-color-border, #EEEEEE);
}

/* Countdown urgency colors */
.mobile-deal-card-countdown.expiring-soon {
  color: var(--ds-color-secondary, #FF9F0A);
}

/* Countdown urgency colors */
.mobile-deal-card-countdown.urgent {
  color: var(--ds-color-primary, #FF4D4D);
}

