/* --- Redesigned Homepage Header (Figma Node 2621-80708) --- */

:root {
    --khan-header-padding: 130px;
}

.khan-header-v3 {
    background: #FFFFFF !important; /* home.css: header desktop */
    width: 100%;
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
    z-index: 1020;
    box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.04); /* home.css: header desktop */
    box-sizing: border-box;
}

.khan-header-container {
    max-width: 100%;
    padding-left: var(--khan-header-padding) !important;
    padding-right: var(--khan-header-padding) !important;
    box-sizing: border-box;
}

/* Row 1: Announcement Bar (Handled in nav.blade.php but styled here) */
/* home.css: About / Menu – Readex Pro 300, 12px, line-height 15px, #FFFFFF, capitalize */
.khan-announcement-bar-v3 {
    background: #000000; /* home.css: Header 1 abdullahkhan.ae/Black */
    color: #fff;
    height: 31px; /* home.css: Header 1 */
    padding: 8px 130px; /* home.css: Header 1 */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* Figma: right-aligned */
    font-family: 'Readex Pro', sans-serif;
    font-weight: 300;
    font-size: 12px;
    line-height: 15px;
    letter-spacing: 0.5px;
    text-transform: uppercase; /* Figma: uppercase */
}

/* Figma: "Shop now" is a text link (underline), not a button */
.khan-announcement-bar-v3 a {
    color: #FFFFFF;
    text-decoration: underline;
    margin-left: 5px;
    font-family: inherit;
    font-weight: inherit;
    font-size: inherit;
    background: none !important;
    border: none !important;
    padding: 0 !important;
}

/* Row 2: Main Header Row */
.khan-main-header-row {
    height: 80px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0 38px; /* home.css: Frame 1171276807 gap 38px */
    border-bottom: 1px solid #DEE5ED; /* home.css: Frame 1171276811 */
    transition: box-shadow 0.2s ease;
    min-width: 0; /* allow grid to shrink */
}
.khan-main-header-row > * {
    min-width: 0; /* prevent overflow from flex/grid children */
}

.khan-header-v3.sticky .khan-main-header-row {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Row 2 - Left Section (Logo + Deliver) */
.khan-header-left-v3 {
    display: flex;
    align-items: center;
    gap: 25px;
    justify-self: start;
}

.khan-menu-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.khan-menu-trigger:hover {
    background: #f5f5f5;
    color: #000;
}

.khan-deliver-v3 {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: 'Readex Pro', sans-serif; /* home.css: Deliver to UAE */
    font-size: 12px;
    color: #212121;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.khan-deliver-v3:hover {
    background: #f5f5f5;
    color: #000;
}

/* Dropdown Menu Styles */
.khan-dropdown-wrapper {
    position: relative;
    display: inline-block;
    z-index: 1050;
}

.khan-dropdown-trigger {
    cursor: pointer;
    user-select: none;
}

.khan-dropdown-trigger i.las {
    font-size: 12px;
    margin-left: 4px;
    transition: transform 0.2s ease;
}

.khan-dropdown-wrapper.active .khan-dropdown-trigger i.las {
    transform: rotate(180deg);
}

.khan-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    max-width: 300px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    display: block;
}

.khan-dropdown-wrapper.active .khan-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.khan-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
    color: #333;
}

.khan-dropdown-item:last-child {
    border-bottom: none;
}

.khan-dropdown-item:hover {
    background: #f8f8f8;
    color: #000;
}

.khan-dropdown-item .flag {
    width: 20px;
    height: auto;
    border-radius: 2px;
    flex-shrink: 0;
}

.khan-dropdown-item span {
    flex: 1;
}

.khan-dropdown-item i.las {
    margin-left: auto;
    color: #000;
    font-size: 16px;
}

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

/* RTL Support for Dropdowns */
[dir="rtl"] .khan-dropdown-menu {
    left: auto;
    right: 0;
}

[dir="rtl"] .khan-dropdown-item i.las {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .khan-dropdown-trigger i.las {
    margin-left: 0;
    margin-right: 4px;
}

.khan-deliver-v3 .flag {
    width: 20px;
    height: auto;
    border-radius: 2px;
}

/* Row 2 - Center Section (Search Bar) */
.khan-header-search-center {
    justify-self: center;
    width: 100%;
    max-width: 519px; /* home.css: HNav Search */
    flex: none;
    margin: 0 auto;
}

.khan-search-form {
    width: 100%;
}

.khan-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 519px;
    background: #FAFAFA;
    border: 1px solid #9E9E9E;
    border-radius: 8px;
    height: 38px;
    padding: 8px 16px;
    transition: all 0.2s ease;
}

.khan-search-input-wrapper:focus-within {
    background: #fff;
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.khan-search-icon {
    width: 20px;
    height: 20px;
    color: #666;
    margin-right: 12px;
    flex-shrink: 0;
}

.khan-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Readex Pro', sans-serif; /* home.css: placeholder */
    font-size: 15px; /* home.css: 15px */
    line-height: 22px;
    color: #000;
    width: 100%;
}

.khan-search-input::placeholder {
    color: #757575; /* home.css: Grey/600 placeholder */
}

.khan-logo-main {
    font-family: 'Fine Art Sans Serif', 'Playfair Display', serif; /* home.css: KHAN&CO. */
    font-size: 37px; /* home.css: 36.8073px */
    font-weight: 400;
    letter-spacing: 1px;
    color: #020202; /* home.css: Grey/900 */
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
}

.khan-logo-main:hover {
    opacity: 0.8;
    transform: scale(1.02);
}

.khan-logo-main img {
    transition: transform 0.2s ease;
}

.khan-logo-main:hover img {
    transform: scale(1.05);
}

/* Row 2 - Right Section (Search + Icons) */
.khan-header-right-v3 {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-self: end;
}

.khan-header-icon-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #000;
    font-size: 13px;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

.khan-header-icon-item:hover {
    background: #f5f5f5;
    color: #000;
    transform: translateY(-1px);
}

.khan-header-icon-item img,
.khan-header-icon-item svg {
    width: 15px !important; /* From SVG: width="15" height="15" */
    height: 15px !important;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.khan-header-icon-item:hover img,
.khan-header-icon-item:hover svg {
    transform: scale(1.05);
}

.khan-signin-link {
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Row 3: Category bar – Figma Header 3: h 50px, max-w 1180px; Menu 1161px justify-between */
.khan-nav-row-v3 {
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #f0f0f0;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.khan-nav-links-v3 {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Figma: items spread across full width */
    gap: 16px; /* minimal gap so justify-between spreads links across full width (Figma) */
    width: 100%;
    max-width: 1180px; /* Figma: Header 3 max-w 1180px; inner Menu 1161px */
    min-width: 0;
    margin: 0 auto;
    padding: 0 10px; /* small padding so last/first items don’t touch edges at 1180 */
}

.khan-nav-link-v3 {
    font-family: 'Readex Pro', sans-serif; /* home.css: Menu / Members' sale */
    text-decoration: none;
    color: #424242; /* home.css: Grey/700 */
    font-size: 14px;
    line-height: 18px;
    font-weight: 400;
    text-transform: capitalize; /* home.css: identical to box height, capitalize */
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 4px;
    position: relative;
}

.khan-nav-link-v3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 2px;
    background: #000;
    transition: transform 0.2s ease;
}

.khan-nav-link-v3:hover {
    color: #666;
    background: #f9f9f9;
}

.khan-nav-link-v3:hover::after {
    transform: translateX(-50%) scaleX(1);
}

.khan-nav-link-v3.active {
    color: #ff0000;
    font-weight: 600;
}

.khan-nav-link-v3.active::after {
    background: #ff0000;
    transform: translateX(-50%) scaleX(1);
}

/* Hide old currency/language modal */
#chooseCurrency {
    display: none !important;
    visibility: hidden !important;
}

#chooseCurrency.modal {
    display: none !important;
}

/* Search Modal Improvements */
#order_details.modal {
    z-index: 9999 !important;
}

#order_details.modal.show {
    display: block !important;
    opacity: 1 !important;
}

#order_details.modal.in {
    display: block !important;
}

#order_details .modal-dialog {
    z-index: 10000 !important;
    margin-top: 100px;
    display: block !important;
}

#order_details.modal.show .modal-dialog {
    display: block !important;
}

#order_details .modal-content {
    z-index: 10001 !important;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    background: transparent !important;
}

#order_details .card-body {
    background: transparent !important;
}

#order_details .search-input-box {
    background: #fff !important;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

#order_details .search-input-box input {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 16px;
    padding: 10px 40px 10px 15px;
    width: 100%;
}

#order_details .search-input-box svg {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

#order_details .modal-backdrop,
.modal-backdrop.show {
    z-index: 9998 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    opacity: 0.5 !important;
}

/* Ensure search button is clickable */
.khan-search-trigger,
.khan-header-icon-item[onclick*="show_search_box"] {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Language/Location Modal Improvements */
.khan-location-language-modal .modal-dialog {
    max-width: 500px;
}

.khan-modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.khan-modal-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.khan-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #000;
    margin: 0;
}

.khan-modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    color: #666;
    opacity: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.khan-modal-close:hover {
    background: #f5f5f5;
    color: #000;
}

.khan-modal-body {
    padding: 24px;
    background: #fff;
}

.khan-locale-section {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    transition: all 0.2s;
}

.khan-locale-section:hover {
    border-color: #d0d0d0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.khan-locale-section:last-child {
    margin-bottom: 0;
}

.khan-locale-icon-wrapper {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f8f8;
    border-radius: 8px;
    color: #666;
}

.khan-locale-content {
    flex: 1;
    min-width: 0;
}

.khan-locale-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.khan-locale-select {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    transition: all 0.2s;
}

.khan-locale-select:focus {
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.khan-modal-footer {
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.khan-modal-cancel-btn {
    background: transparent;
    border: 1px solid #e0e0e0;
    color: #666;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.khan-modal-cancel-btn:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
    color: #000;
}

.khan-modal-save-btn {
    background: #000;
    border: 1px solid #000;
    color: #fff;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.khan-modal-save-btn:hover {
    background: #333;
    border-color: #333;
    color: #fff;
}

/* Category Menu Improvements */
.aiz-category-menu .category-nav-element > a {
    font-weight: 500;
    letter-spacing: 0.03em;
    font-size: 14px;
    transition: all 0.2s ease;
}

.aiz-category-menu .category-nav-element > a .cat-name {
    transition: all 0.2s ease;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.aiz-category-menu .category-nav-element:hover > a .cat-name {
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* Responsive Hide/Show */
@media (max-width: 991px) {
    .khan-header-v3 {
        display: none;
    }
    
    .khan-location-language-modal .modal-dialog {
        max-width: 90%;
        margin: 20px auto;
    }
    
    .khan-modal-body {
        padding: 20px;
    }
    
    .khan-locale-section {
        flex-direction: column;
        gap: 12px;
    }
}