/* ─────────────────────────────────────────────────────────────────
   Header popups + the trigger that opens them.

   Shared between the storefront home (index.blade.php) and the
   product page (product_page.blade.php). The CSS used to live as
   an inline <style> block inside index only, so the product page
   rendered the same popup HTML but with no styling — clicking the
   profile icon "opened" the popup invisibly and the icon itself
   was unstyled. Lifting it into a component file fixes both.

   Currently contains the profile popup + the .nav-profile-trigger
   button styling. The search popup styles still live inline inside
   index.blade.php and can move here later if the product page
   needs them too.
   ───────────────────────────────────────────────────────────────── */

/* ════════ Profile popup — matches the search-overlay aesthetic ════════ */
.store-profile-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    opacity: 0;
    transition: opacity 0.28s ease;
}
.store-profile-popup.is-open {
    display: flex;
    opacity: 1;
}
.store-profile-popup__close {
    position: absolute;
    top: 24px;
    inset-inline-end: 24px;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.25s cubic-bezier(0.4,0,0.2,1);
}
.store-profile-popup__close:hover {
    background: rgba(255,255,255,0.22);
    transform: rotate(90deg);
}
.store-profile-popup__card {
    max-width: 460px;
    width: 100%;
    background: #fff;
    border-radius: 22px;
    padding: 36px 28px 28px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
    animation: profile-pop-in 0.42s cubic-bezier(0.22,0.61,0.36,1) both;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
@keyframes profile-pop-in {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* Head */
.store-profile-popup__head {
    text-align: center;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 22px;
}
.store-profile-popup__avatar {
    width: 84px; height: 84px;
    margin: 0 auto 14px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #111 0%, #3a3a3a 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 22px rgba(0,0,0,0.18);
}
.store-profile-popup__avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.store-profile-popup__avatar-letter {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}
.store-profile-popup__hero-icon {
    width: 76px; height: 76px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #111;
    border: 1px solid rgba(0,0,0,0.06);
}
.store-profile-popup__name {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: #0e1015;
    letter-spacing: -0.01em;
    line-height: 1.25;
}
.store-profile-popup__email {
    margin: 6px 0 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
}

/* Actions */
.store-profile-popup__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.store-profile-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: #fafaf9;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 14px;
    cursor: pointer;
    text-align: start;
    text-decoration: none;
    color: #0e1015;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.store-profile-tile:hover {
    background: #f3f4f6;
    border-color: rgba(0,0,0,0.12);
    transform: translateY(-1px);
    text-decoration: none;
    color: #0e1015;
}
.store-profile-tile:active { transform: translateY(0); }
.store-profile-tile__icon {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: #fff;
    color: #111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.06);
}
.store-profile-tile__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.store-profile-tile__label {
    font-size: 14.5px;
    font-weight: 600;
    color: #0e1015;
    letter-spacing: -0.005em;
    line-height: 1.25;
}
.store-profile-tile__hint {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.3;
}
.store-profile-tile__chev {
    color: #9ca3af;
    flex-shrink: 0;
    display: inline-flex;
    transition: transform 0.15s, color 0.15s;
}
[dir="rtl"] .store-profile-tile__chev { transform: scaleX(-1); }
.store-profile-tile:hover .store-profile-tile__chev {
    color: #111;
    transform: translateX(2px);
}
[dir="rtl"] .store-profile-tile:hover .store-profile-tile__chev {
    transform: scaleX(-1) translateX(2px);
}

/* Primary CTA (logged-out: Sign in) — same dark filled style as the cart
   primary button so the visual language is consistent across the storefront. */
.store-profile-tile.store-profile-tile--primary {
    background: #0e1015;
    border-color: #0e1015;
    color: #fff;
}
.store-profile-tile.store-profile-tile--primary:hover {
    background: #000;
    border-color: #000;
    color: #fff;
}
.store-profile-tile.store-profile-tile--primary .store-profile-tile__icon {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.14);
    color: #fff;
}
.store-profile-tile.store-profile-tile--primary .store-profile-tile__label,
.store-profile-tile.store-profile-tile--primary .store-profile-tile__hint,
.store-profile-tile.store-profile-tile--primary .store-profile-tile__chev {
    color: #fff;
}
.store-profile-tile.store-profile-tile--primary .store-profile-tile__hint {
    color: rgba(255,255,255,0.65);
}

/* Danger (logout) — red accent on the icon, hover reveals the destructive intent */
.store-profile-tile.store-profile-tile--danger { margin-top: 4px; }
.store-profile-tile.store-profile-tile--danger .store-profile-tile__icon {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}
.store-profile-tile.store-profile-tile--danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}
.store-profile-tile.store-profile-tile--danger:hover .store-profile-tile__label {
    color: #b91c1c;
}

/* ════════ Profile trigger button — same visual weight as cart/search ════════ */
.nav-profile-trigger {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0 !important;
    margin: 0 4px !important;
    background: rgba(0,0,0,0.05) !important;
    border: 1px solid rgba(0,0,0,0.07) !important;
    color: var(--text, #1a1a1a) !important;
    text-decoration: none !important;
    box-shadow: none !important;
    flex-shrink: 0;
    cursor: pointer;
    transition: background .18s, color .18s, border-color .18s, transform .15s !important;
    line-height: 1;
}
.nav-profile-trigger:hover {
    background: rgba(0,0,0,0.08) !important;
    border-color: rgba(0,0,0,0.12) !important;
    text-decoration: none !important;
    transform: translateY(-1px);
}
.nav-profile-trigger:active { transform: translateY(0); }
.nav-profile-trigger svg { width: 20px; height: 20px; }
/* Subtle dot when the customer is signed in, so the merchant can see
   the auth state at a glance — same idea as Amazon/Apple do in their nav. */
.nav-profile-trigger.is-auth {
    position: relative;
}
.nav-profile-trigger.is-auth::after {
    content: '';
    position: absolute;
    top: 7px;
    inset-inline-end: 7px;
    width: 8px; height: 8px;
    background: #16a34a;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}

/* Respect body.icon-shape-* (matches cart/search rounding). */
body.icon-shape-rounded .nav-profile-trigger { border-radius: 12px !important; }
body.icon-shape-square  .nav-profile-trigger { border-radius: 4px !important; }
body.icon-shape-flat    .nav-profile-trigger {
    background: transparent !important;
    border-color: transparent !important;
    border-radius: 0 !important;
}

@media (max-width: 640px) {
    .store-profile-popup { padding: 16px; }
    .store-profile-popup__card { padding: 28px 20px 22px; border-radius: 18px; }
    .store-profile-popup__avatar { width: 72px; height: 72px; }
    .store-profile-popup__name { font-size: 17px; }
}

/* ════════ Dark scheme ════════
   When the merchant picks 'כהה' in the builder, html[data-scheme="dark"]
   is set. The popup card, tiles, borders, and text all need an explicit
   dark counterpart — the light defaults above hardcode #fff / #fafaf9
   / #0e1015, none of which adapt on their own. */
html[data-scheme="dark"] .store-profile-popup__card {
    background: #15151b;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55),
                0 0 0 1px rgba(255, 255, 255, 0.04);
}
html[data-scheme="dark"] .store-profile-popup__head {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
html[data-scheme="dark"] .store-profile-popup__name { color: #e8ecf4; }
html[data-scheme="dark"] .store-profile-popup__email { color: #9ca3af; }
html[data-scheme="dark"] .store-profile-popup__avatar {
    background: linear-gradient(135deg, #2a2a33 0%, #4a4a52 100%);
}
html[data-scheme="dark"] .store-profile-popup__hero-icon {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.10);
    color: #e8ecf4;
}
html[data-scheme="dark"] .store-profile-popup__close {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
    color: #e8ecf4;
}
html[data-scheme="dark"] .store-profile-popup__close:hover {
    background: rgba(255, 255, 255, 0.18);
}
/* Tiles — neutral surface, light text, hover lifts to a brighter tint. */
html[data-scheme="dark"] .store-profile-tile {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
    color: #e8ecf4;
}
html[data-scheme="dark"] .store-profile-tile:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: #e8ecf4;
}
html[data-scheme="dark"] .store-profile-tile__icon {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    color: #e8ecf4;
}
html[data-scheme="dark"] .store-profile-tile__label { color: #e8ecf4; }
html[data-scheme="dark"] .store-profile-tile__hint  { color: #9ca3af; }
html[data-scheme="dark"] .store-profile-tile__chev  { color: #6b7280; }
html[data-scheme="dark"] .store-profile-tile:hover .store-profile-tile__chev {
    color: #e8ecf4;
}
/* Primary CTA stays a filled button — but use a lighter fill so it
   still pops against the dark card. */
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--primary {
    background: #e8ecf4;
    border-color: #e8ecf4;
    color: #0e1015;
}
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--primary:hover {
    background: #fff;
    border-color: #fff;
    color: #0e1015;
}
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--primary .store-profile-tile__icon {
    background: rgba(0, 0, 0, 0.10);
    border-color: rgba(0, 0, 0, 0.12);
    color: #0e1015;
}
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--primary .store-profile-tile__label,
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--primary .store-profile-tile__chev {
    color: #0e1015;
}
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--primary .store-profile-tile__hint {
    color: rgba(0, 0, 0, 0.55);
}
/* Danger (logout) — desaturate the red but keep the destructive cue. */
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--danger .store-profile-tile__icon {
    color: #f87171;
    background: rgba(248, 113, 113, 0.10);
    border-color: rgba(248, 113, 113, 0.20);
}
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--danger:hover {
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.25);
}
html[data-scheme="dark"] .store-profile-tile.store-profile-tile--danger:hover .store-profile-tile__label {
    color: #fca5a5;
}
