/**
 * Planloom Premium Header V2 - Consolidated
 * Unified styles for Top Bar, Logo, Navigation, Tools, and Offcanvas.
 */

:root {
    --pl-header-bg: #ffffff;
    --pl-header-text: #1e293b;
    --pl-header-accent: #4f46e5;
    --pl-header-border: rgba(0, 0, 0, 0.05);
    --pl-glass-bg: rgba(255, 255, 255, 0.85);
    --pl-glass-blur: 15px;
    --pl-container-width: 1200px; /* Can be overridden by inline style */
}

/* 1. Base Architecture */
.pl-header-wrapper {
    position: relative;
    width: 100%;
    z-index: 1000;
}

.pl-header-container {
    max-width: var(--pl-container-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
}

/* 2. Top Bar */
.pl-topbar {
    font-size: 13px;
    padding: 8px 0;
    border-bottom: 1px solid var(--pl-header-border);
    background: #fff;
}

.pl-topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--pl-container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.pl-topbar a {
    text-decoration: none;
    transition: color 0.3s;
    color: inherit;
}

.pl-topbar p {
    margin: 0;
}

/* 3. Main Header & Layouts */
.pl-main-header {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--pl-header-bg);
    border-bottom: 1px solid var(--pl-header-border);
}

.pl-layout--logo-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pl-layout--logo-center {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 40px;
}

.pl-layout--logo-center .pl-logo {
    grid-column: 2 / 3;
    justify-self: center;
}

.pl-layout--logo-center .pl-nav-desktop {
    grid-column: 1 / 2;
}

.pl-layout--logo-center .pl-header-tools {
    grid-column: 3 / 4;
    justify-self: end;
}

.pl-layout--logo-center .pl-nav-desktop ul {
    justify-content: flex-end;
}

@media (max-width: 1024px) {
    .pl-layout--logo-center {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
}

/* 4. Sticky Behaviors */
.pl-sticky-enabled.is-sticky {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    animation: pl-slide-down 0.4s ease forwards;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

@keyframes pl-slide-down {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.pl-glass-enabled.is-sticky .pl-main-header {
    background: var(--pl-glass-bg);
    backdrop-filter: blur(var(--pl-glass-blur));
    -webkit-backdrop-filter: blur(var(--pl-glass-blur));
}

.pl-shrink-enabled.is-sticky .pl-main-header {
    min-height: 60px !important;
}

.pl-shrink-enabled.is-sticky .pl-logo img {
    max-height: 40px !important;
}

/* 5. Logo Styles */
.pl-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.pl-logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
    line-height: 1;
}

.pl-logo img {
    max-height: 80px;
    width: auto;
    transition: all 0.3s ease;
    display: block;
}

.pl-logo-mobile {
    display: none !important;
}

/* Switch logic via class */
.pl-has-mobile-logo .pl-logo-desktop {
    display: block;
}

@media (max-width: 1024px) {
    .pl-has-mobile-logo .pl-logo-desktop {
        display: none !important;
    }
    .pl-has-mobile-logo .pl-logo-mobile {
        display: block !important;
    }
}

/* 6. Navigation Desktop */
.pl-nav-desktop {
    flex-grow: 1;
    display: flex;
    margin: 0 40px;
}

.pl-nav-desktop ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.pl-nav-desktop > ul > li {
    position: relative;
    padding: 20px 0;
}

.pl-nav-desktop > ul > li > a {
    text-decoration: none;
    font-weight: 600;
    color: var(--pl-header-text);
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    transition: color 0.3s;
}

/* Hover Pointer Effect */
.pl-nav-desktop > ul > li > a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--pl-header-accent);
    transition: width 0.3s ease;
}

.pl-nav-desktop > ul > li:hover > a::after,
.pl-nav-desktop .current-menu-item > a::after {
    width: 100%;
}

.pl-nav-desktop > ul > li:hover > a,
.pl-nav-desktop .current-menu-item > a {
    color: var(--pl-header-accent);
}

/* Standard Dropdowns */
.pl-nav-desktop .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 15px 0;
    z-index: 99;
    flex-direction: column;
    gap: 0;
    pointer-events: none;
}

.pl-nav-desktop li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.pl-nav-desktop .sub-menu li {
    padding: 0;
    width: 100%;
}

.pl-nav-desktop .sub-menu a {
    padding: 10px 25px;
    display: block;
    color: #475569;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #f1f5f9;
}

.pl-nav-desktop .sub-menu li:last-child a {
    border-bottom: none;
}

.pl-nav-desktop .sub-menu a:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--pl-header-accent);
    padding-left: 30px;
}

/* Mega Menu Support */
.pl-nav-desktop .menu-item-has-mega-menu {
    position: static;
}

.pl-nav-desktop .mega-menu-wrapper {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 99;
    border-radius: 0 0 12px 12px;
    pointer-events: none;
}

.pl-nav-desktop .menu-item-has-mega-menu:hover .mega-menu-wrapper {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Dropdown Animations */
.dropdown-anim-fade-down .sub-menu { transform: translateY(-10px); }
.dropdown-anim-fade-up .sub-menu { transform: translateY(20px); }
.dropdown-anim-none .sub-menu { transition: none; transform: none; }

/* 7. Tools: CTA & Search */
.pl-header-tools {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.pl-header-cta {
    background: var(--pl-header-accent);
    color: #fff !important;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.pl-header-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
    color: #fff !important;
}

/* Search Component */
.pl-search-toggle {
    cursor: pointer;
    font-size: 18px;
    color: var(--pl-header-text);
    transition: color 0.3s;
    background: none;
    border: none;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.pl-search-toggle:hover {
    color: var(--pl-header-accent);
    background: #f1f5f9;
}

.pl-search-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: #fff;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.pl-search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pl-search-dropdown input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.pl-search-dropdown input:focus {
    border-color: var(--pl-header-accent);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.pl-ajax-results {
    margin-top: 15px;
    max-height: 350px;
    overflow-y: auto;
    display: none;
}

.pl-ajax-results.has-results {
    display: block;
}

/* AJAX Search Results Styling */
.pl-ajax-search-results-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pl-ajax-search-results-list li {
    border-bottom: 1px solid #f1f5f9;
}

.pl-ajax-search-results-list li:last-child {
    border-bottom: none;
}

.pl-ajax-search-results-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    text-decoration: none;
    transition: all 0.2s;
}

.pl-ajax-search-results-list a:hover {
    background: #f8fafc;
}

.pl-search-thumb img {
    width: 45px;
    height: 45px;
    border-radius: 6px;
    object-fit: cover;
}

.pl-search-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--pl-header-text);
}

.pl-search-date {
    font-size: 12px;
    color: #64748b;
}

.pl-search-view-all {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
    margin-top: 5px;
}

.pl-search-view-all a {
    font-size: 13px;
    font-weight: 600;
    color: var(--pl-header-accent);
    text-decoration: none;
}

/* 8. Offcanvas Mobile */
.pl-offcanvas-toggle {
    display: none; /* Desktop hidden */
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: none;
    border: none;
    color: var(--pl-header-text);
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 1024px) {
    .pl-nav-desktop, .pl-header-cta { display: none; }
    .pl-offcanvas-toggle { display: flex; }
}

.pl-offcanvas-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 320px;
    max-width: 85%;
    background: #fff;
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.15);
    padding: 60px 30px 40px;
    overflow-y: auto;
}

.pl-offcanvas-right { right: 0; transform: translateX(100%); }
.pl-offcanvas-left { left: 0; transform: translateX(-100%); }
.pl-offcanvas-top {
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    bottom: auto;
    transform: translateY(-100%);
    border-radius: 0 0 24px 24px;
}

.pl-offcanvas-panel.active {
    transform: translate(0, 0);
}

.pl-offcanvas-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #f1f5f9;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.pl-offcanvas-close:hover {
    background: #e2e8f0;
    transform: rotate(90deg);
}

.pl-offcanvas-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.pl-offcanvas-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Offcanvas Content Styles */
.pl-offcanvas-nav ul {
    list-style: none;
    padding: 0;
    margin: 30px 0;
}

.pl-offcanvas-nav li {
    border-bottom: 1px solid #f1f5f9;
}

.pl-offcanvas-nav a {
    display: block;
    padding: 15px 0;
    color: var(--pl-header-text);
    font-weight: 600;
    text-decoration: none;
    font-size: 16px;
    transition: color 0.2s;
}

.pl-offcanvas-nav a:hover {
    color: var(--pl-header-accent);
}

.pl-offcanvas-nav .sub-menu {
    display: none;
    padding-left: 20px;
    border-top: 1px dashed #f1f5f9;
    margin-bottom: 10px;
    list-style: none;
}

.pl-offcanvas-text {
    margin-bottom: 30px;
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

/* 9. Utilities & Fixes */
.elementor-editor-active .pl-offcanvas-show-editor {
    transform: translateX(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: all;
}

/* Elementor SVG Icon Compatibility */
.e-font-icon-svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
}

.pl-search-toggle svg,
.pl-offcanvas-toggle svg {
    width: 20px;
    height: 20px;
}

/* Scroll Lock */
body.pl-no-scroll {
    overflow: hidden;
}