/*
 * Vendex Global Styles — loads on ALL pages
 * Contains: announcement bar, header, menu bar, footer, mobile nav, toast
 * Design tokens are output via wp_head in scripts-styles.php
 */

/* ===== BREAK OUT OF THEME WRAPPERS ===== */
.hp-announcement-bar,
.hp-custom-header,
.hp-mobile-footer-nav,
.hp-trust-footer,
.hp-site-footer {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    box-sizing: border-box !important;
}

.hp-custom-header,
.hp-mobile-footer-nav,
.hp-announcement-bar,
.hp-trust-footer,
.hp-site-footer {
    font-family: "IBM Plex Sans Arabic", "Cairo", sans-serif;
}

/* ========================================
   ANNOUNCEMENT BAR
   ======================================== */
.hp-announcement-bar {
    background: #00184a;
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    padding: 9px 0;
    font-size: 13px;
    font-weight: 500;
    direction: ltr;
}

.hp-announcement-track {
    display: inline-flex;
    animation: hp-marquee 35s linear infinite;
    width: max-content;
}

.hp-announcement-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 50px;
    direction: rtl;
}

.hp-announcement-item svg {
    width: 14px !important;
    height: 14px !important;
    min-width: 14px;
    min-height: 14px;
    flex-shrink: 0;
    fill: #FF6B00;
}

@keyframes hp-marquee {
    0%   { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}

/* ========================================
   CUSTOM HEADER
   ======================================== */
.hp-custom-header {
    background: #fff;
    border-bottom: 1px solid #E5E5E5;
    position: relative;
    z-index: 100;
}

.hp-header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 40px;
    max-width: 1400px;
    margin: 0 auto;
    gap: 25px;
}

.hp-header-logo {
    flex: 0 0 auto;
    order: 1;
}
.hp-header-logo img {
    height: 58px;
    width: auto;
    display: block;
}
.hp-header-logo a {
    display: block;
    text-decoration: none;
}

/* Search */
.hp-header-search {
    flex: 1;
    max-width: 500px;
    order: 2;
    position: relative;
}
.hp-header-search-input {
    width: 100%;
    padding: 16px 50px 16px 25px;
    border: 2px solid #FF6B00;
    border-radius: 30px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s;
    direction: rtl;
    background: rgba(255,107,0,0.04);
    box-shadow: 0 0 0 4px rgba(255,107,0,0.08);
    box-sizing: border-box;
}
.hp-header-search-input:focus {
    border-color: #FF6B00;
    background: #fff;
    box-shadow: 0 0 0 5px rgba(255,107,0,0.15);
}
.hp-header-search-input::placeholder { color: #666; }

.hp-header-search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #666;
    pointer-events: none;
}

.hp-header-search-clear {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    display: none;
}
.hp-header-search-clear:hover { color: #333; }

/* Cart */
.hp-header-cart {
    flex: 0 0 auto;
    order: 3;
    position: relative;
}
.hp-header-cart a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #F7F4EF;
    color: #00184a;
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
}
.hp-header-cart a:hover {
    background: #FF6B00;
    color: #fff;
}
.hp-header-cart svg { width: 22px; height: 22px; }

.hp-header-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF6B00;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ===== CART PREVIEW DROPDOWN ===== */
.hp-cart-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: auto;
    width: min(340px, 90vw);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 200;
    direction: rtl;
    overflow: hidden;
    border: 1px solid #E5E5E5;
}
.hp-cart-dropdown.hp-open {
    display: block;
    animation: hp-dropdown-in 0.2s ease;
}

@keyframes hp-dropdown-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hp-cart-dropdown-header {
    padding: 14px 18px;
    border-bottom: 1px solid #E5E5E5;
    font-weight: 700;
    font-size: 15px;
    color: #00184a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hp-cart-dropdown-header span { font-size: 12px; font-weight: 500; color: #666; }

.hp-cart-dropdown-items {
    max-height: 280px;
    overflow-y: auto;
    padding: 8px 0;
    scrollbar-width: thin;
}
.hp-cart-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    transition: background 0.15s;
}
.hp-cart-dropdown-item:hover { background: #F7F4EF; }
.hp-cart-dropdown-item img {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #E5E5E5;
}
.hp-cart-dropdown-item-info { flex: 1; min-width: 0; }
.hp-cart-dropdown-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}
.hp-cart-dropdown-item-meta { font-size: 12px; color: #666; }
.hp-cart-dropdown-item-price { font-size: 14px; font-weight: 700; color: #FF6B00; white-space: nowrap; }

.hp-cart-dropdown-empty {
    padding: 30px 18px;
    text-align: center;
    color: #666;
    font-size: 14px;
}
.hp-cart-dropdown-empty svg {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    opacity: 0.4;
    stroke: currentColor;
    fill: none;
}

.hp-cart-dropdown-footer {
    padding: 14px 18px;
    border-top: 1px solid #E5E5E5;
}
.hp-cart-dropdown-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 700;
    color: #00184a;
}
.hp-cart-dropdown-total .hp-cart-total-amount { color: #FF6B00; font-size: 17px; }
.hp-cart-dropdown-btn,
a.hp-cart-dropdown-btn {
    display: block !important;
    width: 100% !important;
    padding: 14px 32px !important;
    background: linear-gradient(135deg, #FF8C00, #FF6B00) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 999px !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    font-family: "IBM Plex Sans Arabic", "Cairo", sans-serif !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    letter-spacing: 0.02em !important;
    box-shadow: 0 4px 14px rgba(255,107,0,0.35) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    box-sizing: border-box !important;
}
.hp-cart-dropdown-btn:hover,
.hp-cart-dropdown-btn:visited,
.hp-cart-dropdown-btn:focus,
a.hp-cart-dropdown-btn:hover {
    color: #fff !important;
    text-decoration: none !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 22px rgba(255,107,0,0.45) !important;
    background: linear-gradient(135deg, #FF8C00, #FF6B00) !important;
}

/* ===== SEARCH DROPDOWN ===== */
.hp-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 200;
    direction: rtl;
    overflow: hidden;
    border: 1px solid #E5E5E5;
}
.hp-search-dropdown.hp-open {
    display: block;
    animation: hp-dropdown-in 0.2s ease;
}

.hp-search-dropdown-items {
    max-height: 340px;
    overflow-y: auto;
    padding: 6px 0;
    scrollbar-width: thin;
}
.hp-search-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    transition: background 0.15s;
}
.hp-search-dropdown-item:hover { background: #F7F4EF; }
.hp-search-dropdown-item img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #E5E5E5;
}
.hp-search-dropdown-item-info { flex: 1; min-width: 0; }
.hp-search-dropdown-item-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hp-search-dropdown-item-price { font-size: 13px; font-weight: 700; color: #FF6B00; margin-top: 2px; }

.hp-search-dropdown-empty {
    padding: 25px 16px;
    text-align: center;
    color: #666;
    font-size: 13px;
}
.hp-search-dropdown-loading {
    padding: 20px;
    text-align: center;
}
.hp-search-dropdown-loading::after {
    content: "";
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2px solid #E5E5E5;
    border-radius: 50%;
    border-top-color: #FF6B00;
    animation: hp-spin 0.8s linear infinite;
}
@keyframes hp-spin { to { transform: rotate(360deg); } }

.hp-search-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid #E5E5E5;
    text-align: center;
}
.hp-search-dropdown-viewall {
    display: inline-block;
    padding: 8px 24px;
    background: #00184a;
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}
.hp-search-dropdown-viewall:hover { background: #002266; color: #fff; }
.hp-search-dropdown-count { font-size: 12px; color: #666; margin-bottom: 8px; }

/* ========================================
   MENU BAR
   ======================================== */
.hp-menu-bar {
    background: #00184a;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.hp-menu-bar::-webkit-scrollbar { display: none; }
.hp-menu-bar ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
    direction: rtl;
    gap: 0;
}
.hp-menu-bar li a {
    display: block;
    padding: 16px 34px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}
.hp-menu-bar li a:hover,
.hp-menu-bar li.current-menu-item a {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-bottom-color: #FF6B00;
}

/* ========================================
   TRUST FOOTER
   ======================================== */
.hp-trust-footer {
    background: #00184a;
    padding: 50px 30px;
}
.hp-trust-badges {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}
.hp-trust-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 25px 15px;
    background: rgba(255,255,255,0.06);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s;
}
.hp-trust-badge:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-3px);
}
.hp-trust-badge-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,107,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}
.hp-trust-badge-icon svg { width: 26px; height: 26px; fill: #FF6B00; }
.hp-trust-badge-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    direction: rtl;
}
.hp-trust-badge-desc {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    direction: rtl;
}

/* ========================================
   SITE FOOTER
   ======================================== */
.hp-site-footer {
    background: #001030;
    color: rgba(255,255,255,0.7);
    direction: rtl;
    padding: 40px 30px 20px;
}
.hp-footer-content {
    display: flex;
    gap: 60px;
    justify-content: center;
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.hp-footer-col h4 { color: #fff; font-size: 16px; font-weight: 700; margin: 0 0 12px; }
.hp-footer-col ul { list-style: none; margin: 0; padding: 0; }
.hp-footer-col ul li { margin-bottom: 8px; }
.hp-footer-col ul li a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
.hp-footer-col ul li a:hover { color: #FF6B00; }
.hp-footer-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding-top: 20px;
    font-size: 13px;
    color: rgba(255,255,255,0.4);
}
.hp-footer-bottom span:first-child {
    font-weight: 700;
    color: rgba(255,255,255,0.6);
}

/* ========================================
   TOAST NOTIFICATION
   ======================================== */
.hp-added-notice {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #00184a;
    color: #fff;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    direction: rtl;
    font-family: "IBM Plex Sans Arabic", "Cairo", sans-serif;
}
.hp-added-notice.hp-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ========================================
   MOBILE FOOTER NAV (hidden on desktop)
   ======================================== */
.hp-mobile-footer-nav { display: none; }

/* ========================================
   RESPONSIVE — 1080px
   ======================================== */
@media (max-width: 1080px) {
    .hp-announcement-bar,
    .hp-custom-header,
    .hp-mobile-footer-nav,
    .hp-trust-footer,
    .hp-site-footer {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
    }

    .hp-trust-badges {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   RESPONSIVE — 768px (mobile)
   ======================================== */
@media (max-width: 768px) {
    .hp-announcement-bar {
        font-size: 12px;
        padding: 6px 0;
    }

    /* Mobile header */
    .hp-header-main {
        padding: 10px 12px;
        gap: 10px;
    }
    .hp-header-logo img { height: 35px; }

    /* Mobile cart & search dropdowns */
    .hp-cart-dropdown {
        width: calc(100vw - 24px);
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%);
        max-width: 360px;
    }
    .hp-cart-dropdown-items { max-height: 220px; }
    .hp-search-dropdown-items { max-height: 260px; }
    .hp-header-search-input {
        padding: 10px 40px 10px 15px;
        font-size: 13px;
    }

    .hp-menu-bar ul {
        justify-content: flex-start;
        padding: 0 10px;
    }
    .hp-menu-bar li a {
        padding: 8px 14px;
        font-size: 12px;
    }

    /* Trust badges mobile */
    .hp-trust-footer {
        padding: 30px 12px;
    }
    .hp-trust-badges {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .hp-trust-badge { padding: 18px 10px; }
    .hp-trust-badge-icon { width: 44px; height: 44px; margin-bottom: 10px; }
    .hp-trust-badge-icon svg { width: 22px; height: 22px; }
    .hp-trust-badge-title { font-size: 14px; }
    .hp-trust-badge-desc { font-size: 11px; }

    /* Footer mobile */
    .hp-footer-content {
        flex-direction: column;
        gap: 30px;
        text-align: center;
        padding: 0 20px 20px;
    }
    .hp-site-footer {
        padding: 30px 15px 90px;
    }

    /* Sticky mobile footer nav */
    .hp-mobile-footer-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        border-top: 1px solid #E5E5E5;
        z-index: 9990;
        padding: 8px 0 0;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
        box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
        transition: opacity 0.3s, transform 0.3s;
        font-family: "IBM Plex Sans Arabic", "Cairo", sans-serif;
    }
    .hp-mobile-footer-nav::after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 100px;
        background: #fff;
        z-index: -1;
        transform: translateY(100%);
    }
    .hp-mobile-footer-nav.hp-nav-hidden {
        opacity: 0;
        transform: translateY(100%);
        pointer-events: none;
    }
    .hp-mobile-footer-nav a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #666;
        font-size: 10px;
        font-weight: 600;
        gap: 3px;
        transition: color 0.2s;
        position: relative;
    }
    .hp-mobile-footer-nav a.hp-active,
    .hp-mobile-footer-nav a:hover {
        color: #FF6B00;
    }
    .hp-mobile-footer-nav svg {
        width: 24px;
        height: 24px;
    }
    .hp-mobile-nav-badge {
        position: absolute;
        top: -2px;
        right: calc(50% - 18px);
        background: #FF6B00;
        color: #fff;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        font-size: 9px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Move toast above mobile nav */
    .hp-added-notice { bottom: 80px; }
}
