/* Gulf Pharmacy header + search (scoped .gp-*). Tokens: common.css :root */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', system-ui, sans-serif; color: var(--gp-text); background: var(--gp-page-bg); }
.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* HEADER */
.gp-header { display: flex; flex-direction: column; background: var(--gp-bg); border-bottom: 1px solid var(--gp-border); position: sticky; top: 0; z-index: 1000; box-shadow: 0 1px 8px rgba(15,23,42,.06); }
.gp-header-inner {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 24px);
    height: var(--gp-header-h);
    width: 100%;
}
.gp-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
    text-decoration: none;
    min-width: 0;
}
.gp-logo-img {
    height: clamp(36px, 5vw, 48px);
    width: auto;
    max-width: min(220px, 52vw);
    object-fit: contain;
    object-position: left center;
    display: block;
}
.gp-logo-text { font-size: 22px; font-weight: 800; color: var(--gp-primary); letter-spacing: -0.5px; }
.gp-nav { margin-left: 0; flex: 1 1 auto; min-width: 0; }
.gp-nav-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.gp-nav-link { display: block; padding: 8px 14px; color: var(--gp-text); text-decoration: none; font-size: 15px; font-weight: 500; border-radius: 8px; transition: background .2s, color .2s; white-space: nowrap; }
.gp-nav-link:hover { background: #f0fdfa; color: var(--gp-primary); }
.gp-nav-has-dropdown { position: relative; }
.gp-dropdown { display: none; position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid var(--gp-border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.12); min-width: 200px; padding: 8px; list-style: none; margin: 4px 0 0; z-index: 200; }
.gp-nav-has-dropdown:hover .gp-dropdown { display: block; }
.gp-dropdown-link { display: block; padding: 8px 12px; color: var(--gp-text); text-decoration: none; font-size: 14px; border-radius: 8px; transition: background .15s; }
.gp-dropdown-link:hover { background: #f0fdfa; color: var(--gp-primary); }
.gp-caret { font-size: 11px; }
.gp-header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: 0 0 auto; }
.gp-icon-btn { position: relative; display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px; border: none; background: transparent; color: var(--gp-text); cursor: pointer; transition: background .2s, color .2s; text-decoration: none; }
.gp-icon-btn:hover { background: #f0fdfa; color: var(--gp-primary); }
.gp-badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; background: var(--gp-accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px; display: flex; align-items: center; justify-content: center; padding: 0 4px; pointer-events: none; }

/* PROFILE DROPDOWN */
.gp-profile-wrap { position: relative; }
.gp-profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid var(--gp-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15,23,42,.12);
    min-width: 240px;
    padding: 8px;
    z-index: 1050;
    animation: gp-fade-in .2s ease;
}
.gp-profile-wrap:hover .gp-profile-dropdown,
.gp-profile-wrap:focus-within .gp-profile-dropdown { display: block; }

.gp-profile-greet { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; margin-bottom: 6px; }
.gp-profile-greet-line1 { font-size: 12px; color: var(--gp-muted); margin: 0; }
.gp-profile-greet-line2 { font-size: 15px; font-weight: 700; color: var(--gp-text); margin: 2px 0 0; }

.gp-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--gp-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: background .15s, color .15s;
}
.gp-profile-link:hover { background: #f0fdfa; color: var(--gp-primary); }
.gp-profile-link svg { color: var(--gp-muted); transition: color .15s; }
.gp-profile-link:hover svg { color: var(--gp-primary); }

.gp-profile-divider { height: 1px; background: #f1f5f9; margin: 6px 0; }
.gp-profile-signout { color: #dc2626; }
.gp-profile-signout:hover { background: #fef2f2; color: #b91c1c; }
.gp-profile-signout:hover svg { color: #b91c1c; }

@keyframes gp-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
/* Desktop: search row hidden until opened */
.gp-search-bar { display: none; background: var(--gp-bg); border-top: 1px solid var(--gp-border); padding: 12px 0; }
.gp-header.gp-search-open .gp-search-bar { display: block; }
.gp-search-form { display: flex; align-items: stretch; }
.gp-search-field { position: relative; flex: 1; min-width: 0; }
.gp-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gp-muted); display: inline-flex; pointer-events: none; }
.gp-search-input { width: 100%; border: 1px solid var(--gp-border); border-radius: 10px; padding: 10px 88px 10px 42px; font-size: 15px; outline: none; transition: border-color .2s, box-shadow .2s; background: #fff; min-height: 44px; }
.gp-search-input:focus { border-color: var(--gp-primary); box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
.gp-search-voice { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: none; background: transparent; color: var(--gp-muted); cursor: pointer; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0; }
.gp-search-voice:hover { background: #f1f5f9; color: var(--gp-primary); }
.gp-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: none; background: transparent; color: var(--gp-muted); font-size: 22px; line-height: 1; cursor: pointer; border-radius: 50%; padding: 0; }
.gp-search-clear:hover { background: #f1f5f9; color: var(--gp-text); }
/* Suggestions dropdown */
.gp-suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--gp-border); border-radius: 12px; box-shadow: 0 16px 40px rgba(15,23,42,.14); z-index: 1100; max-height: 70vh; overflow: hidden; display: flex; flex-direction: column; }
.gp-suggest-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; max-height: calc(70vh - 48px); -webkit-overflow-scrolling: touch; }
.gp-suggest-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--gp-text); transition: background .15s; min-height: 44px; }
.gp-suggest-item:hover, .gp-suggest-item.is-active { background: #f0fdfa; }
.gp-suggest-thumb { width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; background: #f1f5f9; object-fit: cover; }
.gp-suggest-body { flex: 1; min-width: 0; }
.gp-suggest-name { font-size: 14px; font-weight: 500; line-height: 1.3; margin: 0 0 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gp-suggest-name mark { background: #fff3a3; color: inherit; padding: 0 1px; border-radius: 2px; }
.gp-suggest-price { font-size: 13px; color: var(--gp-primary); font-weight: 700; }
.gp-suggest-mrp { font-size: 12px; color: var(--gp-muted); text-decoration: line-through; margin-left: 6px; font-weight: 400; }
.gp-suggest-empty { padding: 18px 16px; text-align: center; color: var(--gp-muted); font-size: 14px; }
.gp-suggest-meta { list-style: none; margin: 0; padding: 10px 12px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--gp-muted); }
.gp-suggest-chip { width: calc(100% - 8px); margin: 2px 4px; text-align: left; border: none; background: transparent; padding: 10px 12px; font-size: 14px; cursor: pointer; border-radius: 8px; color: var(--gp-text); font-family: inherit; }
.gp-suggest-chip:hover { background: #f0fdfa; color: var(--gp-primary); }
.gp-suggest-loading { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px; color: var(--gp-muted); font-size: 13px; }
.gp-suggest-spinner { width: 14px; height: 14px; border: 2px solid #e2e8f0; border-top-color: var(--gp-primary); border-radius: 50%; animation: gp-spin .8s linear infinite; }
@keyframes gp-spin { to { transform: rotate(360deg); } }
.gp-hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; border-radius: 8px; }
.gp-hamburger span { display: block; width: 22px; height: 2px; background: var(--gp-text); border-radius: 2px; transition: .3s; }
@media (max-width: 768px) {
    #gp-search-toggle { display: none !important; }
    .gp-search-bar { display: block !important; border-top: none; padding: 0 0 12px; }
    .gp-header-inner { height: auto; min-height: 56px; padding-top: 10px; padding-bottom: 4px; flex-wrap: wrap; }
    .gp-logo { order: 0; flex: 0 0 auto; max-width: min(180px, 58vw); justify-content: flex-start; }
    .gp-logo-img { max-width: 100%; }
    .gp-header-actions { order: 1; margin-left: auto; flex: 0 0 auto; }
    .gp-header .container { width: 100%; }
    .gp-search-bar .container { padding-left: 16px; padding-right: 16px; }
    .gp-hamburger { display: flex; }
    /* Full header includes search row — drawer starts below it */
    .gp-nav {
        order: 3;
        display: none;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: 132px;
        background: #fff;
        z-index: 900;
        overflow-y: auto;
        flex-direction: column;
        margin-left: 0;
    }
    .gp-nav.open { display: flex; }
    .gp-nav-list { flex-direction: column; padding: 20px; gap: 4px; }
    .gp-nav-link { font-size: 17px; padding: 12px 16px; }
    .gp-dropdown { display: none !important; }
    .gp-suggest { max-height: 75vh; }
    .gp-suggest-list { max-height: calc(75vh - 48px); }
    .gp-suggest-item { padding: 10px; }
    .gp-suggest-thumb { width: 48px; height: 48px; }
}
