/**
 * Custom Header Styles for Hyva Theme
 */

/* Tajawal Font - Loaded via template in layout/default.xml */

/* Apply Tajawal font globally with maximum specificity */
*,
*::before,
*::after {
    font-family: 'Tajawal', sans-serif !important;
}

html,
body {
    font-family: 'Tajawal', sans-serif !important;
}

body *,
div,
span,
p,
a,
h1, h2, h3, h4, h5, h6,
button,
input,
select,
textarea,
label,
li,
td,
th,
ul,
ol,
dl,
dt,
dd,
blockquote,
pre,
code,
kbd,
samp,
small,
strong,
em,
i,
b,
u,
s,
sub,
sup,
mark,
del,
ins,
abbr,
dfn,
cite,
q,
time,
address,
article,
aside,
footer,
header,
nav,
section,
main,
figure,
figcaption,
table,
thead,
tbody,
tfoot,
tr,
td,
th,
form,
fieldset,
legend,
label,
input,
button,
select,
textarea,
option,
optgroup {
    font-family: 'Tajawal', sans-serif !important;
}

/* Top Bar Styles */
.top-bar {
    display: none;
    background: #f9fafc;
    border-bottom: 1px solid #e5e9f2;
    position: relative;
    width: 100%;
    z-index: 31;
    height: 32px !important;
    max-height: 32px !important;
    min-height: 32px !important;
    line-height: 32px;
    overflow: hidden;
}

@media (min-width: 768px) {
    .top-bar {
        display: block;
        position: relative;
    }
}

.top-bar__wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 32px !important;
    max-height: 32px !important;
    display: flex;
    align-items: center;
}

.header__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* General List Styles (base) */
.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.list--horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.list__item {
    position: relative;
    margin: 0;
    padding: 0;
}

.list__item--right {
    margin-left: auto;
}

.list__item--reverse {
    flex-direction: row-reverse;
}

.list__item--badge {
    position: relative;
}

.list__link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    color: #273444;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s;
}

.list__link:hover {
    color: #1a202c;
}

.list__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon--default {
    width: 16px;
    height: 16px;
}

.icon--default img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.icon--medium {
    width: 24px;
    height: 24px;
}

.icon--medium img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.list__content {
    font-size: 12px;
    line-height: 1.2;
}

.list__content--with-icon {
    display: flex;
    align-items: center;
}

.list__content--bold {
    font-weight: 600;
}

.list__content--ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

/* ========================================
   TOP BAR SPECIFIC STYLES (Scoped)
   ======================================== */
.top-bar .list {
    height: 32px;
}

.top-bar .list--horizontal {
    flex-wrap: nowrap;
    gap: 0.2rem;
    height: 32px;
}

.top-bar .list__item {
    display: flex;
    align-items: center;
    height: 32px;
}

.top-bar .list__link {
    gap: 0.25rem;
    padding: 0.2rem 0.4rem;
    height: 32px;
    white-space: nowrap;
    line-height: 1;
    font-size: 11px;
}

.top-bar .list__link:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.top-bar .icon--default {
    width: 14px;
    height: 14px;
}

.top-bar .list__content {
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
}

/* Dropdown parent positioning */
.dropdown--parent {
    position: relative;
}

.dropdown--parent-countries {
    position: relative;
}

/* Badge */
.badge {
    background: #ef4444;
    color: white;
    border-radius: 9999px;
    padding: 0.15rem 0.45rem;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.list__item--badge .badge {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    margin-left: 0.25rem;
}

.badge.hidden {
    display: none;
}

/* Dropdown Styles */
.dropdown {
    position: absolute;
    top: 100%;
    background: white;
    border: 1px solid #e5e9f2;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px -1px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 100;
    margin-top: 0;
    padding: 0.5rem 0;
}

.dropdown--full {
    width: auto;
    min-width: 220px;
}

.dropdown--left {
    left: 0;
}

.dropdown--center {
    left: 50%;
    transform: translateX(-50%);
}

.dropdown--right {
    right: 0;
    left: auto;
}

.dropdown--countries {
    min-width: 220px;
}

.dropdown__icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.dropdown .list {
    flex-direction: column;
    align-items: stretch;
    height: auto;
}

.dropdown .list__item {
    height: auto;
}

.dropdown .list__item--icon {
    padding: 0;
}

.dropdown .list__link {
    padding: 0.6rem 1rem;
    height: auto;
    gap: 0.75rem;
}

.list__item--hover:hover {
    background-color: #f7fafc;
}

.list__item--divided {
    border-bottom: 1px solid #e5e9f2;
}

.list__item--divided:last-child {
    border-bottom: none;
}

.list__item--logout .list__link {
    color: #dc2626;
}

.list__item--logout:hover {
    background-color: #fef2f2;
}

/* Header Main Styles */
.header {
    position: relative;
    background: white;
    border-bottom: 1px solid #e5e9f2;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    font-family: 'Tajawal', sans-serif !important;
}

/* Ensure all header elements use Tajawal font */
.header *,
.header__container *,
.header__wrapper *,
.header__main *,
.header__buttons *,
.header__search-wrapper *,
.preference-select-bar *,
.logo,
.menu-icon {
    font-family: 'Tajawal', sans-serif !important;
}

.header--fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    width: 100%;
}

.header__main {
    padding: 0.75rem 0;
    min-height: 60px;
    display: flex;
    align-items: center;
}

/* Main Header Icon Sizes (not top bar) */
.header__main .icon--default {
    width: 24px;
    height: 24px;
}

.header__main .list__icon {
    width: 24px;
    height: 24px;
}

.header__wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
    justify-content: space-between;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

@media (min-width: 768px) {
    .header--fixed .header__wrapper {
        flex-direction: row;
        align-items: center;
        min-height: 60px;
    }
    
    .header__wrapper {
        max-width: 1200px;
    }
}

.header__wrapper--mobile {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .header__wrapper--mobile {
        display: none;
    }
}

/* Mobile Header Top Row */
.header__mobile-top {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    position: relative;
}

@media (max-width: 480px) {
    .header__mobile-top {
        gap: 0.25rem;
    }
}

.header__mobile-top .menu-icon {
    flex-shrink: 0;
    width: 40px;
    order: 1;
}

.header__mobile-top .header__buttons--mobile {
    flex-shrink: 0;
    width: 40px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-left: auto;
    order: 3;
}

.header__mobile-top .header__buttons--mobile .bottom-bar__item {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo--mobile-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    order: 2;
}

/* Mobile Search Box (Below) */
.header__mobile-search {
    width: 100%;
    display: block;
    padding: 0 0.5rem;
}

@media (max-width: 480px) {
    .header__mobile-search {
        padding: 0 0.25rem;
    }
}

@media (min-width: 768px) {
    .header__mobile-search {
        display: none;
    }
}

/* Mobile Categories */
.header__categories--mobile {
    flex-shrink: 0;
    display: block;
    min-width: 0;
}

@media (max-width: 480px) {
    .header__categories--mobile {
        display: none;
    }
}

@media (min-width: 768px) {
    .header__categories--mobile {
        display: none;
    }
}

.header__search-wrapper--mobile {
    width: 100%;
    max-width: 100%;
    padding: 0 0.5rem;
}

@media (max-width: 480px) {
    .header__search-wrapper--mobile {
        padding: 0 0.25rem;
    }
}

/* Desktop Header Layout */
.header__wrapper--desktop {
    display: none !important;
    align-items: center;
    gap: 1rem;
    width: 100%;
    position: relative;
}

@media (min-width: 768px) {
    .header__wrapper--desktop {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        max-width: 100%;
        position: relative;
    }
}

.logo--desktop {
    flex-shrink: 0;
    order: 1;
}

.header__categories {
    flex-shrink: 0;
    min-width: 200px;
    order: 2;
    margin-left: 1rem;
}

.header__search-wrapper--desktop {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    z-index: 1;
    order: 3;
}

.header__search-wrapper--desktop > * {
    width: 100%;
    max-width: 600px;
}

.header__buttons--desktop {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    order: 4;
    margin-left: auto;
}

.header__cart-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
}

.header__cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.header__cart-icon-wrapper .icon--red-cart,
.header__cart-icon-wrapper .icon--gray-cart {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
}

.header__cart-icon-wrapper .icon--gray-cart {
    display: block;
}

.header__cart-icon-wrapper .icon--red-cart {
    display: none;
}

.header__cart-button:hover .header__cart-icon-wrapper .icon--gray-cart,
.header__cart-button:active .header__cart-icon-wrapper .icon--gray-cart {
    display: none;
}

.header__cart-button:hover .header__cart-icon-wrapper .icon--red-cart,
.header__cart-button:active .header__cart-icon-wrapper .icon--red-cart {
    display: block;
}

.header__cart-icon-wrapper .badge {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    padding: 0 4px;
    z-index: 1;
}

/* Logo Styles */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .logo {
        min-width: 24px;
    }
}

.logo__image {
    height: auto;
}

.logo__image--mobile {
    width: 120px;
    height: auto;
    max-height: 24px;
}

@media (max-width: 480px) {
    .logo__image--mobile {
        width: 100px;
        max-height: 20px;
    }
}

.logo__image--desktop {
    width: 200px;
    height: 32px;
}

@media (max-width: 767px) {
    .logo__image--desktop {
        display: none;
    }
}

@media (min-width: 768px) {
    .logo__image--mobile {
        display: none;
    }
}

/* Menu Icon */
.menu-icon {
    display: block;
    cursor: pointer;
}

@media (min-width: 768px) {
    .menu-icon {
        display: none;
    }
}

.menu-icon--container {
    padding: 0.5rem;
}

@media (max-width: 480px) {
    .menu-icon--container {
        padding: 0.375rem;
    }
}

.menu-icon__wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Header Flex */
.header-flex {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

@media (max-width: 480px) {
    .header-flex {
        gap: 0.25rem;
    }
}

.header-flex__item {
    flex: 1;
    min-width: 0;
}

/* Preference Page */
.preference-page {
    display: flex;
    align-items: center;
}

.preference-select-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.preference-select-bar__title {
    margin: 0;
    font-size: 14px;
    color: #273444;
}

.fw-600 {
    font-weight: 600;
}

.ml4 {
    margin-left: 0.5rem;
}

/* Search Wrapper */
.header__search-wrapper {
    flex: 1;
    max-width: 600px;
    min-width: 0;
}

@media (max-width: 767px) {
    .header__search-wrapper {
        max-width: 100%;
    }
}

/* Header Buttons */
.header__buttons {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header__buttons--mobile {
    display: block;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .header__buttons--mobile {
        display: none;
    }
}

.bottom-bar__item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.bottom-bar__icon--primary__wrapper {
    position: relative;
}

.bottom-bar__icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.bottom-bar__icon--empty .badge {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
}

.icon--red-cart,
.icon--gray-cart {
    width: 24px;
    height: 24px;
    position: absolute;
    top: 0;
    left: 0;
}

.icon--gray-cart {
    display: block;
}

.icon--red-cart {
    display: none;
}

.bottom-bar__item:hover .icon--gray-cart,
.bottom-bar__item:active .icon--gray-cart {
    display: none;
}

.bottom-bar__item:hover .icon--red-cart,
.bottom-bar__item:active .icon--red-cart {
    display: block;
}

/* Header Placeholder */
/* Header Placeholder - accounts for fixed header height */
/* Desktop: 32px (top-bar) + 60px (main header) = 92px */
/* Mobile: ~115px (header + search) */
.header__placeholder {
    margin-top: 115px;
}

@media (min-width: 768px) {
    .header__placeholder {
        margin-top: 92px;
    }
}

.hide-print {
    display: block;
}

@media print {
    .hide-print {
        display: none;
    }
}

/* Utility Classes */
.d-flex {
    display: flex;
}

.hidden {
    display: none;
}

.hidden-xs {
    display: none;
}

@media (min-width: 576px) {
    .hidden-xs {
        display: block;
    }
}

.hidden-sm {
    display: none;
}

@media (min-width: 768px) {
    .hidden-sm {
        display: block;
    }
}

.hidden-md {
    display: block;
}

@media (min-width: 992px) {
    .hidden-md {
        display: none;
    }
}

.hidden-lg {
    display: block;
}

@media (min-width: 1200px) {
    .hidden-lg {
        display: none;
    }
}

.hidden-xl {
    display: block;
}

@media (min-width: 1400px) {
    .hidden-xl {
        display: none;
    }
}

/* Search Dropdown */
.search-form__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e9f2;
    border-top: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 40;
    max-height: 500px;
    overflow-y: auto;
}

.search-form__dropdown--desktop {
    display: none;
}

@media (min-width: 768px) {
    .search-form__dropdown--desktop {
        display: block;
    }
}

/* Link Styles */
.link {
    text-decoration: none;
    color: #273444;
    transition: color 0.2s;
}

.link:hover {
    color: #1a202c;
}

