/* ============================================================
   BLUE — auth.css
   Account button + menu · auth modal · wishlist heart ·
   WhatsApp float · account dashboard. Loaded on every page.
   ============================================================ */

/* ---------------------------------------------- account button + menu */
.account-wrap { position: relative; display: inline-flex; }
.account-btn.is-in { background: var(--royal); border-color: var(--royal); color: #fff; }
.account-btn.is-in:hover { background: var(--royal-deep); }
.acct-initial { font-family: var(--font-display); font-weight: 700; font-size: .95rem; line-height: 1; }
.site-header:not(.solid):not(.scrolled) .account-btn.is-in { background: rgba(255,255,255,.9); color: var(--navy); border-color: transparent; }

.account-menu {
  position: absolute; top: calc(100% + 12px); inset-inline-end: 0; z-index: 60;
  width: 240px; padding: 8px; background: var(--paper);
  border: 1px solid var(--line-soft); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); display: grid; gap: 2px;
  animation: amPop .22s var(--ease-out);
}
.account-menu[hidden] { display: none; }
@keyframes amPop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.am-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; display: grid; gap: 2px; }
.am-name { font-weight: 700; color: var(--ink); }
.am-email { font-size: var(--text-sm); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }
.account-menu a, .account-menu button {
  display: block; width: 100%; text-align: start; padding: 10px 12px;
  border-radius: var(--r-sm); font-size: .92rem; color: var(--ink);
  background: none; border: 0; cursor: pointer; transition: background .18s;
}
.account-menu a:hover, .account-menu button:hover { background: var(--powder-2); }
.account-menu #amSignout { color: #b23b3b; margin-top: 4px; border-top: 1px solid var(--line-soft); border-radius: 0 0 var(--r-sm) var(--r-sm); }

/* ---------------------------------------------- auth modal */
.auth-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 24, 48, .55); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: authFade .25s var(--ease-out);
}
.auth-overlay[hidden] { display: none; }
@keyframes authFade { from { opacity: 0; } to { opacity: 1; } }
/* Flex-column modal: the tabs + the footer (submit button) are ALWAYS
   visible; only the fields area scrolls if the viewport is short. */
.auth-modal {
  position: relative; width: min(440px, 100%);
  max-height: min(94vh, 760px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 0;
  animation: authRise .3s var(--ease-out);
}
@keyframes authRise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
.auth-x { position: absolute; top: 10px; inset-inline-end: 10px; width: 40px; height: 40px; z-index: 3; }
.auth-tabs { flex: none; display: flex; gap: 6px; background: var(--powder-2); padding: 4px; border-radius: var(--r-pill); margin: 16px 24px 2px; }
.auth-tab {
  flex: 1; padding: 10px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-soft); font-weight: 700; font-size: .9rem; cursor: pointer;
  transition: background .2s, color .2s;
}
.auth-tab.active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }
.auth-body { flex: 1 1 auto; min-height: 0; display: flex; }
.auth-form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.auth-fields { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 24px 6px; display: grid; gap: 9px; align-content: start; }
.auth-foot { flex: none; padding: 12px 24px 16px; display: grid; gap: 8px; border-top: 1px solid var(--line-soft); background: var(--paper); }
.auth-title { font-size: clamp(1.15rem, 1rem + .8vw, 1.4rem); line-height: 1.1; margin-bottom: 0; }
.auth-sub { color: var(--ink-soft); font-size: var(--text-xs); margin-bottom: 4px; line-height: 1.45; }
.auth-field { display: grid; gap: 5px; }
.auth-field > span { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.auth-field input {
  width: 100%; padding: 9px 13px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--canvas); color: var(--ink);
  font-size: .95rem; font-family: inherit; transition: border-color .2s, background .2s, box-shadow .2s;
}
.auth-field input:focus { outline: none; border-color: var(--royal); background: #fff; box-shadow: 0 0 0 3px rgba(var(--royal-rgb), .14); }
.auth-field input:disabled { opacity: .6; cursor: not-allowed; }
.auth-err { color: #b23b3b; font-size: var(--text-sm); background: rgba(178, 59, 59, .08); padding: 10px 12px; border-radius: var(--r-sm); margin: 2px 0 0; }
.auth-err[hidden] { display: none; }
.auth-submit { width: 100%; justify-content: center; }
.auth-alt { text-align: center; font-size: var(--text-sm); color: var(--ink-soft); margin: 0; }
.auth-link { background: none; border: 0; color: var(--royal); font-weight: 700; cursor: pointer; font-size: inherit; padding: 0 2px; }
.auth-link:hover { text-decoration: underline; }
.auth-demo { margin: 0; font-size: .72rem; color: var(--ink-soft); text-align: center; line-height: 1.45; }

/* ---------------------------------------------- wishlist heart on cards */
.pcard-media { position: relative; }
.pcard-wish {
  position: absolute; top: 12px; inset-inline-end: 12px; z-index: 3;
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .94); color: var(--navy);
  box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease-out), background .2s, color .2s;
}
.pcard-wish svg { width: 20px; height: 20px; transition: fill .2s; fill: transparent; }
.pcard-wish:hover { transform: scale(1.1); }
.pcard-wish.is-wished { background: var(--navy); color: #fff; }   /* saved = white heart on a dark plate */
.pcard-wish.is-wished svg { fill: currentColor; }
.pcard-wish.is-wished { animation: heartPop .32s var(--ease-out); }
@keyframes heartPop { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* ---------------------------------------------- product-page save button */
.pd-buyrow { display: flex; gap: 12px; align-items: stretch; }
.pd-buyrow .pd-add { flex: 1; }
.pd-wish {
  flex: none; width: 56px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--paper); color: var(--navy); cursor: pointer;
  display: grid; place-items: center; transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease-out);
}
.pd-wish svg { width: 22px; height: 22px; fill: transparent; transition: fill .2s; }
.pd-wish:hover { border-color: var(--royal); color: var(--royal); transform: translateY(-2px); }
.pd-wish.is-wished { background: var(--navy); border-color: var(--navy); color: #fff; }
.pd-wish.is-wished svg { fill: currentColor; }

/* ---------------------------------------------- WhatsApp floating button */
.wa-fab {
  position: fixed; bottom: 24px; inset-inline-end: 24px; z-index: 90;
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; background: #25D366;
  box-shadow: 0 12px 30px -8px rgba(37, 211, 102, .6), 0 4px 12px rgba(0,0,0,.18);
  transition: transform .3s var(--ease-out), box-shadow .3s;
}
.wa-fab svg { width: 32px; height: 32px; position: relative; z-index: 1; }
.wa-fab:hover { transform: scale(1.08) translateY(-2px); box-shadow: 0 18px 40px -8px rgba(37, 211, 102, .7); }
.wa-pulse { position: absolute; inset: 0; border-radius: 50%; background: #25D366; opacity: .55; animation: waPulse 2.4s ease-out infinite; }
@keyframes waPulse { 0% { transform: scale(1); opacity: .5; } 70%, 100% { transform: scale(1.9); opacity: 0; } }
@media (max-width: 640px) { .wa-fab { width: 52px; height: 52px; bottom: 18px; inset-inline-end: 18px; } .wa-fab svg { width: 28px; height: 28px; } }
@media (prefers-reduced-motion: reduce) { .wa-pulse { animation: none; } }

/* ---------------------------------------------- account dashboard page */
.account-page { padding: clamp(40px, 7vw, 90px) 0 clamp(60px, 9vw, 120px); background: var(--canvas); min-height: 70vh; }
.account-head { margin-bottom: clamp(24px, 4vw, 44px); }
.account-head h1 { font-size: clamp(1.8rem, 1.4rem + 2vw, 2.6rem); }
#accountApp { display: grid; grid-template-columns: 260px 1fr; gap: clamp(20px, 3vw, 44px); align-items: start; }
.acc-side {
  position: sticky; top: calc(var(--header-h) + 16px);
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 22px; display: grid; gap: 18px;
}
.acc-id { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.acc-avatar, .am-avatar { width: 46px; height: 46px; flex: none; border-radius: 50%; background: var(--royal); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.acc-id-t { display: grid; gap: 2px; overflow: hidden; }
.acc-id-t b { color: var(--ink); }
.acc-id-t span { font-size: var(--text-sm); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; }
.acc-nav { display: grid; gap: 3px; }
.acc-navlink { text-align: start; padding: 11px 14px; border: 0; background: none; border-radius: var(--r-sm); color: var(--ink-soft); font-size: .95rem; font-weight: 600; cursor: pointer; transition: background .18s, color .18s; }
.acc-navlink:hover { background: var(--powder-2); color: var(--ink); }
.acc-navlink.active { background: var(--navy); color: #fff; }
.acc-signout { justify-content: center; }
.acc-panel { background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: clamp(22px, 3vw, 38px); min-height: 300px; }
.acc-h { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); margin-bottom: 22px; }
.acc-form { display: grid; gap: 15px; max-width: 420px; }
.acc-form .btn { justify-self: start; margin-top: 6px; }
.acc-meta { margin-top: 20px; font-size: var(--text-sm); color: var(--ink-soft); }
.acc-check { display: flex; align-items: center; gap: 9px; font-size: var(--text-sm); color: var(--ink-soft); cursor: pointer; }
.acc-check input { width: 17px; height: 17px; accent-color: var(--royal); }

.acc-orders, .acc-addrs { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.acc-order { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 16px 18px; display: grid; gap: 8px; }
.ao-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ao-top b { color: var(--ink); }
.ao-top span { color: var(--ink-soft); font-size: var(--text-sm); }
.ao-items { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.5; }
.ao-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.ao-foot span { color: var(--ink-soft); font-size: var(--text-sm); }
.ao-foot b { font-family: var(--font-display); font-size: 1.1rem; }
.acc-addr { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 14px 16px; }
.acc-addr > div { display: grid; gap: 2px; flex: 1; }
.acc-addr b { color: var(--ink); }
.acc-addr span { color: var(--ink-soft); font-size: var(--text-sm); }
.acc-addr-def { font-size: .72rem; font-weight: 700; color: var(--royal); background: rgba(var(--royal-rgb), .1); padding: 4px 10px; border-radius: var(--r-pill); }
.acc-addr-x { width: 34px; height: 34px; border: 0; background: var(--powder-2); border-radius: 50%; color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; flex: none; }
.acc-addr-x svg { width: 16px; height: 16px; }
.acc-addr-x:hover { background: #f0d7d7; color: #b23b3b; }
.acc-addrform { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.acc-empty-line { color: var(--ink-soft); }
.acc-wishgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.acc-empty { text-align: center; padding: 40px 20px; display: grid; gap: 16px; justify-items: center; }
.acc-empty p { color: var(--ink-soft); max-width: 42ch; }
.acc-gate { text-align: center; max-width: 460px; margin: 8vh auto; display: grid; gap: 16px; justify-items: center; }
.acc-gate p { color: var(--ink-soft); }
.acc-gate-cta { display: flex; gap: 12px; margin-top: 8px; }

@media (max-width: 820px) {
  #accountApp { grid-template-columns: 1fr; }
  .acc-side { position: static; grid-template-columns: 1fr; }
  .acc-nav { grid-auto-flow: column; overflow-x: auto; }
  .acc-navlink { white-space: nowrap; }
}

/* ---------------------------------------------- RTL */
[dir="rtl"] .account-menu a, [dir="rtl"] .account-menu button, [dir="rtl"] .acc-navlink { text-align: right; }
[dir="rtl"] .acc-form .btn, [dir="rtl"] .acc-empty { justify-self: start; }

/* +966 split mobile field (KSA pattern) */
.phone-split { display: flex; gap: 8px; }
.phone-cc {
  flex: none; display: inline-flex; align-items: center;
  padding: 0 13px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--powder-2); color: var(--ink); font-weight: 700; font-size: .95rem;
}
.phone-split input { flex: 1; }
