/**
 * Custom Header Styles
 * Modern header with top bar and mega menu
 * Version: 2.0 - Updated with mobile menu fixes
 * Last Update: 2024
 */

/* ===================================
   HEADER CONTAINER
   =================================== */
.header {
    position: relative;
    /* z-index removed to allow nav-items to escape stacking context for overlay effect */
}

.header .container {
    max-width: 1400px;
    padding-left: 20px;
    padding-right: 20px;
}

/* ===================================
   TOP BAR STYLES
   =================================== */
.top-bar {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
    padding: 10px 0;
    position: relative;
    z-index: 10001;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #495057;
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 12px;
}

.top-bar-item:hover {
    color: #336699;
    text-decoration: none;
}

.top-bar-item i {
    font-size: 13px;
}

.top-bar-social {
    display: flex;
    gap: 10px;
    padding-left: 15px;
    margin-left: 5px;
    border-left: 1px solid #dee2e6;
}

.top-bar-social a {
    color: #495057;
    transition: color 0.2s ease;
    font-size: 14px;
}

.top-bar-social a:hover {
    color: #336699;
}

/* Language Selector in Top Bar */
.top-bar .language-selector {
    position: relative;
}

.top-bar .language-selector-btn {
    background: none;
    border: none;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 12px;
    transition: color 0.2s ease;
    font-weight: 500;
}

.top-bar .language-selector-btn:hover {
    color: #336699;
}

.top-bar .language-selector-btn .fa-chevron-down {
    font-size: 9px;
    margin-left: 2px;
}

.top-bar .language-text {
    font-weight: 600;
}

.top-bar .language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    display: none;
    z-index: 10002;
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.top-bar .language-dropdown.show {
    display: block;
}

.top-bar .language-option {
    display: block;
    padding: 10px 15px;
    color: #495057;
    text-decoration: none;
    transition: background-color 0.2s ease;
    font-size: 13px;
    border-bottom: 1px solid #f8f9fa;
}

.top-bar .language-option:last-child {
    border-bottom: none;
}

.top-bar .language-option:hover {
    background-color: #f8f9fa;
    color: #336699;
}

.top-bar-link {
    padding: 5px 12px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.top-bar-link:hover {
    background-color: #f8f9fa;
}

.top-bar-link.customer-panel {
    background-color: #336699;
    color: white;
    padding: 6px 16px;
    border-radius: 4px;
    font-weight: 500;
}

.top-bar-link.customer-panel:hover {
    background-color: #2a5580;
    color: white;
}

/* Top bar responsive adjustments */
@media (max-width: 1199px) {
    .top-bar {
        font-size: 11px;
        padding: 8px 0;
    }
    
    .top-bar-left,
    .top-bar-right {
        gap: 12px;
    }
    
    .top-bar-item {
        font-size: 11px;
    }
}

@media (max-width: 991px) {
    .top-bar {
        font-size: 10px;
        padding: 6px 0;
    }
    
    .top-bar-left,
    .top-bar-right {
        gap: 10px;
    }
    
    .top-bar-item {
        font-size: 10px;
    }
    
    .top-bar-item i {
        font-size: 11px;
    }
    
    /* Hide social media icons when space is tight */
    .top-bar-social {
        display: none;
    }
}

@media (max-width: 767px) {
    .top-bar {
        font-size: 9px;
        padding: 5px 0;
    }
    
    .top-bar-left,
    .top-bar-right {
        gap: 8px;
    }
    
    .top-bar-item {
        font-size: 9px;
    }
    
    .top-bar-item i {
        font-size: 10px;
    }
}

@media (max-width: 550px) {
    .top-bar .top-bar-link.customer-panel {
        display: none;
    }
}

/* ===================================
   MAIN HEADER STYLES
   =================================== */
.main-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 10px 0 0;
    position: relative;
    /* z-index removed for overlay effect - allows nav-items to escape stacking context */
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

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

.logo-img {
    max-height: 40px;
    width: auto;
    display: block;
    height: 40px;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: #336699;
}

.logo-heading {
    margin: 0;
    font-size: 24px;
}

/* ===================================
   PRIMARY NAVIGATION STYLES
   =================================== */
.primary-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 auto;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0 10px;
    gap: 0;
}

.nav-item {
    position: relative;
}

.nav-item > a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 16px;
    color: #0b3f98;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    /* z-index removed for overlay effect */
    background: transparent;
}

.nav-item + .nav-item > a {
    border-left: 1px solid rgba(255, 255, 255, 0.35);
}

.nav-item > a:hover {
    color: #0f3f8c;
}

/* Active/hover state ties into mega menu */
.nav-item:hover > a,
.nav-item.active > a {
    color: #0f3f8c;
    background-color: #ffffff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 8px 16px -8px rgba(10, 30, 74, 0.2);
    border-left-color: transparent;
    position: relative;
    z-index: 1003;
}

.nav-item > a .fa-chevron-down {
    font-size: 11px;
    transition: transform 0.2s ease;
}

.nav-item:hover > a .fa-chevron-down {
    transform: rotate(180deg);
}

/* ===================================
   MEGA MENU STYLES
   =================================== */
/* Main mega menu styles are defined in custom-mega-menu.css */

/* Extend hover area to prevent menu from closing */
.nav-item.has-dropdown {
    position: relative;
}

.nav-item.has-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
    /* Invisible bridge to prevent menu closing */
}

/* Mega menu column, item, icon, text and title styles are in custom-mega-menu.css */

/* ===================================
   HEADER UTILITIES
   =================================== */
.header-utilities {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 0 0 auto;
}

@media (min-width: 1321px) {
    .header .header-utilities .mobile-menu-toggle {
        display: none !important;
    }
}

.cart-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: #495057;
    text-decoration: none;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.cart-btn:hover {
    background-color: #f8f9fa;
    color: #336699;
    border-color: #336699;
    text-decoration: none;
}

.cart-btn i {
    font-size: 18px;
}

.cart-text {
    font-size: 14px;
    font-weight: 500;
}

.cart-count {
    background-color: #dc3545;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1000000 !important;
}

.mobile-menu-toggle span {
    display: block;
    width: 26px;
    height: 3px;
    background-color: #495057;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle:hover span {
    background-color: #336699;
}

.mobile-menu-toggle:focus {
    outline: none;
}

/* Hamburger animation when active */
.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

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

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ===================================
   MOBILE STYLES
   =================================== */
@media (max-width: 1320px) {
    .header .primary-nav {
        display: none !important;
    }
    
    .header .primary-nav:hover::before {
        display: none !important;
    }
    
    .header .main-header .header-utilities .mobile-menu-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .header .cart-btn {
        padding: 8px 12px;
    }
    
    .header .cart-text {
        display: none;
    }
    
    .header .header-content {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .logo-img {
        max-height: 35px;
    }
    
    .main-header {
        padding: 8px 0;
    }
}

/* ===================================
   MOBILE MENU
   =================================== */
.mobile-menu {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    width: 100%;
    max-width: 400px;
    height: 100vh !important;
    background: white !important;
    box-shadow: -2px 0 16px rgba(0,0,0,0.2);
    z-index: 999999 !important;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    pointer-events: auto !important;
}

.mobile-menu.active {
    right: 0 !important;
    pointer-events: auto !important;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: white !important;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    z-index: 1 !important;
}

.mobile-logo img {
    max-height: 35px;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #495057;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    transition: color 0.2s ease;
}

.mobile-menu-close:hover {
    color: #336699;
}

/* Hide close button when it overlaps with action buttons */
.mobile-menu-actions ~ * .mobile-menu-close,
.mobile-menu-header:has(~ .mobile-menu-actions) .mobile-menu-close {
    pointer-events: auto;
}

.mobile-menu-header {
    z-index: 2 !important;
}

/* Mobile Menu Actions */
.mobile-menu-actions {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: white !important;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    z-index: 10000000 !important;
}

.mobile-action-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    transition: all 0.2s ease;
}

.mobile-action-btn.login {
    background: #00d4aa;
    color: white;
}

.mobile-action-btn.login:hover {
    background: #00c099;
    color: white;
    text-decoration: none;
}

.mobile-action-btn.account {
    background: #336699;
    color: white;
}

.mobile-action-btn.account:hover {
    background: #2a5580;
    color: white;
    text-decoration: none;
}

.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 15px 0;
    flex: 1;
    position: relative;
    z-index: 1000000 !important;
    background: white !important;
}

.mobile-nav-item {
    margin-bottom: 2px;
}

.mobile-nav-link-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white !important;
}

.mobile-nav-link {
    flex: 1;
    display: block;
    padding: 16px 20px;
    color: #2c3e50 !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
    background: white !important;
}

.mobile-nav-link:hover {
    background-color: #f8f9fa !important;
    color: #336699 !important;
    text-decoration: none;
}

.submenu-toggle {
    background: none;
    border: none;
    padding: 16px 20px;
    color: #336699;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.submenu-toggle:hover {
    background-color: #f8f9fa;
}

.submenu-toggle i {
    transition: transform 0.3s ease;
}

.submenu-toggle.active i {
    transform: rotate(180deg);
}

.mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    display: none;
}

.mobile-nav-item.active .mobile-submenu {
    display: block;
}

/* Mobile submenu section with heading */
.mobile-submenu-section {
    margin-bottom: 0;
    background: white;
}

.mobile-submenu-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px 12px 30px;
    font-size: 15px;
    font-weight: 700;
    color: #0a3f92;
    background-color: #ffffff;
    border-top: 2px solid #e4e8f0;
    position: relative;
}

.mobile-submenu-section:first-child .mobile-submenu-heading {
    border-top: 1px solid #e9ecef;
}

.mobile-submenu-heading i {
    font-size: 16px;
    color: #0a3f92;
}

.mobile-submenu-heading::after {
    content: '';
    position: absolute;
    left: 30px;
    bottom: 0;
    width: 56px;
    height: 3px;
    background: #05c0c6;
    border-radius: 4px;
}

.mobile-submenu-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    background: #ffffff;
}

.mobile-submenu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 10px 40px;
    color: #143d7b !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    background: white !important;
    border-bottom: 1px solid #e9eef5;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-submenu-item:last-child .mobile-submenu-link {
    border-bottom: none;
}

.mobile-submenu-link:hover {
    background-color: #f0f7ff !important;
    color: #05c0c6 !important;
    text-decoration: none;
}

.mobile-submenu-link i {
    font-size: 11px;
    color: #0a3f92;
    transition: transform 0.2s ease, color 0.2s ease;
}

.mobile-submenu-link:hover i {
    color: #05c0c6;
    transform: translateX(3px);
}

/* Regular mobile submenu (non-sectioned) styling */
.mobile-submenu:not(.mobile-submenu-section) {
    background: #ffffff;
}

.mobile-submenu > .mobile-submenu-item .mobile-submenu-link {
    padding: 12px 20px 12px 40px;
    border-bottom: 1px solid #e9eef5;
}

.mobile-submenu > .mobile-submenu-item:last-child .mobile-submenu-link {
    border-bottom: none;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 400px !important;
    width: auto !important;
    height: 100vh !important;
    background: rgba(10, 30, 80, 0.55) !important;
    z-index: 999999 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.mobile-menu-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Mobil cihazlarda overlay genişliğini ayarla */
@media (max-width: 767px) {
    .mobile-menu-overlay {
        right: 90% !important;
    }
}

@media (max-width: 480px) {
    .mobile-menu-overlay {
        right: 100% !important;
        width: 0 !important;
    }
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* ===================================
   MOBILE MENU FOOTER
   =================================== */
.mobile-menu-footer {
    display: none;
    margin-top: auto;
    padding: 15px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

/* Language Selector in Mobile Footer */
.language-selector-mobile {
    position: relative;
    width: auto;
    min-width: 140px;
}

.language-selector-btn-mobile {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    transition: all 0.2s ease;
    width: 100%;
}

.language-selector-btn-mobile:hover {
    background: #f8f9fa;
    color: #336699;
    border-color: #336699;
}

.language-selector-btn-mobile i.fa-globe {
    font-size: 14px;
}

.language-selector-btn-mobile .language-text {
    flex: 1;
    text-align: left;
}

.language-selector-btn-mobile .fa-chevron-down {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.language-selector-mobile.active .language-selector-btn-mobile .fa-chevron-down {
    transform: rotate(180deg);
}

.language-dropdown-mobile {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
}

.language-selector-mobile.active .language-dropdown-mobile {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option-mobile {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: #495057;
    text-decoration: none;
    font-size: 13px;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.language-option-mobile:last-child {
    border-bottom: none;
}

.language-option-mobile:hover {
    background: #f8f9fa;
    color: #336699;
    text-decoration: none;
}

/* ===================================
   GLOBAL CONTAINER WIDTH
   Match all main content areas with header width (1400px)
   =================================== */

/* Override Bootstrap container max-width globally */
@media (min-width: 992px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl {
        max-width: 1400px !important;
    }
}

/* Main body container - matches header width */
section#main-body > .container,
section#main-body .container,
section#main-body > .container > .row,
.main-content .container,
.primary-content,
nav.master-breadcrumb .container {
    max-width: 1400px !important;
    padding-left: 20px;
    padding-right: 20px;
}

/* Homepage sections */
.browse-products-section,
.browse-products-section .container,
.domain-search-section .container,
.domain-search-hero,
.featured-products .container,
.help-section .container,
.account-section .container {
    max-width: 1400px !important;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* Action icon buttons container (Bugün size nasıl yardımcı olabiliriz, Hesabınız) */
.action-icon-btns {
    max-width: 1400px !important;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* Section titles */
h2.section-title {
    max-width: 1400px !important;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

/* Footer container - matches header width */
footer#footer .footer-container,
footer .footer-container {
    max-width: 1400px !important;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}
