/* =========================================================
   IBRAND | أي براند — Bio Page
   الهوية اللونية مستخرجة من ibrand.com.sa (اللون الأساسي #e873a8)
   ========================================================= */

/* ---------- CSS Variables ---------- */
:root {
  /* الألوان */
  --brand: #e873a8;
  --brand-deep: #c94f8b;
  --brand-soft: #f6b8d3;
  --brand-tint: #fdeef5;
  --ink: #35172a;
  --ink-soft: #7a5a6d;
  --white: #ffffff;
  --success: #22a06b;

  /* التدرجات */
  --grad-brand: linear-gradient(135deg, #e873a8 0%, #c94f8b 100%);
  --grad-bg: linear-gradient(180deg, #fff7fb 0%, #fdeef5 45%, #fbe4ef 100%);
  --grad-text: linear-gradient(120deg, #c94f8b, #e873a8 60%, #f0a1c4);

  /* الزجاجية */
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-bg-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-blur: 18px;

  /* الظلال */
  --shadow-soft: 0 8px 30px rgba(201, 79, 139, 0.10);
  --shadow-card: 0 12px 40px rgba(201, 79, 139, 0.14);
  --shadow-hover: 0 20px 55px rgba(201, 79, 139, 0.22);

  /* الخطوط */
  --font-display: "Alexandria", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Alexandria", system-ui, sans-serif;

  /* أبعاد */
  --radius: 22px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --container: 1080px;

  /* الحركة */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.45s;
}

/* ---------- إعادة الضبط ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--grad-bg) fixed;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

/* إصلاح جوهري: احترام سمة hidden حتى مع display:flex على البطاقات */
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--brand-deep);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- المشهد الخلفي: أشكال عائمة ---------- */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: drift 22s var(--ease) infinite alternate;
}
.blob-1 { width: 480px; height: 480px; background: #f9c6dd; top: -140px; inset-inline-start: -120px; }
.blob-2 { width: 380px; height: 380px; background: #fde3ef; top: 35%; inset-inline-end: -140px; animation-delay: -8s; }
.blob-3 { width: 420px; height: 420px; background: #f3aecd; bottom: -160px; inset-inline-start: 20%; animation-delay: -15s; }

/* كبسولات صيدلية عائمة — لمسة الهوية */
.pill {
  position: absolute;
  width: 64px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--brand) 50%, var(--white) 50%);
  box-shadow: 0 6px 18px rgba(201, 79, 139, 0.18);
  opacity: 0.5;
  animation: floatPill 14s ease-in-out infinite alternate;
}
.pill-1 { top: 16%; inset-inline-start: 8%; rotate: -24deg; }
.pill-2 { top: 44%; inset-inline-start: 88%; rotate: 32deg; width: 52px; height: 22px; animation-delay: -4s; }
.pill-3 { top: 68%; inset-inline-start: 6%; rotate: 14deg; width: 44px; height: 18px; animation-delay: -9s; }
.pill-4 { top: 85%; inset-inline-start: 78%; rotate: -38deg; animation-delay: -6s; }

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(40px, 50px, 0) scale(1.12); }
}
@keyframes floatPill {
  from { transform: translateY(0); }
  to   { transform: translateY(-34px); }
}

/* ---------- الزجاجية ---------- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-soft);
}

/* ---------- الترويسة ---------- */
.hero {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(48px, 8vw, 88px) 20px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.hero-badge {
  position: relative;
  border-radius: 32px;
  padding: 14px;
}
.hero-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 22px;
}
.verified {
  position: absolute;
  bottom: -6px;
  inset-inline-end: -6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--white);
  background: var(--grad-brand);
  border: 3px solid var(--white);
  box-shadow: var(--shadow-soft);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 5.4vw, 3rem);
  margin: 0;
  line-height: 1.6;
}
.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* حشوة تمنع قصّ مدّة الألف والحركات العلوية عند قصّ التدرج على النص */
  display: inline-block;
  padding: 0.18em 0.08em;
  margin: -0.18em -0.08em;
}

.hero-tagline {
  margin: 0;
  max-width: 560px;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.5vw, 1.12rem);
  font-weight: 600;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: clamp(14px, 4vw, 30px);
  padding: 14px clamp(18px, 4vw, 34px);
  border-radius: var(--radius-pill);
  margin-top: 6px;
}
.stat { display: grid; text-align: center; line-height: 1.3; }
.stat strong {
  font-family: var(--font-display);
  font-size: 1.35rem;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat span { font-size: 0.8rem; color: var(--ink-soft); }
.stat-sep { width: 1px; height: 34px; background: rgba(201, 79, 139, 0.2); }

/* ---------- الأزرار ---------- */
.btn {
  --btn-bg: var(--glass-bg-strong);
  --btn-color: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-color);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  box-shadow: var(--shadow-soft);
}
.btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.btn:active { transform: translateY(-1px) scale(0.98); }

.btn-primary {
  --btn-bg: var(--grad-brand);
  --btn-color: var(--white);
  border: none;
}
.btn-lg {
  padding: 16px 40px;
  font-size: 1.1rem;
  box-shadow: 0 14px 36px rgba(201, 79, 139, 0.35);
}
.btn-ico { font-size: 1.2em; line-height: 1; }

/* أزرار سريعة أعلى الصفحة */
.hero-quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.hero-quick .btn { padding: 11px 20px; font-size: 0.9rem; }
.btn-wa { --btn-bg: linear-gradient(135deg, #2bb35c, #1faa53); --btn-color: var(--white); border: none; }
.btn-locate.loading { opacity: 0.7; pointer-events: none; }

/* إبراز أقرب الفروع */
.branch-card.nearest {
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 5px rgba(232, 115, 168, 0.18), var(--shadow-hover);
}
.nearest-badge {
  display: inline-block;
  margin-top: 6px;
  margin-inline-start: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--white);
  background: var(--grad-brand);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
}

/* شارة المسافة من موقع المستخدم */
.dist-badge {
  display: inline-block;
  margin-top: 6px;
  margin-inline-start: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--brand-deep);
  background: var(--white);
  border: 1px solid rgba(232, 115, 168, 0.35);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  animation: distIn 0.4s var(--ease);
}
@keyframes distIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* تأثير Ripple */
.ripple { isolation: isolate; }
.ripple .ink {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  animation: rippleAnim 0.65s ease-out forwards;
  pointer-events: none;
  mix-blend-mode: overlay;
}
@keyframes rippleAnim {
  to { transform: scale(3.2); opacity: 0; }
}

/* ---------- الأقسام ---------- */
.section {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(38px, 6vw, 64px) 20px 0;
}
.section-head { text-align: center; margin-bottom: clamp(22px, 4vw, 34px); }
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  margin: 0 0 6px;
}
.section-sub { margin: 0; color: var(--ink-soft); font-size: 1rem; font-weight: 600; }

/* ---------- بطاقات المدن ---------- */
.cities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.city-card {
  border-radius: var(--radius);
  padding: 22px 18px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.city-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.city-ico {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  font-size: 1.7rem;
  border-radius: 18px;
  background: var(--brand-tint);
  border: 1px solid rgba(232, 115, 168, 0.25);
  transition: transform var(--dur) var(--ease);
}
.city-card:hover .city-ico { transform: scale(1.12) rotate(-6deg); }

.city-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  margin: 0;
}
.city-count {
  font-size: 0.82rem;
  color: var(--brand-deep);
  background: var(--brand-tint);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
}
.city-card .btn { margin-top: 8px; padding: 9px 20px; font-size: 0.86rem; }

/* ---------- شريط التصفية ---------- */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 24px;
  scrollbar-width: none;
  position: sticky;
  top: 12px;
  z-index: 5;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.filter-chip:hover { color: var(--brand-deep); transform: translateY(-1px); }
.filter-chip[aria-selected="true"] {
  background: var(--grad-brand);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(201, 79, 139, 0.3);
}

/* ---------- بطاقات الفروع ---------- */
.branches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.branch-card {
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.branch-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

.branch-top { display: flex; gap: 12px; align-items: flex-start; }
.branch-pin {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  border-radius: 14px;
  background: var(--brand-tint);
  border: 1px solid rgba(232, 115, 168, 0.25);
}
.branch-name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5;
}
.branch-city {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--brand-deep);
  background: var(--brand-tint);
  border-radius: var(--radius-pill);
  padding: 2px 10px;
}

.branch-phone {
  direction: ltr;
  text-align: end;
  font-size: 0.92rem;
  color: var(--ink-soft);
  letter-spacing: 0.4px;
  margin: 0;
}

.branch-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 8px;
  margin-top: auto;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-display);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(232, 115, 168, 0.22);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
  background: var(--brand-tint);
  color: var(--brand-deep);
}
.action-btn svg { flex-shrink: 0; }

.action-call:hover { background: #eaf8f1; color: var(--success); border-color: rgba(34, 160, 107, 0.3); }
.action-wa:hover { background: #e9f9ef; color: #1faa53; border-color: rgba(31, 170, 83, 0.3); }

/* ---------- التواصل الاجتماعي ---------- */
.socials-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.social-btn {
  --social: var(--brand);
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--social);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.social-btn:hover {
  transform: translateY(-6px) scale(1.08);
  background: var(--social);
  color: var(--white);
  box-shadow: 0 16px 38px rgba(201, 79, 139, 0.3);
}
.social-btn svg { width: 26px; height: 26px; }

.social-instagram { --social: #d6317f; }
.social-tiktok    { --social: #121212; }
.social-snapchat  { --social: #d8b400; }
.social-x         { --social: #111111; }
.social-facebook  { --social: #1877f2; }
.social-linkedin  { --social: #0a66c2; }

/* ---------- بطاقات التطبيق ---------- */
.apps-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}
.app-card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 26px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--ink);
  min-width: 220px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.app-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.app-ico {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--grad-brand);
  color: var(--white);
  box-shadow: 0 8px 22px rgba(201, 79, 139, 0.3);
}
.app-txt { display: grid; line-height: 1.35; }
.app-txt small { font-size: 0.75rem; color: var(--ink-soft); }
.app-txt strong { font-family: var(--font-display); font-size: 1.12rem; }

/* ---------- بطاقة التواصل ---------- */
.contact-card {
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 28px);
  max-width: 640px;
  margin: 0 auto;
}
.contact-rows { display: grid; gap: 12px; }
.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(232, 115, 168, 0.16);
}
.contact-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1 1 180px;
}
.contact-label .c-ico {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 1.1rem;
  background: var(--brand-tint);
}
.contact-label small {
  display: block;
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 0.8rem;
  direction: ltr;
  text-align: end;
}
.contact-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.contact-row .action-btn { padding: 9px 14px; }

/* ---------- التذييل ---------- */
.footer {
  text-align: center;
  padding: 52px 20px 90px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.footer p { margin: 0 0 4px; }
.footer a { color: var(--brand-deep); font-weight: 600; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ---------- العودة للأعلى ---------- */
.back-top {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 22px;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  color: var(--brand-deep);
  cursor: pointer;
  z-index: 40;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.back-top.show { opacity: 1; transform: translateY(0); }
.back-top:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 50%;
  transform: translateX(50%);
  display: grid;
  gap: 10px;
  z-index: 60;
  width: min(92vw, 380px);
  justify-items: center;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: rgba(53, 23, 42, 0.92);
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 14px 40px rgba(53, 23, 42, 0.35);
  animation: toastIn 0.4s var(--ease);
  backdrop-filter: blur(8px);
}
.toast.hide { animation: toastOut 0.35s var(--ease) forwards; }
.toast .t-ico { color: var(--brand-soft); font-size: 1.05rem; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(12px) scale(0.95); }
}

/* ---------- Scroll Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* تتابع ظهور البطاقات */
.stagger { transition-delay: calc(var(--i, 0) * 60ms); }

/* ---------- استجابة الشاشات ---------- */
@media (max-width: 640px) {
  .branches-grid { grid-template-columns: 1fr; }
  .cities-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .city-card .btn { padding: 8px 16px; }
  .hero-stats { width: 100%; justify-content: center; }
  .app-card { width: 100%; justify-content: center; }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .reveal { opacity: 1; transform: none; }
  .blob, .pill { animation: none; }
}
