/* Container Layout */
.ph-header-outer,
.ph-header-wrap,
.ph-header-container,
.ph-logo-col,
.ph-actions-col,
.ph-projects-btn,
.ph-hamburger-btn {
    box-sizing: border-box !important;
}

.ph-header-outer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
}
body.admin-bar .ph-header-outer {
    top: var(--wp-admin--admin-bar--height, 32px);
}
@media screen and (max-width: 782px) {
    body.admin-bar .ph-header-outer {
        top: 46px;
    }
}

.ph-header-wrap {
    transition: background-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease, height 0.3s ease;
    width: 100%;
    background-color: transparent;
    
    /* Strict Height Implementation */
    height: var(--header-normal-height, 100px) !important;
    min-height: 0 !important; /* Ensure min-height does not block height changes */
}

/* Sticky Height State Override */
.ph-header-outer.ph-is-sticky .ph-header-wrap {
    height: var(--header-sticky-height, 70px) !important;
    min-height: 0 !important;
}

.ph-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100% !important; /* Forces vertical centering layout */
}

/* Logos state handling */
.ph-logo-col {
    display: flex;
    align-items: center;
    height: 100% !important;
}
.ph-logo-link {
    display: inline-flex;
    align-items: center;
    transition: opacity 0.3s ease;
    position: relative;
}
.ph-logo-img {
    display: block;
    transition: opacity 0.3s ease, transform 0.3s ease, width 0.3s ease, height 0.3s ease;
    max-height: 100% !important; /* Ensure logo never overrides or pushes header height */
    object-fit: contain;
}

/* Default state logo visibility */
.elementor-custom-header__logo-normal {
    opacity: 1;
    visibility: visible;
}
.elementor-custom-header__logo-sticky {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
}

/* Sticky active state logo visibility */
.ph-header-outer.ph-is-sticky .elementor-custom-header__logo-normal {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}
.ph-header-outer.ph-is-sticky .elementor-custom-header__logo-sticky {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    opacity: 1;
    visibility: visible;
}

/* Actions */
.ph-actions-col {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100% !important;
}

/* Project Button - 1. PREVENT TEXT WRAPPING */
.ph-projects-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    white-space: nowrap !important; /* Prevent wrapping strictly on all states */
    flex-shrink: 0;
    max-height: 100% !important; /* Do not break header height boundary */
}
.ph-btn-text {
    white-space: nowrap !important;
}

/* Hamburger */
.ph-hamburger-btn {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10001;
    transition: all 0.3s ease;
    max-height: 100% !important; /* Do not break header height boundary */
}
.ph-ham-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.ph-ham-sticky {
    display: none;
}

/* Universal Slide-In Side Panel */
.ph-side-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 400px;
    max-width: 100%;
    background: #fff;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
}
body.admin-bar .ph-side-panel {
    top: var(--wp-admin--admin-bar--height, 32px);
    height: calc(100vh - var(--wp-admin--admin-bar--height, 32px));
}
@media screen and (max-width: 782px) {
    body.admin-bar .ph-side-panel {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

.ph-side-panel-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 60px 40px;
    overflow-y: auto;
}

/* Independent Panel Close Button Styling */
.ph-panel-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    z-index: 10005;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Menu styling */
.ph-menu-list {
    list-style: none;
    padding: 0;
    margin: 40px 0 0 0;
}
.ph-menu-item {
    margin-bottom: 20px;
}
.ph-menu-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
.ph-menu-link {
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
    flex-grow: 1;
}
.ph-menu-text-wrap {
    display: inline-flex;
    align-items: center;
    transition: transform 0.3s ease;
}
.ph-item-icon {
    margin-right: 10px;
}

/* Submenu layout */
.ph-submenu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}
.ph-sub-indicator {
    display: inline-flex;
}
.ph-indicator-close {
    display: none;
}
.ph-submenu {
    list-style: none;
    padding-left: 20px;
    margin-top: 10px;
}
.ph-sub-item {
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}
.ph-sub-link {
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
}

/* Panel Overlay */
.ph-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Sticky Class Additions */
.ph-header-outer.ph-is-sticky {
    position: fixed;
    top: 0;
    animation: slideDown 0.3s ease-out;
}
@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
.ph-header-outer.ph-is-sticky .ph-ham-normal {
    display: none;
}
.ph-header-outer.ph-is-sticky .ph-ham-sticky {
    display: inline-flex;
}

/* Menu Opened Classes */
body.ph-panel-opened {
    overflow: hidden;
}
body.ph-panel-opened .ph-panel-overlay {
    opacity: 1;
    visibility: visible;
}
body.ph-panel-opened .ph-side-panel {
    transform: translateX(0);
}

/* 2. REMOVE DUPLICATE CLOSE ICON - Hide original Hamburger completely when panel is open */
body.ph-panel-opened .ph-hamburger-btn {
    display: none !important;
}

/* Active Submenus */
.ph-menu-item.ph-sub-active .ph-indicator-open {
    display: none;
}
.ph-menu-item.ph-sub-active .ph-indicator-close {
    display: inline-flex;
}
