/* === Base Overrides === */
:root {
  --background: #F7F8FC;
  --foreground: #0D2137;
  --card: #FFFFFF;
  --muted: #E4E7EF;
  --muted-foreground: #5C6478;
  --accent: #10C07A;
  --border: rgba(13,33,55,0.07);
  --secondary: #EEF0F6;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

/* === تفاعلية: مؤشر اليد والتغذية البصرية عند hover (ماوس) === */
a[href],
button:not(:disabled),
input[type='submit']:not(:disabled),
input[type='button']:not(:disabled),
input[type='reset']:not(:disabled),
input[type='file']:not(:disabled),
input[type='checkbox']:not(:disabled),
input[type='radio']:not(:disabled),
label[for],
select:enabled,
summary {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
}

@media (hover: hover) and (pointer: fine) {
  button[type='submit']:not(:disabled):hover {
    filter: brightness(1.06);
  }

  #filters-toggle:not(:disabled):hover {
    border-color: rgba(16, 192, 122, 0.35);
    box-shadow: 0 2px 8px -2px rgba(13, 33, 55, 0.08);
  }

  .cat-filter:not(:disabled):hover {
    filter: brightness(0.97);
  }

  .cat-filter.active:not(:disabled):hover {
    filter: brightness(1.08);
  }

  #clear-all-filters:hover {
    color: #0a8f5c;
  }
}

::selection {
  background-color: #10C07A;
  color: #fff;
}

/* === صفحة أنواع المتاجر: منع الانزلاق الأفقي على الجوال === */
@media (max-width: 1023px) {
  .store-types-page {
    overflow-x: hidden;
    max-width: 100%;
  }
  .store-types-page .animate-on-scroll[data-direction="left"],
  .store-types-page .animate-on-scroll[data-direction="right"] {
    transform: translateY(22px);
  }
  .store-types-page .animate-on-scroll[data-direction="left"].visible,
  .store-types-page .animate-on-scroll[data-direction="right"].visible {
    transform: translateY(0);
  }
}

/* === Scroll Animation === */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.22,1,0.36,1), transform 0.7s cubic-bezier(0.22,1,0.36,1);
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}
.animate-on-scroll[data-direction="left"] {
  transform: translateX(50px);
}
.animate-on-scroll[data-direction="left"].visible {
  transform: translateX(0);
}
.animate-on-scroll[data-direction="right"] {
  transform: translateX(-50px);
}
.animate-on-scroll[data-direction="right"].visible {
  transform: translateX(0);
}

/* Stagger children */
.stagger-container > * {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1);
}
.stagger-container.visible > *:nth-child(1) { transition-delay: 0s; }
.stagger-container.visible > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-container.visible > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-container.visible > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-container.visible > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-container.visible > *:nth-child(6) { transition-delay: 0.5s; }
.stagger-container.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* === Floating Animation === */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
.animate-float {
  animation: float 4s ease-in-out infinite;
}
.animate-float-slow {
  animation: float 5s ease-in-out infinite 1s;
}

/* === Pulse Animation === */
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(4.5); opacity: 0; }
}
.animate-pulse-ring {
  animation: pulse-ring 3.5s ease-out infinite;
}
.animate-pulse-ring:nth-child(2) { animation-delay: 1.15s; }
.animate-pulse-ring:nth-child(3) { animation-delay: 2.3s; }

/* === Glow Orb === */
@keyframes glow-pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.6; }
}
.glow-orb {
  animation: glow-pulse 6s ease-in-out infinite;
}

/* === 3D Cube === */
@keyframes cube-rotate {
  0% { transform: rotateX(18deg) rotateY(0deg); }
  100% { transform: rotateX(378deg) rotateY(360deg); }
}
.cube-3d {
  animation: cube-rotate 5s linear infinite;
  transform-style: preserve-3d;
}

/* === Core Glow === */
@keyframes core-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.18); opacity: 1; }
}
.core-glow {
  animation: core-pulse 2s ease-in-out infinite;
}

/* === Orbital Ring Rotation === */
@keyframes ring-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes ring-spin-reverse {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

/* === Particle Float === */
@keyframes particle-float {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-18px); opacity: 1; }
}

/* === Scan Line === */
@keyframes scan-line {
  0% { top: 0%; }
  50% { top: 100%; }
  100% { top: 0%; }
}
.scan-line {
  animation: scan-line 5s linear infinite;
}

/* === Stream Dash === */
@keyframes stream-dash {
  from { stroke-dashoffset: 120; }
  to { stroke-dashoffset: 0; }
}

/* === Dot Pulse === */
@keyframes dot-pulse {
  0%, 100% { opacity: 0.3; r: 3; }
  50% { opacity: 1; r: 4.8; }
}

/* === Badge Float + Enter === */
@keyframes badge-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
@keyframes badge-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Terminal Blink === */
@keyframes blink-cursor {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}
.terminal-blink {
  animation: blink-cursor 1.5s ease-in-out infinite;
}

/* === CountUp placeholder === */
.count-up {
  display: inline-block;
}

/* === Active Nav indicator (header) — شريط الجوال والصفحات الأخرى === */
.nav-active-bg {
  background: #10C07A;
}

/* شريط تنقل سطح المكتب: كبسولة منزلقة خلف الرابط النشط */
#ya-primary-nav .ya-nav-pill {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(0, 0);
  transform-origin: 0 0;
  width: 0;
  height: 0;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #0d2137 0%, #10c07a 100%);
  box-shadow: 0 2px 10px -2px rgba(16, 192, 122, 0.35);
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition:
    transform 0.4s cubic-bezier(0.22, 1, 0.32, 1),
    width 0.4s cubic-bezier(0.22, 1, 0.32, 1),
    height 0.4s cubic-bezier(0.22, 1, 0.32, 1),
    opacity 0.25s ease;
  will-change: transform, width, height;
}

#ya-primary-nav .ya-nav-pill.ya-nav-pill--visible {
  opacity: 1;
}

#ya-primary-nav .ya-nav-pill.ya-nav-pill--no-transition {
  transition: none !important;
}

/* === Mobile menu === */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}
.mobile-menu.open {
  max-height: 500px;
  opacity: 1;
}

/* === FAQ Accordion === */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.22,1,0.36,1), padding 0.3s ease;
}
.faq-item.active .faq-answer {
  max-height: 500px;
}
.faq-item.active .faq-chevron {
  transform: rotate(180deg);
}
.faq-chevron {
  transition: transform 0.3s ease;
}

/* === Pricing Toggle === */
.billing-toggle {
  position: relative;
  width: 56px;
  height: 28px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.3s;
}
.billing-toggle .toggle-knob {
  position: absolute;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: right 0.3s cubic-bezier(0.22,1,0.36,1);
  right: 28px;
}
.billing-toggle.active {
  background: #10C07A;
}
.billing-toggle.active .toggle-knob {
  right: 2px;
}
.billing-toggle:not(.active) {
  background: rgba(255,255,255,0.1);
}

/* === Tab Active (Pricing) === */
.store-tab {
  position: relative;
}
.store-tab.active {
  color: white;
}
.store-tab.active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, #0D2137, #10C07A);
  border-radius: 0.5rem;
  z-index: 0;
}
.store-tab span {
  position: relative;
  z-index: 1;
}

/* === Template cards: لمس بعرض xl فقط (الصف السفلي مخفي) — إظهار أزرار الصورة دائماً === */
@media (hover: none) and (min-width: 1280px) {
  .tpl-card-touch .tpl-img-overlay,
  .tpl-card-touch .tpl-img-actions {
    opacity: 1 !important;
  }
}

/* === Store type badges (template cards) === */
.sell { background: rgba(16,192,122,0.12); color: #10C07A; border: 1px solid rgba(16,192,122,0.25); }
.booking { background: rgba(13,33,55,0.08); color: #0D2137; border: 1px solid rgba(13,33,55,0.12); }
.rental { background: rgba(99,102,241,0.12); color: #6366f1; border: 1px solid rgba(99,102,241,0.25); }

/* === Grid Pattern SVG === */
.grid-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
}

/* === WooCommerce Checkout / Order-Pay === */
.woocommerce-checkout,
.woocommerce-order-pay {
  background: #f9fafb;
}

#payment {
  background: transparent;
  border: none;
  box-shadow: none;
}

#payment .payment_methods {
  display: none;
}

.woocommerce .amount {
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
}

/* WooCommerce notices */
.woocommerce-error,
.woocommerce-message,
.woocommerce-info {
  list-style: none;
  padding: 14px 20px;
  margin: 0 0 1.5rem;
  border-radius: 0.75rem;
  font-size: 14px;
  line-height: 1.7;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

.woocommerce-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.woocommerce-message {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.woocommerce-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.woocommerce-error li,
.woocommerce-message li {
  list-style: none;
}

/* Hide WC defaults on order-pay */
.woocommerce-order-pay .woocommerce-form-login-toggle,
.woocommerce-order-pay .woocommerce-form-coupon-toggle {
  display: none;
}

/* === Pricing plan slider (scroll-snap جوال، شبكة سطح مكتب) === */
.ya-plan-slider {
  isolation: isolate;
}

.ya-plan-slider-viewport {
  position: relative;
  z-index: 1;
}

.ya-plan-slider-track {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 1.25rem;
}

.ya-plan-slide {
  flex: 0 0 auto;
  box-sizing: border-box;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 28rem;
}

@media (min-width: 640px) {
  .ya-plan-slide {
    min-height: 30rem;
  }
}

.ya-plan-slide .ya-plan-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex: 1 1 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* جوال: تمرير أفقي + تثبيت الشريحة */
@media (max-width: 1023px) {
  .ya-plan-slider-viewport {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .ya-plan-slider-track {
    padding-left: max(1rem, calc(50% - min(160px, 45vw)));
    padding-right: max(1rem, calc(50% - min(160px, 45vw)));
    width: max-content;
    max-width: none;
  }

  .ya-plan-slide {
    scroll-snap-align: center;
    flex: 0 0 min(320px, calc(100vw - 2.5rem)) !important;
    width: min(320px, calc(100vw - 2.5rem)) !important;
    max-width: min(320px, calc(100vw - 2.5rem)) !important;
  }

  .ya-plan-slide .ya-plan-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* زر اختيار الباقة: فوق أي طبقة داخل البطاقة + تقليل تعارض اللمس/التمرير */
  .ya-plan-card .plan-select-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* سطح المكتب: شبكة، بدون تمرير */
@media (min-width: 1024px) {
  .ya-plan-slider-viewport {
    overflow: visible;
  }

  .ya-plan-slider-track {
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    width: auto;
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }

  .ya-plan-slide {
    flex: 0 0 320px !important;
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
    scroll-snap-align: unset;
  }

  .ya-plan-slide .ya-plan-card {
    max-width: 320px !important;
    min-width: 0 !important;
  }
}

/* Home hero: accent text without bg-clip (fixes Arabic ي+ث shaping as «حديتة» on WebKit mobile) */
.home-hero-title-accent {
  color: #10c07a;
  text-shadow: 0 0 28px rgba(16, 192, 122, 0.35);
}

.home-hero-title-line {
  height: 4px;
  width: 5rem;
  max-width: 100%;
  border-radius: 9999px;
  background: linear-gradient(to left, #10c07a, rgba(16, 192, 122, 0.15));
}

@media (min-width: 1024px) {
  .home-hero-title-line {
    width: 6rem;
  }
}

/* Start flow — selected store type & template (check + highlight) */
.type-card-check,
.tpl-select-check {
  opacity: 0;
  transform: scale(0.82);
  transition:
    opacity 0.28s ease,
    transform 0.32s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.type-card.is-selected {
  border-color: #10c07a !important;
  box-shadow:
    0 0 0 1px rgba(16, 192, 122, 0.35),
    0 18px 44px -14px rgba(16, 192, 122, 0.28);
}

.type-card.is-selected:hover {
  border-color: #10c07a !important;
  box-shadow:
    0 0 0 1px rgba(16, 192, 122, 0.45),
    0 22px 50px -12px rgba(16, 192, 122, 0.32);
}

.type-card.is-selected .type-card-check {
  opacity: 1;
  transform: scale(1);
}

.tpl-select.is-selected {
  border-color: #10c07a !important;
  box-shadow:
    0 0 0 1px rgba(16, 192, 122, 0.3),
    0 16px 40px -12px rgba(16, 192, 122, 0.25);
}

.tpl-select.is-selected:hover {
  border-color: #10c07a !important;
}

.tpl-select.is-selected .tpl-select-check {
  opacity: 1;
  transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .type-card-check,
  .tpl-select-check {
    transition: none;
  }

  .type-card.is-selected .type-card-check,
  .tpl-select.is-selected .tpl-select-check {
    transform: none;
  }
}

/* Auth pages: toast fixed to top of viewport (below sticky header), RTL-safe */
.ya-auth-toast {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left, 0px));
  right: max(1rem, env(safe-area-inset-right, 0px));
  top: calc(4rem + env(safe-area-inset-top, 0px));
  z-index: 60;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
  width: auto;
  box-sizing: border-box;
}

/* === Reduce Motion === */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll,
  .stagger-container > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .animate-float,
  .animate-float-slow,
  .animate-pulse-ring,
  .glow-orb,
  .cube-3d,
  .core-glow,
  .scan-line,
  .terminal-blink {
    animation: none !important;
  }
}
