/* Location: /www/wwwroot/thaipetmarket.com/platform/modules/Frontend/Header/Resources/css/header.css */

/* ============================================================================
   TOP NAVIGATION BAR - 25px height
   ============================================================================ */
#topNavigationBar {
    width: 100%;
    height: 25px;
    background: #EFF0F5;
    position: relative;
    z-index: 101;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

#topNavigationBar.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
}

#topNavigationBar .nav-container {
    max-width: 1200px;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

#topNavigationBar .nav-items-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

#topNavigationBar .nav-items-right {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    position: absolute;
    right: 0;
    padding-right: 0;
    white-space: nowrap;
}

#topNavigationBar .nav-link {
    color: #4a5568;
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    padding: 0 8px;
    height: 100%;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

#topNavigationBar .nav-link:hover {
    color: #2d3748;
}

#topNavigationBar .nav-link.active {
    color: #805ad5;
    font-weight: 500;
}

#topNavigationBar .nav-link i {
    margin-right: 3px;
    font-size: 10px;
}

/* ============================================================================
   MAIN HEADER - 65px height
   ============================================================================ */
.main-header {
    width: 100% !important;
    height: 65px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 100;
    left: 0;
    right: 0;
}

.main-header.sticky {
    position: fixed;
    top: 25px;
    left: 0;
    right: 0;
    width: 100% !important;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    align-items: center;
    height: 100%;
}

/* ============================================================================
   LOGO SECTION
   ============================================================================ */
.header-logo {
    display: flex;
    align-items: center;
    justify-self: start;
    position: relative;
    top: -3px;
}

.header-logo .nav-link {
    display: block;
    cursor: pointer;
    text-decoration: none;
}

.header-logo h1 {
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
}

.header-logo span {
    display: block;
    margin-top: 4px;
    font-weight: 400;
    line-height: 1.2;
}

/* ============================================================================
   NAVIGATION WITH INTEGRATED SEARCH
   ============================================================================ */
.header-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    position: relative;
}

/* Integrated Search Container */
.integrated-search-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 40px;
    position: relative;
}

.integrated-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100%;
}

.integrated-search-input {
    width: 100%;
    height: 40px;
    padding: 0 35px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    font-family: inherit;
    background: #ffffff;
}

.integrated-search-input:focus {
    outline: none;
    border-color: #805ad5;
    box-shadow: 0 0 0 2px rgba(128, 90, 213, 0.1);
}

.integrated-search-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.integrated-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    pointer-events: none;
    z-index: 1;
    width: 16px;
    height: 16px;
}

/* Search Loader */
.integrated-search-container .search-loader {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    z-index: 1;
}

.integrated-search-container .search-loader .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #805ad5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Search Dropdown - FIXED: Matches search bar width exactly, NO padding */
.integrated-search-container .search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    width: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.integrated-search-container .search-dropdown.active {
    display: block !important;
}

/* Search Dropdown Sections */
.search-section-title {
    padding: 8px 16px;
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    margin: 0;
}

.clear-history-btn {
    background: none;
    border: none;
    color: #805ad5;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
}

.clear-history-btn:hover {
    text-decoration: underline;
}

.no-results-section {
    text-align: center;
    padding: 24px;
}

.no-results-icon {
    color: #cbd5e0;
    margin-bottom: 12px;
}

.no-results-text {
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 4px;
}

.no-results-subtext {
    font-size: 12px;
    color: #718096;
}

/* ============================================================================
   USER SECTION
   ============================================================================ */
.header-user {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 10px;
    position: relative;
}

/* Login Button */
.login-btn {
    padding: 8px 20px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    height: 40px;
}

.login-btn:hover {
    filter: brightness(0.95);
}

/* User Dropdown */
.user-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    height: 40px;
    max-width: 100px;
    box-sizing: border-box;
}
}

.dropdown-toggle:hover {
    filter: brightness(0.95);
}


.dropdown-toggle .arrow {
    font-size: 10px;
    margin-left: 4px;
}

.dropdown-toggle > span:first-child {
    display: inline-block;
    max-width: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    display: none;
    z-index: 1001;
    overflow: hidden;
}

.dropdown-menu[style*="display: block"] {
    display: block !important;
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #2d3748;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: #f7fafc;
}

.dropdown-item i {
    width: 20px;
    display: inline-block;
    margin-right: 8px;
    text-align: center;
    color: #718096;
}

.dropdown-menu .divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0;
}

.dropdown-menu form {
    margin: 0;
}

.dropdown-menu form button {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    text-align: left;
    color: #e53e3e;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}

.dropdown-menu form button:hover {
    background: #fff5f5;
}

.dropdown-menu form button i {
    color: #e53e3e;
}

/* ============================================================================
   HAMBURGER MENU
   ============================================================================ */
.hamburger-menu {
    display: none;
    width: 32px;
    height: 32px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 6px;
    background: transparent;
    border: none;
    z-index: 1002;
}

.hamburger-menu span {
    display: block;
    width: 20px;
    height: 2px;
    background: #333;
    transition: all 0.3s;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================================================
   MOBILE MENU CONTAINER
   ============================================================================ */
.mobile-menu-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 999;
    transition: background 0.3s;
    pointer-events: none;
}

.mobile-menu-container.active {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: #fff;
    transition: right 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.mobile-menu-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.mobile-menu-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #666;
}

.mobile-menu-nav {
    flex: 1;
    padding: 10px 0;
}

.mobile-menu-nav .nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #333;
    text-decoration: none;
    font-size: 15px;
    font-weight: 400;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.mobile-menu-nav .nav-item:hover {
    background: #f7fafc;
    padding-left: 24px;
}

.mobile-menu-nav .nav-item.active {
    color: #805ad5;
    background: #f7fafc;
    font-weight: 500;
}

.mobile-menu-nav .nav-item i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.mobile-menu-footer {
    padding: 20px;
    border-top: 1px solid #e2e8f0;
}

.mobile-login-btn {
    width: 100%;
    padding: 12px;
    background: #805ad5;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

.mobile-login-btn:hover {
    background: #6b46c1;
}

/* ============================================================================
   BODY PADDING ADJUSTMENTS
   ============================================================================ */
body {
    padding-top: 0;
}

body.has-sticky-header {
    padding-top: 90px;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */
@media (max-width: 991px) {
    #topNavigationBar {
        display: none !important;
    }

    .main-header {
        height: 70px !important;
        top: 0 !important;
    }

    .main-header.sticky {
        top: 0 !important;
    }

    .header-container {
        grid-template-columns: 1fr auto !important;
        padding: 0 !important;
        gap: 10px;
        height: 70px !important;
    }

    .header-logo {
        top: 0 !important;
    }

    .header-logo h1 {
        font-size: 18px !important;
    }

    .header-logo span {
        display: block !important;
        font-size: 11px !important;
        margin-top: 2px !important;
    }

    .header-nav {
        display: none !important;
    }

    .hamburger-menu {
        display: flex !important;
    }

    .mobile-menu-container {
        display: block;
    }

    .header-user .login-btn {
        font-size: 13px;
        padding: 6px 15px;
        height: 36px;
    }


/* Username truncation - FIXED after avatar removal */
.dropdown-toggle > span:first-child {
    display: inline-block;
    max-width: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
