/**
 * GPCC Custom Header Styles
 * Dark theme header với search bar nổi bật
 * 
 * @package GeneratePress_Child
 * @version 1.3.0 - No z-index, using isolation and DOM order
 */

/* === RESET & BASE === */
.gpcc-custom-header *,
.gpcc-custom-header *::before,
.gpcc-custom-header *::after {
    box-sizing: border-box;
}

.gpcc-custom-header ul,
.gpcc-custom-header ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* === HEADER CONTAINER === */
.gpcc-custom-header {
    background: linear-gradient(180deg, #0a1628 0%, #0d1a2d 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    isolation: isolate; /* Create own stacking context */
}

.gpcc-custom-header--sticky {
    position: sticky;
    top: 0;
    backdrop-filter: blur(12px);
    background: rgba(10, 22, 40, 0.95);
}

.gpcc-custom-header__container {
    max-width: var(--container, 1280px);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* === TOP BAR === */
.gpcc-custom-header__topbar {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8125rem;
    padding: 0.5rem 0;
}

.gpcc-custom-header__topbar .gpcc-custom-header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.gpcc-custom-header__topbar-content {
    color: rgba(255, 255, 255, 0.7);
}

.gpcc-custom-header__topbar-social {
    display: flex;
    gap: 0.75rem;
}

.gpcc-custom-header__topbar-social a {
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}

.gpcc-custom-header__topbar-social a:hover {
    color: #3b82f6;
    transform: translateY(-1px);
}

/* === MAIN HEADER === */
.gpcc-custom-header__main {
    padding: 1rem 0;
}

.gpcc-custom-header__main .gpcc-custom-header__container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

/* === BRANDING === */
.gpcc-custom-header__branding {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.gpcc-custom-header__logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    gap: 0.5rem;
}

.gpcc-custom-header__logo-img {
    max-height: 36px;
    width: auto;
    transition: all 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.gpcc-custom-header__logo-link:hover .gpcc-custom-header__logo-img {
    transform: scale(1.02);
    filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.3));
}

.gpcc-custom-header__site-name {
    font-size: 1.375rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gpcc-custom-header__logo-link:hover .gpcc-custom-header__site-name {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.gpcc-custom-header__tagline {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.8);
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* === SEARCH BAR === */
.gpcc-header__search {
    flex-grow: 1;
    max-width: 520px;
    margin: 0 auto;
}

.gpcc-custom-header .gpcc-header__search-form,
.gpcc-header__search-form {
    display: flex !important;
    align-items: center !important;
    background: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 9999px !important;
    transition: all 0.25s ease;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
    padding: 4px !important;
    padding-left: 0 !important;
    overflow: hidden;
}

.gpcc-custom-header .gpcc-header__search-form:hover,
.gpcc-header__search-form:hover {
    border-color: rgba(59, 130, 246, 0.3) !important;
    background: rgba(30, 41, 59, 0.8) !important;
}

.gpcc-custom-header .gpcc-header__search-form:focus-within,
.gpcc-header__search-form:focus-within {
    border-color: #3b82f6 !important;
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.2) !important;
    background: rgba(30, 41, 59, 0.9) !important;
}

.gpcc-custom-header .gpcc-header__search-input,
.gpcc-header__search-input,
.gpcc-header__search-form input[type="search"] {
    flex-grow: 1 !important;
    background: transparent !important;
    border: none !important;
    padding: 0.75rem 1.25rem !important;
    color: #ffffff !important;
    font-size: 0.9375rem !important;
    outline: none !important;
    min-width: 0 !important;
    font-weight: 400 !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    margin: 0 !important;
    height: auto !important;
    line-height: normal !important;
}

.gpcc-custom-header .gpcc-header__search-input::placeholder,
.gpcc-header__search-input::placeholder,
.gpcc-header__search-form input[type="search"]::placeholder {
    color: rgba(148, 163, 184, 0.6) !important;
    font-weight: 400 !important;
    opacity: 1 !important;
}

/* Remove webkit search cancel button */
.gpcc-header__search-input::-webkit-search-cancel-button,
.gpcc-header__search-input::-webkit-search-decoration,
.gpcc-header__search-form input[type="search"]::-webkit-search-cancel-button,
.gpcc-header__search-form input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none !important;
    appearance: none !important;
}

.gpcc-custom-header .gpcc-header__search-btn,
.gpcc-header__search-btn,
.gpcc-header__search-form button[type="submit"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    border: none !important;
    border-radius: 50% !important;
    color: white !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.gpcc-custom-header .gpcc-header__search-btn:hover,
.gpcc-header__search-btn:hover,
.gpcc-header__search-form button[type="submit"]:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%) !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

.gpcc-custom-header .gpcc-header__search-btn:active,
.gpcc-header__search-btn:active,
.gpcc-header__search-form button[type="submit"]:active {
    transform: scale(0.98);
}

.gpcc-header__search-btn svg,
.gpcc-header__search-form button[type="submit"] svg {
    width: 18px !important;
    height: 18px !important;
    fill: none !important;
    stroke: currentColor !important;
}

/* === MOBILE TOGGLE === */
.gpcc-custom-header__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.gpcc-custom-header__toggle:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

.gpcc-custom-header__toggle-icon,
.gpcc-custom-header__toggle-icon::before,
.gpcc-custom-header__toggle-icon::after {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.gpcc-custom-header__toggle-icon {
    position: relative;
}

.gpcc-custom-header__toggle-icon::before,
.gpcc-custom-header__toggle-icon::after {
    content: '';
    position: absolute;
    left: 0;
}

.gpcc-custom-header__toggle-icon::before {
    top: -6px;
}

.gpcc-custom-header__toggle-icon::after {
    top: 6px;
}

/* Toggle active state */
.gpcc-custom-header__toggle[aria-expanded="true"] .gpcc-custom-header__toggle-icon {
    background-color: transparent;
}

.gpcc-custom-header__toggle[aria-expanded="true"] .gpcc-custom-header__toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.gpcc-custom-header__toggle[aria-expanded="true"] .gpcc-custom-header__toggle-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

/* === NAVIGATION BAR === */
.gpcc-custom-header__navbar {
    background: rgba(17, 24, 39, 0.7);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Nav container from wp_nav_menu - CENTERED */
.gpcc-header__nav {
    display: flex;
    justify-content: center;
}

/* Menu list - CENTERED */
.gpcc-header__menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.gpcc-header__menu li {
    position: relative;
    list-style: none !important;
}

.gpcc-header__menu li::before,
.gpcc-header__menu li::marker {
    display: none !important;
    content: none !important;
}

.gpcc-header__menu > li > a {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.gpcc-header__menu > li > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: calc(100% - 1.5rem);
    height: 2px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 2px;
    transition: transform 0.2s ease;
}

.gpcc-header__menu > li > a:hover,
.gpcc-header__menu > li.current-menu-item > a,
.gpcc-header__menu > li.current-menu-ancestor > a {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.08);
}

.gpcc-header__menu > li > a:hover::after,
.gpcc-header__menu > li.current-menu-item > a::after,
.gpcc-header__menu > li.current-menu-ancestor > a::after {
    transform: translateX(-50%) scaleX(1);
}

/* === DROPDOWN MENU === */
.gpcc-header__menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 220px;
    background: rgba(17, 24, 39, 0.98);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    list-style: none !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.gpcc-header__menu li:hover > .sub-menu,
.gpcc-header__menu li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(4px);
}

.gpcc-header__menu .sub-menu li {
    list-style: none !important;
}

.gpcc-header__menu .sub-menu li::before {
    display: none !important;
}

.gpcc-header__menu .sub-menu a {
    display: block;
    padding: 0.625rem 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 450;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.gpcc-header__menu .sub-menu a:hover {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.15);
    padding-left: 1rem;
}

/* === DESKTOP STYLES (default) === */
@media (min-width: 1024px) {
    .gpcc-custom-header__toggle {
        display: none !important;
    }
    
    .gpcc-header__nav {
        display: flex !important;
    }
    
    .gpcc-custom-header__navbar {
        display: block !important;
    }
}

/* === TABLET & MOBILE === */
@media (max-width: 1023px) {
    .gpcc-custom-header__container {
        padding: 0 1rem;
    }
    
    .gpcc-custom-header__toggle {
        display: flex;
    }
    
    .gpcc-header__search {
        display: none;
    }
    
    .gpcc-custom-header__main .gpcc-custom-header__container {
        justify-content: space-between;
    }
    
    /* Hide navbar on mobile - menu will be in dialog */
    .gpcc-custom-header__navbar {
        display: none;
    }
}

/* === MOBILE SMALL === */
@media (max-width: 767px) {
    .gpcc-custom-header__topbar {
        display: none;
    }
    
    .gpcc-custom-header__logo-img {
        max-height: 30px;
    }
    
    .gpcc-custom-header__site-name {
        font-size: 1.125rem;
    }
    
    .gpcc-custom-header__tagline {
        display: none;
    }
    
    .gpcc-custom-header__main {
        padding: 0.75rem 0;
    }
}

/* === MOBILE MENU DIALOG (No z-index needed) === */
.gpcc-mobile-menu-dialog {
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
}

.gpcc-mobile-menu-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.gpcc-mobile-menu-dialog[open] {
    display: flex;
    justify-content: flex-end;
}

.gpcc-mobile-menu-content {
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: linear-gradient(180deg, #0a1628 0%, #111827 100%);
    padding: 1.5rem;
    overflow-y: auto;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.gpcc-mobile-menu-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.gpcc-mobile-menu-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #ffffff;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gpcc-mobile-menu-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.gpcc-mobile-menu-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gpcc-mobile-menu-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gpcc-mobile-menu-nav li {
    list-style: none;
}

.gpcc-mobile-menu-nav a {
    display: block;
    padding: 0.875rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.gpcc-mobile-menu-nav a:hover {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.15);
}

.gpcc-mobile-menu-nav .sub-menu {
    padding-left: 1rem;
    margin-top: 0.25rem;
}

.gpcc-mobile-menu-nav .sub-menu a {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.625rem 1rem;
}

/* === SOCIAL ICONS === */
.gpcc-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.gpcc-social-icon:hover {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.gpcc-social-icon svg {
    width: 16px;
    height: 16px;
}
