/* =========================================
   WooLogger Header Styles
   Optimized & Modular
   ========================================= */

/* 1. HEADER BAR */
.site-header {
    position: fixed;
    top: var(--sp-3);
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1100px;
    z-index: var(--z-header);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-3) var(--sp-4);
    gap: var(--sp-4);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* 2. LOGO */
.logo {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--c-text);
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--c-text);
    color: var(--c-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

/* 3. NAVIGATION */
.header-nav {
    display: flex;
    gap: var(--sp-6);
}

.header-nav a {
    color: var(--c-text-muted);
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.header-nav a:hover {
    color: var(--c-text);
}

/* 4. ICON BUTTONS */
.icon-btn, .avatar-btn, .menu-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--c-text);
    transition: background var(--transition-fast);
}

.icon-btn:hover, .avatar-btn:hover {
    background: var(--c-surface-alt);
}

.avatar-btn img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Menu Toggle (Hamburger) */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
}

.menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--c-text);
    border-radius: 2px;
    transition: all var(--transition-normal);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 5. VISIBILITY UTILITIES */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: flex !important;
}

/* 6. BACKDROP */
.overlay-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: calc(var(--z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    display: none;
    transition: all var(--transition-normal);
}

.overlay-backdrop.active {
    opacity: 1;
    visibility: visible;
    display: block;
}

/* 7. DRAWERS (Mobile Menu & Profile) */
.drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background: var(--c-surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: var(--z-modal);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition-slow), opacity var(--transition-normal), visibility var(--transition-normal);
    overflow-y: auto;
}

.drawer.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.drawer-handle {
    padding: var(--sp-3) 0;
    display: flex;
    justify-content: center;
    cursor: grab;
}

.drawer-handle::before {
    content: '';
    width: 40px;
    height: 5px;
    background: var(--c-border);
    border-radius: 3px;
}

.drawer-content {
    padding: 0 var(--sp-4) var(--sp-6);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.drawer-nav a {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    color: var(--c-text);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.drawer-nav a:hover {
    background: var(--c-surface-alt);
}

.drawer-nav a svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.drawer-nav a.nav-logout {
    color: var(--c-error);
}

.drawer-header {
    display: flex;
    justify-content: center;
    padding-bottom: var(--sp-3);
    border-bottom: 1px solid var(--c-border);
}

.drawer-footer {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--c-border);
}

/* 8. PROFILE CARD */
.profile-card {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--c-surface-alt);
    border-radius: var(--radius-lg);
    border: 1px solid var(--c-border);
}

.profile-avatar img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.profile-name {
    font-weight: 700;
    color: var(--c-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.profile-email {
    font-size: 0.875rem;
    color: var(--c-text-muted);
}

/* 9. CTA BUTTON */
.btn-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-3) var(--sp-4);
    background: var(--c-text);
    color: var(--c-bg);
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: opacity var(--transition-fast);
}

.btn-cta:hover {
    opacity: 0.9;
}

/* 10. SEARCH OVERLAY */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.search-overlay.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.search-container {
    width: 100%;
    max-width: 600px;
    padding: 0 var(--sp-4);
}

.search-box {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-4);
    background: var(--c-surface);
    border: 2px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.search-box svg {
    color: var(--c-text-muted);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--c-text);
    outline: none;
}

.search-box button {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--c-text-muted);
    padding: var(--sp-1);
}

.search-results {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    width: 100%;
    max-height: 60vh;
    overflow-y: auto;
    margin-top: var(--sp-4);
}

.search-results:empty {
    display: none;
}

.search-results-item {
    display: flex;
    gap: var(--sp-4);
    padding: var(--sp-4);
    border-bottom: 1px solid var(--c-border);
    cursor: pointer;
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-2);
    transition: all var(--transition-fast);
}

.search-results-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.search-results-item:hover {
    background: var(--c-surface-alt);
    transform: translateX(4px);
}

.search-results-item img {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.search-results-item h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 var(--sp-2);
}

.search-results-item p {
    font-size: 0.875rem;
    color: var(--c-text-muted);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-empty, .search-results-empty, .search-results-loading {
    padding: calc(var(--sp-8) * 1.25) var(--sp-4);
    text-align: center;
    color: var(--c-text-muted);
}

/* 11. RESPONSIVE */
@media (min-width: 1025px) {
    .site-header .drawer {
        display: none !important;
    }
}

@media (max-width: 1024px) {
    .header-nav {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }

    .site-header .mobile-only {
        display: flex;
    }

    .site-header .desktop-only {
        display: none;
    }

    .header-left .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .header-left .logo span {
        display: none;
    }
}

@media (max-width: 768px) {
    .site-header {
        width: 95%;
        top: var(--sp-2);
    }

    .header-inner {
        padding: var(--sp-2) var(--sp-3);
    }

    .icon-btn, .avatar-btn, .menu-toggle {
        width: 36px;
        height: 36px;
    }

    .search-results {
        max-height: 50vh;
    }
}

@media (max-width: 480px) {
    .site-header {
        width: 98%;
    }

    .header-inner {
        padding: var(--sp-2);
    }

    .icon-btn, .avatar-btn, .menu-toggle {
        width: 32px;
        height: 32px;
    }
}
