/*
 * JA Header v3.2.0 — Frontend CSS
 * Author: Md. Joynal Abedin — joynalar.netlify.app
 */

:root {
    --ja-bg:   #1a1a2e;
    --ja-fg:   #e0e0e0;
    --ja-ac:   #e94560;
    --ja-sbg:  #16213e;
    --ja-rad:  4px;
    --ja-h:    44px;
    --ja-spd:  300ms;
    --ja-push: 0px;
}

body { padding-top: var(--ja-push); }

/* ══════════════════════════════
   BASE
   ══════════════════════════════ */
#ja-header {
    display:    block;
    background: var(--ja-bg);
    color:      var(--ja-fg);
    width:      100%;
    min-height: var(--ja-h);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size:  13px;
    line-height: 1.4;
    box-sizing: border-box;
    z-index:    9999;
    transition: transform var(--ja-spd) ease, opacity var(--ja-spd) ease;
}

#ja-header.ja-sticky { position: sticky; top: 0; }
#ja-header.ja-fixed  { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; }

#ja-header.ja-hide-slide { transform: translateY(-100%); }
#ja-header.ja-hide-fade  { opacity: 0; pointer-events: none; }

#ja-header *, #ja-header *::before, #ja-header *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ══════════════════════════════
   3-ZONE INNER LAYOUT
   ══════════════════════════════ */
#ja-header .ja-inner {
    display:     flex;
    align-items: center;
    max-width:   1400px;
    margin:      0 auto;
    padding:     0 20px;
    height:      var(--ja-h);
    gap:         8px;
    /* NO overflow:hidden — clips search panels */
}

#ja-header .ja-zone {
    display:     flex;
    align-items: center;
    gap:         8px;
}

/* Left zone: grows to fill space */
#ja-header .ja-zone-left {
    flex: 1 1 auto;
    justify-content: flex-start;
    min-width: 0;
}

/* Center zone: shrinks to content, centered */
#ja-header .ja-zone-center {
    flex: 0 0 auto;
    justify-content: center;
}

/* Right zone: shrinks to content, right-aligned */
#ja-header .ja-zone-right {
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
}

/* ── Items ── */
#ja-header .ja-item { display: flex; align-items: center; }

#ja-header .ja-item-address {
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
    color:         var(--ja-fg);
    font-size:     13px;
    min-width:     0;
}

/* ── Links ── */
#ja-header a { color: var(--ja-fg); text-decoration: none; transition: color .2s; }
#ja-header a:hover { color: var(--ja-ac); }

#ja-header .ja-login-link {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 10px; border-radius: var(--ja-rad);
    font-size: 13px; transition: background .2s;
}
#ja-header .ja-login-link:hover { background: rgba(255,255,255,.1); }

#ja-header .ja-lang {
    font-size: 12px; font-weight: 700; letter-spacing: .5px;
    padding: 3px 8px; border-radius: var(--ja-rad);
    background: rgba(255,255,255,.1); cursor: pointer;
}

#ja-header .ja-cart-icon { font-size: 16px; cursor: pointer; }

/* ══════════════════════════════
   SEARCH — shared
   ══════════════════════════════ */
#ja-header .ja-item-search { position: relative; }
#ja-header .ja-search      { display: flex; align-items: center; position: relative; }

#ja-header .ja-sbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: transparent; border: none; border-radius: 50%;
    color: var(--ja-fg); cursor: pointer; padding: 0;
    transition: background .2s, color .2s; flex-shrink: 0;
}
#ja-header .ja-sbtn:hover { background: rgba(255,255,255,.12); color: var(--ja-ac); }
#ja-header .ja-sbtn svg   { width: 16px; height: 16px; display: block; pointer-events: none; }

#ja-header input[type="search"] {
    -webkit-appearance: none; appearance: none;
    outline: none; border: none; background: transparent;
    color: var(--ja-fg); font-family: inherit; font-size: 13px;
}
#ja-header input[type="search"]::-webkit-search-decoration,
#ja-header input[type="search"]::-webkit-search-cancel-button { display: none; }
#ja-header input[type="search"]::placeholder { color: rgba(255,255,255,.4); }
#ja-header button[type="submit"] { font-family: inherit; cursor: pointer; }

/* ── Style 1: Click to expand ── */
#ja-header .s1 { position: relative; }

#ja-header .s1 .ja-s1-panel {
    position: absolute;
    right: 40px; top: 50%;
    transform: translateY(-50%);
    display: flex; align-items: stretch;
    background: var(--ja-sbg);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: var(--ja-rad);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.45);
    z-index: 200; white-space: nowrap;
    visibility: hidden; opacity: 0; pointer-events: none;
    clip-path: inset(0 0 0 100%);
    transition: opacity var(--ja-spd) ease, visibility var(--ja-spd) ease, clip-path var(--ja-spd) ease;
}
#ja-header .s1 .ja-s1-panel.open {
    visibility: visible; opacity: 1; pointer-events: auto;
    clip-path: inset(0 0 0 0%);
}
#ja-header .s1 .ja-s1-panel input[type="search"] { padding: 0 10px; width: 200px; height: 34px; flex-shrink: 0; }
#ja-header .s1 .ja-s1-panel button[type="submit"] {
    background: var(--ja-ac); border: none; color: #fff;
    font-size: 12px; font-weight: 600; padding: 0 14px; height: 34px;
    transition: filter .2s; white-space: nowrap; flex-shrink: 0;
}
#ja-header .s1 .ja-s1-panel button[type="submit"]:hover { filter: brightness(1.15); }

/* ── Style 2: Hover expand ── */
#ja-header .s2 form { display: flex; align-items: center; position: relative; height: 32px; }
#ja-header .s2 input[type="search"] {
    height: 32px; width: 32px; padding: 0 32px 0 0;
    border-radius: 20px; border: 1px solid transparent; background: transparent;
    opacity: 0;
    transition: width .35s ease, opacity .25s ease, background .25s ease, border-color .25s ease, padding .25s ease;
}
#ja-header .s2:hover input[type="search"],
#ja-header .s2 input[type="search"]:focus {
    width: 200px; padding: 0 32px 0 14px;
    background: var(--ja-sbg); border-color: rgba(255,255,255,.18); opacity: 1;
}
#ja-header .s2 .ja-sbtn { position: absolute; right: 0; top: 0; }

/* ── Style 3: Underline ── */
#ja-header .s3 form {
    display: flex; align-items: center; gap: 4px;
    border-bottom: 1.5px solid rgba(255,255,255,.25); padding-bottom: 1px;
    transition: border-color .25s;
}
#ja-header .s3 form:focus-within { border-color: var(--ja-ac); }
#ja-header .s3 input[type="search"] { padding: 3px 0; width: 140px; background: transparent; }
#ja-header .s3 .ja-sbtn { width: 24px; height: 24px; color: rgba(255,255,255,.55); flex-shrink: 0; }
#ja-header .s3 .ja-sbtn:hover { color: var(--ja-ac); background: transparent; }
#ja-header .s3 .ja-sbtn svg { width: 14px; height: 14px; }

/* ── Style 4: Modal ── */
.ja-modal {
    position: fixed; inset: 0;
    background: rgba(10,10,20,.9);
    z-index: 999999;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    animation: jaFadeIn .2s ease;
}
@keyframes jaFadeIn { from { opacity:0 } to { opacity:1 } }

.ja-modal-x {
    position: absolute; top: 20px; right: 24px;
    background: transparent; border: none;
    color: rgba(255,255,255,.7); font-size: 22px; cursor: pointer;
    padding: 6px 8px; border-radius: 4px; line-height: 1;
    transition: color .2s, background .2s; font-family: inherit;
}
.ja-modal-x:hover { color: #fff; background: rgba(255,255,255,.1); }

.ja-modal-form {
    display: flex; align-items: stretch;
    width: 90%; max-width: 680px;
    border-bottom: 2px solid var(--ja-ac); gap: 12px; padding-bottom: 6px;
}
.ja-modal-form input[type="search"] {
    flex: 1; background: transparent; border: none; outline: none;
    color: #fff; font-size: clamp(18px,3.5vw,28px); padding: 8px 0; font-family: inherit;
}
.ja-modal-form input[type="search"]::placeholder { color: rgba(255,255,255,.3); font-size: inherit; }
.ja-modal-form button[type="submit"] {
    background: var(--ja-ac); border: none; color: #fff;
    font-size: 14px; font-weight: 600; padding: 10px 24px;
    border-radius: var(--ja-rad); transition: filter .2s;
    white-space: nowrap; font-family: inherit; align-self: center;
}
.ja-modal-form button[type="submit"]:hover { filter: brightness(1.12); }

/* ── Style 5: Inline ── */
#ja-header .s5 form {
    display: flex; align-items: stretch; height: 32px;
    background: var(--ja-sbg); border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--ja-rad); overflow: hidden;
}
#ja-header .s5 input[type="search"] { padding: 0 10px; width: 160px; height: 100%; background: transparent; }
#ja-header .s5 button[type="submit"] {
    background: var(--ja-ac); border: none; color: #fff;
    font-size: 12px; font-weight: 600; padding: 0 14px;
    height: 100%; white-space: nowrap; transition: filter .2s;
}
#ja-header .s5 button[type="submit"]:hover { filter: brightness(1.15); }

/* ══════════════════════════════
   RESPONSIVE
   ══════════════════════════════ */
@media (max-width:1199px) {
    #ja-header .ja-inner { padding: 0 16px; }
    #ja-header .s5 input[type="search"] { width: 120px; }
}
@media (max-width:768px) {
    #ja-header .ja-inner { padding: 0 12px; gap: 4px; }
    #ja-header .ja-zone  { gap: 4px; }
    #ja-header .ja-item-address { font-size: 12px; }
    #ja-header .s1 .ja-s1-panel input[type="search"] { width: 140px; }
    #ja-header .s2:hover input[type="search"],
    #ja-header .s2 input[type="search"]:focus { width: 140px; }
    #ja-header .s3 input[type="search"] { width: 100px; }
    #ja-header .s5 input[type="search"] { width: 80px; }
    #ja-header .s5 button[type="submit"] { display: none; }
}
@media (max-width:480px) {
    #ja-header .ja-inner { padding: 0 8px; }
    #ja-header .s1 .ja-s1-panel input[type="search"] { width: 110px; }
    #ja-header .s3 input[type="search"] { width: 80px; }
}

/* ── RTL ── */
[dir="rtl"] #ja-header .s1 .ja-s1-panel { right:auto; left:40px; clip-path:inset(0 100% 0 0); }
[dir="rtl"] #ja-header .s1 .ja-s1-panel.open { clip-path:inset(0 0% 0 0); }
[dir="rtl"] #ja-header .s2 .ja-sbtn { right:auto; left:0; }
[dir="rtl"] #ja-header .s2 input[type="search"] { padding: 0 14px 0 32px; }
