/* Basic header styles */
.sws-header { background:#fff; width:100%; z-index:9999; box-shadow:0 0 0 rgba(0,0,0,0); position:relative; }

/* Ensure header appears on all page types */
body .sws-header { display:block !important; }
.sws-header .sws-header-inner { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; max-width:1200px; margin:0 auto; }
.sws-right { display:flex; align-items:center; gap:8px; }
.sws-logo { display:inline-block; }
.sws-logo a { display:inline-block; text-decoration:none; line-height:0; }
.sws-logo img { max-height:60px; display:block; }
.sws-logo .logo-mobile { display:none; }
/* If mobile logo not set, show desktop logo on mobile/tablet */
.sws-logo.no-mobile-logo .logo-desktop { display:block !important; }
.sws-logo.no-mobile-logo .logo-mobile { display:none !important; }
.sws-nav ul { list-style:none; margin:0; padding:0; display:flex; gap:18px; }
.sws-nav li { display:inline-block; }
.sws-icons img { height:22px; margin-left:10px; }
.sws-hamburger { display:none; border:0; background:transparent; font-size:24px; }

/* Search styles - always visible and well aligned */
.sws-search-wrapper { position:relative; margin-right:12px; display:inline-flex; align-items:center; }
.sws-search-form { display:flex; align-items:center; gap:0; border:1px solid #80808052; border-radius:50px; overflow:hidden; background:transparent; }
.sws-search-input { padding:8px 12px; border:none; border-radius:0; font-size:14px; outline:none; width:200px; background:transparent; box-shadow:none; }
.sws-search-input:focus { border:none; outline:none; box-shadow:none; }
.sws-search-input::placeholder { color:#999; }
.sws-search-submit { border:0; background:transparent; color:#333; padding:8px 14px; border-radius:0; cursor:pointer; font-size:16px; display:flex; align-items:center; justify-content:center; min-width:44px; line-height:1; box-shadow:none; }
.sws-search-submit:hover { background:transparent; box-shadow:none; }
.sws-search-submit img { display:block; max-width:100%; height:auto; }
.sws-search-form:focus-within { box-shadow:none; }

/* Desktop: Show desktop menu, hide mobile menu */
.sws-nav-desktop { display:block; }
.sws-nav-mobile { display:none !important; }
.sws-search-desktop { display:flex; }
.sws-search-mobile { display:none !important; }

/* Layout tiny responsive */
@media (max-width: 880px) {
    /* Mobile header layout: Logo left, Search center, Language/Hamburger right */
    .sws-header-inner {
        flex-wrap:nowrap;
        padding:12px 15px;
        align-items:center;
        justify-content:space-between;
    }
    .sws-left {
        flex:0 0 auto;
        min-width:auto;
        order:1;
    }
    .sws-center {
        flex:1 1 auto;
        display:flex;
        justify-content:center;
        align-items:center;
        padding:0 10px;
        order:2;
        min-width:0; /* Allow flex shrinking */
    }
    .sws-right {
        flex:0 0 auto;
        gap:8px;
        order:3;
        display:flex;
        align-items:center;
        justify-content:flex-end;
        flex-wrap:nowrap;
    }
    
    /* Ensure right side elements are properly aligned */
    .sws-right > * {
        flex-shrink:0;
        display:inline-flex;
        align-items:center;
        vertical-align:middle;
    }
    
    /* Custom code in right side - ensure proper alignment */
    .sws-right .sws-custom-code {
        display:inline-flex;
        align-items:center;
        vertical-align:middle;
        margin:0;
    }
    
    /* Hide desktop menu and search, show mobile search */
    .sws-nav-desktop { display:none !important; }
    .sws-search-desktop { display:none !important; }
    .sws-search-mobile { display:flex !important; }
    
    /* Show mobile menu in sidebar */
    .sws-nav-mobile {
        display:block !important;
    }
    
    /* Mobile menu in sidebar */
    .sws-nav-mobile { 
        position:fixed !important;
        top:0 !important;
        right:-100% !important;
        width:280px !important;
        max-width:80% !important;
        height:100vh !important;
        background:#fff !important;
        box-shadow:-2px 0 10px rgba(0,0,0,0.1) !important;
        z-index:10001 !important; /* Above overlay */
        overflow-y:auto !important;
        transition:right 0.3s ease !important;
        padding:20px !important;
        margin:0 !important;
    }
    
    body.sws-menu-open .sws-nav-mobile {
        right:0 !important;
    }
    /* Mobile menu styles */
    .sws-nav-mobile {
        pointer-events:auto !important;
    }
    .sws-nav-mobile ul {
        flex-direction:column;
        gap:0;
        margin:0;
        padding:0;
        pointer-events:auto;
    }
    .sws-nav-mobile li {
        width:100%;
        border-bottom:1px solid #eee;
        list-style:none;
        pointer-events:auto;
    }
    .sws-nav-mobile li a {
        display:block;
        padding:12px 0;
        text-decoration:none;
        color:#333;
        pointer-events:auto;
        cursor:pointer;
    }
    .sws-nav-mobile li a:hover {
        color:#0073aa;
    }
    .sws-hamburger { 
        display:inline-block; 
        z-index:10002; /* Above menu and overlay */
        position:relative;
        padding:4px 8px;
        margin:0;
    }
    
    /* Logo logic: if mobile logo exists, hide desktop, else show desktop */
    .sws-logo { 
        max-width:120px;
        flex-shrink:0;
    }
    .sws-logo .logo-desktop { display:none; }
    .sws-logo .logo-mobile { display:block; max-height:40px; }
    /* If no mobile logo, show desktop logo */
    .sws-logo.no-mobile-logo .logo-desktop { 
        display:block !important; 
        max-height:40px;
    }
    .sws-logo.no-mobile-logo .logo-mobile { 
        display:none !important; 
    }
    
    /* Search - always visible in center on mobile */
    .sws-search-wrapper { 
        margin:0;
        width:100%;
        max-width:100%;
        display:flex;
        align-items:center;
    }
    .sws-search-form { 
        width:100%;
        max-width:100%;
        display:flex;
        align-items:center;
    }
    .sws-search-input { 
        width:100%;
        flex:1;
        padding:8px 12px;
        font-size:14px;
        height:auto;
        line-height:normal;
    }
    .sws-search-submit { 
        padding:8px 12px; 
        min-width:44px;
        flex-shrink:0;
        height:auto;
        display:flex;
        align-items:center;
        justify-content:center;
    }
    
    /* Hide custom code in center on mobile if it's there */
    .sws-center .sws-custom-code {
        display:none;
    }
    
    /* Language switcher and icons - properly aligned */
    .sws-language-switcher {
        margin-right:0;
        display:flex;
        align-items:center;
    }
    .sws-icons {
        display:none; /* Hide icons on mobile to save space */
    }
    .sws-custom-code-right { 
        display:flex;
        align-items:center;
        margin-left:8px;
        margin-right:0;
    }
    
    /* Ensure search wrapper is aligned */
    .sws-search-wrapper {
        display:flex;
        align-items:center;
    }
    
    /* Hamburger button alignment */
    .sws-hamburger {
        display:flex;
        align-items:center;
        justify-content:center;
        margin-left:8px;
    }
}

/* Very small screens - below 520px */
@media (max-width: 520px) {
    /* Two-row layout: Top row (Logo left, Hamburger right), Bottom row (Search left, Custom code right) */
    .sws-header-inner {
        flex-direction:row;
        flex-wrap:wrap;
        padding:10px 12px;
        gap:10px 0;
        position:relative;
    }
    
    /* Top row: Logo (left) + Hamburger (right) */
    .sws-left {
        order:1;
        flex:0 0 100%;
        width:100%;
        display:flex;
        justify-content:space-between;
        align-items:center;
        margin:0;
        padding:0;
    }
    
    /* Logo - left side of top row */
    .sws-logo {
        order:1;
        margin:0;
        max-width:none;
    }
    
    /* Hide custom code in left on very small screens */
    .sws-left .sws-custom-code-left {
        display:none !important;
    }
    
    /* Hamburger - right side of top row (positioned absolutely in same row) */
    .sws-right {
        order:1;
        position:absolute;
        top:10px;
        right:12px;
        width:auto;
        flex:0 0 auto;
        display:flex;
        justify-content:flex-end;
        align-items:center;
        margin:0;
        padding:0;
    }
    
    /* Hamburger - right side of top row */
    .sws-hamburger {
        margin:0;
        padding:4px 8px;
    }
    
    /* Hide language switcher, icons, and desktop search on very small screens */
    .sws-right .sws-language-switcher,
    .sws-right .sws-icons,
    .sws-right .sws-search-desktop {
        display:none !important;
    }
    
    /* Hide custom code right in right section (will be moved to center by JS) */
    .sws-right .sws-custom-code-right {
        display:none !important;
    }
    
    /* Bottom row: Search (left) + Custom code (right) */
    .sws-center {
        order:2;
        flex:0 0 100%;
        width:100%;
        display:flex;
        justify-content:space-between;
        align-items:center;
        padding:0;
        margin:0;
        gap:10px;
    }
    
    /* Search - bottom row left */
    .sws-search-mobile {
        order:1;
        margin:0;
        width:auto;
        flex:1;
        display:flex;
        justify-content:flex-start;
    }
    
    /* Custom code right in center section (moved by JS) - bottom row right */
    .sws-center .sws-custom-code-right {
        order:2;
        margin:0;
        display:flex !important;
        align-items:center;
        margin-left:auto;
    }
    
    .sws-search-wrapper {
        width:auto;
        max-width:none;
        margin:0;
    }
    
    .sws-search-form {
        width:auto;
        min-width:180px;
        max-width:100%;
    }
    
    .sws-search-input {
        width:auto;
        min-width:120px;
        flex:1;
    }
    
    /* Hide custom code in center on very small screens */
    .sws-center .sws-custom-code-center {
        display:none !important;
    }
}

/* Sticky fixed state */
.sws-header.is-fixed { position:fixed; top:0; left:0; right:0; box-shadow:0 6px 20px rgba(0,0,0,0.08); }

/* Hamburger position classes */
.sws-header.hamburger-left .sws-hamburger { order:-1; margin-right:12px }
.sws-header.hamburger-right .sws-hamburger { order:1; margin-left:12px }

/* Custom code styles */
.sws-custom-code { margin:0; display:inline-flex; align-items:center; vertical-align:middle; position:relative; }
.sws-custom-code-left { margin-right:12px; }
.sws-custom-code-center { margin:0 auto; }
.sws-custom-code-right { margin-left:12px; }

/* Prevent dropdowns in custom code from stretching header */
.sws-custom-code > * { position:relative; }
.sws-custom-code .gt_switcher,
.sws-custom-code .gt_switcher_wrapper,
.sws-custom-code [class*="language-switcher"],
.sws-custom-code [class*="lang-switcher"],
.sws-custom-code select,
.sws-custom-code .dropdown { position:relative; }

/* GT Translate dropdown fix - make dropdown absolute so it doesn't stretch header */
.sws-custom-code .gt_switcher,
.sws-custom-code .gt_switcher_wrapper { 
    position:relative !important; 
    display:inline-block !important; 
    vertical-align:middle !important;
}
.sws-custom-code .gt_switcher .gt_option,
.sws-custom-code .gt_switcher .gt_options {
    position:absolute !important;
    top:100% !important;
    left:0 !important;
    right:auto !important;
    z-index:10000 !important;
    margin-top:4px !important;
    background:#fff !important;
    box-shadow:0 2px 8px rgba(0,0,0,0.15) !important;
    border-radius:4px !important;
    min-width:150px !important;
    max-height:300px !important;
    overflow-y:auto !important;
    display:block !important;
}

/* GT Translate when dropdown opens upward */
.sws-custom-code .gt_switcher .gt_option[style*="bottom"],
.sws-custom-code .gt_switcher .gt_options[style*="bottom"] {
    top:auto !important;
    bottom:100% !important;
    margin-top:0 !important;
    margin-bottom:4px !important;
}

/* Force GT Translate selected to not expand */
.sws-custom-code .gt_switcher .gt_selected { 
    display:inline-block !important; 
    position:relative !important;
}

/* Generic dropdown fixes for any language switcher */
.sws-custom-code [class*="dropdown-menu"],
.sws-custom-code [class*="dropdown-content"],
.sws-custom-code [class*="lang-dropdown"],
.sws-custom-code [class*="language-dropdown"],
.sws-custom-code .dropdown-menu,
.sws-custom-code .dropdown-content {
    position:absolute !important;
    top:100% !important;
    left:0 !important;
    right:auto !important;
    z-index:10000 !important;
    margin-top:4px !important;
    background:#fff !important;
    box-shadow:0 2px 8px rgba(0,0,0,0.15) !important;
    border-radius:4px !important;
    min-width:150px !important;
}

/* Ensure header doesn't expand - overflow visible for dropdowns */
.sws-header { 
    overflow:visible !important; 
    min-height:auto !important; 
    height:auto !important;
    max-height:none !important;
}
.sws-header-inner { 
    overflow:visible !important;
    height:auto !important;
    max-height:none !important;
}
.sws-right { 
    overflow:visible !important;
    height:auto !important;
}
.sws-custom-code { 
    overflow:visible !important;
    height:auto !important;
    max-height:none !important;
}

/* Force GT Translate to not expand parent */
.sws-custom-code .gt_switcher,
.sws-custom-code .gt_switcher_wrapper {
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
}

/* Language switcher styles */
.sws-language-switcher { margin-right:12px; display:inline-block; vertical-align:middle; }

/* Dropdown style */
.sws-lang-switcher .sws-lang-select {
    padding:6px 30px 6px 12px;
    border:1px solid #ddd;
    border-radius:4px;
    background:#fff;
    font-size:14px;
    cursor:pointer;
    outline:none;
    appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat:no-repeat;
    background-position:right 8px center;
    background-size:12px;
}
.sws-lang-switcher .sws-lang-select:hover { border-color:#0073aa; }
.sws-lang-switcher .sws-lang-select:focus { border-color:#0073aa; box-shadow:0 0 0 1px #0073aa; }

/* Flags style */
.sws-lang-flags { display:flex; gap:8px; align-items:center; }
.sws-lang-flag { display:inline-block; padding:4px; border-radius:3px; transition:all 0.2s; }
.sws-lang-flag:hover { background:#f0f0f0; }
.sws-lang-flag.active { background:#0073aa; }
.sws-lang-flag img { width:24px; height:18px; object-fit:cover; border-radius:2px; display:block; }
.sws-lang-flag svg { width:24px; height:18px; display:block; }

/* List style */
.sws-lang-list { list-style:none; margin:0; padding:0; display:flex; gap:12px; align-items:center; }
.sws-lang-item { display:inline-block; }
.sws-lang-item a { padding:6px 12px; text-decoration:none; color:#333; border-radius:4px; font-size:14px; transition:all 0.2s; display:block; }
.sws-lang-item a:hover { background:#f0f0f0; color:#0073aa; }
.sws-lang-item.active a { background:#0073aa; color:#fff; }

/* No plugin notice */
.sws-lang-notice { font-size:12px; color:#999; font-style:italic; }

/* Responsive language switcher */
@media (max-width: 880px) {
    .sws-language-switcher { margin-right:8px; }
    .sws-lang-flags { gap:6px; }
    .sws-lang-flag img,
    .sws-lang-flag svg { width:20px; height:15px; }
    .sws-lang-list { gap:8px; }
    .sws-lang-item a { padding:4px 8px; font-size:12px; }
    .sws-lang-switcher .sws-lang-select { padding:4px 28px 4px 10px; font-size:12px; }
}
