/* ==========================================================================
   Crystal Brand — Soft Blush & Dusty Rose Design System
   Typography: Cairo (Primary) — Muted Dusty Rose Palette — Ivory Surfaces
   ========================================================================== */

/* Cairo as primary, Alexandria as fallback — loaded via <link> in index.html */

/* ─── Design Tokens (From Palette Image) ─────────────────────────────────── */
:root {
  /* ── Muted Dusty Rose Palette */
  --rose-primary:    #B87589;   /* primary brand dusty rose — buttons, icons, accents */
  --rose-deep:       #9E586C;   /* deep rose — hover, active, high contrast prices   */
  --rose-dark:       #7A3E50;   /* dark rose — headings, deep accents                */
  --rose-medium:     #B87589;   /* primary rose token alias                          */
  --rose-light:      #E8D1D8;   /* blush light — borders, subtle dividers            */
  --rose-soft:       #F7E9EE;   /* light rose from brand palette (#F7E9EE)           */
  --rose-whisper:    #FDF7F9;   /* delicate ivory blush fill                         */

  /* ── Ivory / Off-white Surfaces */
  --bg-base:         #FFF9FB;   /* page background from brand palette (#FFF9FB)      */
  --bg-surface:      #FFFFFF;   /* clean card surface                                */
  --border-subtle:   rgba(184, 117, 137, 0.15);  /* very light card borders          */
  --border-light:    rgba(184, 117, 137, 0.30);  /* slightly visible borders         */

  /* ── Typography — Cairo weight system */
  --font-primary:    'Cairo', 'Alexandria', sans-serif;
  --fw-regular:      400;   /* descriptions, helper text                             */
  --fw-medium:       500;   /* labels, nav items, secondary text                     */
  --fw-semibold:     600;   /* product names, card titles                            */
  --fw-bold:         700;   /* sub-headings, brand names                             */
  --fw-extrabold:    800;   /* section headings, hero titles                         */
  --fw-black:        900;   /* prices in IQD (د.ع), top banner                      */

  /* ── Text colours (From Palette Image) */
  --text-main:       #30272D;   /* primary text from brand palette (#30272D)         */
  --text-secondary:  #6E6269;   /* warm muted plum gray                              */
  --text-muted:      #A3969E;   /* soft muted text & placeholders                    */
  --text-brand:      #9E586C;   /* brand deep rose — prices in IQD for high contrast */

  /* ── Shadows */
  --shadow-xs:  0 1px 4px  rgba(184, 117, 137, 0.08);
  --shadow-sm:  0 2px 10px rgba(184, 117, 137, 0.10);
  --shadow-md:  0 6px 20px rgba(184, 117, 137, 0.12);
  --shadow-glow:0 4px 16px rgba(184, 117, 137, 0.25);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ─── Reset & Base ────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--font-primary);
  font-weight: var(--fw-regular);
  font-size: 16px;
  line-height: 1.6;
  direction: rtl;
  scroll-behavior: smooth;
  background-color: var(--bg-base);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  padding-bottom: calc(72px + var(--safe-bottom));
  overflow-x: hidden;
  min-height: 100vh;
  background: radial-gradient(
    ellipse at 15% 10%,
    rgba(247, 233, 238, 0.45) 0%,
    var(--bg-base) 70%
  );
}

/* ─── Global Typography Scale ─────────────────────────────────────────────── */

/* Section headings (أكثر مبيعاً، وصل حديثاً…) */
.section-title {
  font-family: var(--font-primary);
  font-weight: var(--fw-extrabold);   /* 800 */
  font-size: clamp(1rem, 4vw, 1.25rem);
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Hero / banner headings */
.hero-title {
  font-family: var(--font-primary);
  font-weight: var(--fw-black);       /* 900 */
  font-size: clamp(1.1rem, 5vw, 2rem);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

/* Product card names */
.product-title {
  font-family: var(--font-primary);
  font-weight: var(--fw-semibold);    /* 600 */
  font-size: 0.8125rem;               /* 13px */
  color: var(--text-main);
  line-height: 1.45;
}

/* Prices (د.ع) — most prominent weight */
.price-iqd {
  font-family: var(--font-primary);
  font-weight: var(--fw-black);       /* 900 */
  font-size: 1.05rem;
  color: var(--text-brand);           /* #9E586C for high contrast */
  letter-spacing: -0.01em;
}

/* Body copy / descriptions */
.text-desc {
  font-family: var(--font-primary);
  font-weight: var(--fw-regular);     /* 400 */
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

/* ─── Glass Surfaces ──────────────────────────────────────────────────────── */
.glass-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
}

.glass-nav {
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-light);
}

/* ─── Product Card ────────────────────────────────────────────────────────── */
.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--rose-light);
}

.product-img-wrapper {
  position: relative;
  overflow: hidden;
  background-color: #FFF9FB;
  aspect-ratio: 1 / 1;
}

.product-img-wrapper img {
  transition: transform 0.4s ease;
}

.product-card:hover .product-img-wrapper img {
  transform: scale(1.04);
}

/* ─── Swiper Pagination Bullets ───────────────────────────────────────────── */
.swiper-pagination-bullet {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.65);
  opacity: 0.8;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.swiper-pagination-bullet-active {
  width: 20px;
  border-radius: 9999px;
  background: var(--rose-primary) !important;
  opacity: 1 !important;
  box-shadow: 0 0 8px rgba(184, 117, 137, 0.55);
}

/* ─── Category Bubble ─────────────────────────────────────────────────────── */
.category-bubble {
  transition: all 0.2s ease;
}

.category-bubble .bubble-ring {
  border-color: var(--rose-light);
  transition: all 0.25s ease;
}

.category-bubble.active .bubble-ring {
  border-color: var(--rose-primary);
  box-shadow: 0 0 0 3px rgba(184, 117, 137, 0.2);
}

.category-bubble.active span {
  color: var(--rose-primary);
  font-weight: var(--fw-bold);  /* 700 */
}

/* ─── Countdown Timer ─────────────────────────────────────────────────────── */
.countdown-box {
  background: var(--bg-surface);
  border: 1px solid var(--rose-light);
  min-width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
}

/* ─── Touch Feedback ──────────────────────────────────────────────────────── */
.touch-press:active {
  transform: scale(0.96);
  transition: transform 0.1s ease;
}

/* ─── Trust Strip ─────────────────────────────────────────────────────────── */
.trust-strip {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}

/* ─── Badge Pulse Animation ───────────────────────────────────────────────── */
@keyframes badgePulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.scale-animation {
  animation: badgePulse 0.3s ease-in-out;
}

/* ─── Custom Scrollbar Hide (horizontal sliders) ──────────────────────────── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ─── Text Gradient Utility ───────────────────────────────────────────────── */
.text-rose-gradient {
  background: linear-gradient(135deg, #B87589 0%, #9E586C 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bg-rose-gradient {
  background: linear-gradient(135deg, #B87589 0%, #9E586C 100%);
}

/* ─── Account Drawer Tabs & Layout ────────────────────────────────────────── */
.account-tab-content {
  animation: accountTabFadeIn 0.22s ease-out;
}
@keyframes accountTabFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Circular Brands Slider UI ───────────────────────────────────────────── */
.brand-item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  padding: 6px 4px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.brand-item-card:hover {
  transform: translateY(-3px);
}
.brand-circle-avatar {
  width: 78px;
  height: 78px;
  border-radius: 50% !important;
  background: #ffffff;
  border: 2px solid #F7E9EE;
  box-shadow: 0 4px 14px rgba(158, 88, 108, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  aspect-ratio: 1 / 1;
}
@media (min-width: 640px) {
  .brand-circle-avatar {
    width: 86px;
    height: 86px;
    padding: 14px;
  }
}
.brand-item-card:hover .brand-circle-avatar {
  border-color: #B87589;
  box-shadow: 0 6px 20px rgba(184, 117, 137, 0.18);
  transform: scale(1.04);
}
.brand-circle-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}
.brand-item-card:hover .brand-circle-avatar img {
  transform: scale(1.08);
}
.brand-circle-name {
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  text-align: center;
  max-width: 90px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
  transition: color 0.2s ease;
}
.brand-item-card:hover .brand-circle-name {
  color: #9E586C;
}

/* ─── Leaflet Interactive Address Map ─────────────────────────────────────── */
.address-map-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #E8D1D8;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
  background-color: #FFF9FB;
  z-index: 10;
}
.leaflet-container {
  font-family: 'Cairo', sans-serif !important;
  z-index: 10 !important;
}
.leaflet-pane {
  z-index: 10 !important;
}
.leaflet-top, .leaflet-bottom {
  z-index: 20 !important;
}
.address-map-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  color: #9E586C;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 30;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.map-locate-btn {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid #E8D1D8;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 30;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}
.map-locate-btn:hover {
  background: #FDF7F9;
  color: #9E586C;
  border-color: #E8D1D8;
}

/* ==========================================================================
   Announcement Bar Marquee
   ========================================================================== */
.announcement-bar-container {
  background: #F7E9EE;
  border-bottom: 1px solid #E8D1D8;
  color: #7A3E50;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  position: relative;
  user-select: none;
  height: 34px;
  display: flex;
  align-items: center;
}

.announcement-marquee-wrapper {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: announcement-marquee-ltr 28s linear infinite;
}

.announcement-marquee-wrapper:hover {
  animation-play-state: paused;
}

.announcement-marquee-group {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding: 0 1.5rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.announcement-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: default;
}

.announcement-sep {
  color: #B87589;
  opacity: 0.6;
  font-size: 8px;
}

@keyframes announcement-marquee-ltr {
  0% {
    transform: translate3d(-50%, 0, 0);
  }
  100% {
    transform: translate3d(0%, 0, 0);
  }
}

/* ==========================================================================
   Account Iconic Square Tabs
   ========================================================================== */
.account-squares-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 360px) {
  .account-squares-grid {
    gap: 6px;
  }
}

.account-nav-square {
  aspect-ratio: 1 / 1;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  background: #FFFFFF;
  border: 1.5px solid #E8D1D8;
  border-radius: 16px;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(184, 117, 137, 0.04);
  user-select: none;
  touch-action: manipulation;
  text-decoration: none;
}

.account-nav-square:hover {
  border-color: #B87589;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(184, 117, 137, 0.12);
}

.account-nav-square:active {
  transform: scale(0.96);
}

/* Active Selected Square */
.account-nav-square.active {
  background: linear-gradient(135deg, #FFF9FB 0%, #F7E9EE 100%);
  border-color: #B87589;
  border-width: 2px;
  box-shadow: 0 3px 10px rgba(184, 117, 137, 0.16);
}

.account-nav-square.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 22%;
  right: 22%;
  height: 3px;
  background: linear-gradient(90deg, #B87589, #9E586C);
  border-radius: 3px 3px 0 0;
}

.account-square-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin-bottom: 4px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

@media (max-width: 380px) {
  .account-square-icon-box {
    width: 32px;
    height: 32px;
    font-size: 13px;
    margin-bottom: 3px;
  }
}

.account-nav-square.active .account-square-icon-box {
  transform: scale(1.08);
}

.account-square-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .account-square-label {
    font-size: 10px;
  }
}

.account-nav-square.active .account-square-label {
  color: #9E586C;
  font-weight: 900;
}

.account-square-sub {
  font-size: 8.5px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-nav-square.active .account-square-sub {
  color: #B87589;
  font-weight: 800;
}

.account-square-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 9999px;
  background: #B87589;
  color: #FFFFFF;
  font-size: 8.5px;
  font-weight: 800;
  font-family: monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  line-height: 1;
}

/* ==========================================================================
   Account Vertical List Menu
   ========================================================================== */
.account-menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px;
  background: #FFFFFF;
  border: 1px solid rgba(232, 209, 216, 0.6);
  border-radius: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  touch-action: manipulation;
  box-shadow: 0 1px 3px rgba(184, 117, 137, 0.04);
}

.account-menu-item:hover {
  background: #FFF9FB;
  border-color: #B87589;
  transform: translateX(-3px);
  box-shadow: 0 3px 10px rgba(184, 117, 137, 0.1);
}

.account-menu-item:active {
  transform: scale(0.98);
}

.account-menu-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

/* ==========================================================================
   Primary & Secondary Categories Sub-View System & Brand Screens
   ========================================================================== */
.category-hero-summary {
  background: linear-gradient(135deg, #FDF7F9 0%, #F7E9EE 50%, #E8D1D8 100%);
  border: 1px solid rgba(232, 209, 216, 0.65);
  border-radius: 20px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(184, 117, 137, 0.08);
}

.category-hero-summary::before {
  content: '';
  position: absolute;
  top: -20px;
  left: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}

.subcategory-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1.5px solid rgba(232, 209, 216, 0.5);
  border-radius: 18px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(184, 117, 137, 0.04);
  user-select: none;
  touch-action: manipulation;
}

.subcategory-card:hover {
  background: #FFF9FB;
  border-color: #B87589;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(184, 117, 137, 0.1);
}

.subcategory-card:active {
  transform: scale(0.98);
}

.subcategory-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #F7E9EE;
  color: #B87589;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(232, 209, 216, 0.6);
}

.subcategory-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-context-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF9FB 100%);
  border: 1.5px solid rgba(232, 209, 216, 0.6);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 3px 12px rgba(184, 117, 137, 0.06);
}

.brand-context-logo {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  padding: 2px;
  border: 2px solid #B87589;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(184, 117, 137, 0.15);
}

.brand-context-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Infinite Scroll Loading Spinner */
.infinite-scroll-loader {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  background: #FDF7F9;
  border: 1px solid #E8D1D8;
  color: #9E586C;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(184, 117, 137, 0.06);
}

.spinner-dual-ring {
  display: inline-block;
  width: 16px;
  height: 16px;
}
.spinner-dual-ring:after {
  content: " ";
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #B87589;
  border-color: #B87589 transparent #B87589 transparent;
  animation: spinner-dual-ring 0.8s linear infinite;
}
@keyframes spinner-dual-ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.infinite-scroll-finished {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(247, 233, 238, 0.7);
  border: 1px solid rgba(232, 209, 216, 0.6);
  color: #7A3E50;
  font-size: 10.5px;
  font-weight: 700;
}
