/* Shared Header Styles */

#header-placeholder {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    transform: translateY(0);
    transition: transform 0.3s ease-in-out;
}

/* Ensure site-header inside follows the parent transform */
#header-placeholder .site-header {
    position: relative;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.logo {
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: #ffffff;
    text-decoration: none;
    display: flex;
    align-items: center;
    letter-spacing: -0.01em;
}

.header-nav {
    display: flex;
    flex: 1;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-item {
    position: relative;
}

/* Hide mobile-only links on desktop */
.mobile-only-link {
    display: none !important;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

a.nav-link:hover {
    opacity: 0.7;
}

span.nav-link {
    cursor: default;
}

.nav-link[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: #000000;
    border: 1px solid rgba(1, 74, 51, 0.4);
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 1001;
    width: 280px;
    white-space: normal;
    text-align: center;
    line-height: 1.5;
}

.nav-link[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dropdown-arrow {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid #ffffff;
    border-bottom: 1.5px solid #ffffff;
    transform: rotate(45deg);
    margin-left: 2px;
    margin-bottom: 2px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem;
    min-width: 180px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 0;
    right: 0;
    height: 0.5rem;
}

.nav-item:hover .dropdown-menu,
.dropdown-menu:hover {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item {
    color: #ffffff;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    padding: 0.7rem 0.9rem;
    display: block;
    border-radius: 8px;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    min-width: 200px;
    min-height: 40px;
}

.header-actions-guest {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-actions-user {
    display: flex;
    align-items: center;
}

.btn-login {
    color: #ffffff;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    transition: opacity 0.2s;
}

.btn-login:hover {
    opacity: 0.7;
}

.btn-signup {
    background: #ffffff;
    color: #000000;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-signup:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* User Menu Styles */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: #000000;
}

.user-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    right: 0;
    left: auto;
    transform: translateX(0) translateY(-5px);
}

.user-menu:hover .user-dropdown,
.user-dropdown:hover {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) translateY(0);
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 0;
}

.logout-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #ffffff;
}

/* Hamburger Menu Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10001;
    position: relative;
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
    position: absolute;
}

.hamburger-line:nth-child(1) {
    top: 8px;
}

.hamburger-line:nth-child(2) {
    top: 14px;
}

.hamburger-line:nth-child(3) {
    top: 20px;
}

.mobile-menu-toggle.active .hamburger-line {
    background: #000000;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    top: 14px;
    transform: rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    top: 14px;
    transform: rotate(-45deg);
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
}

/* Mobile Navigation */
@media (max-width: 968px) {
    .site-header {
        border-bottom: none;
    }

    .header-container {
        padding: 1rem 1.5rem;
        gap: 0;
        justify-content: space-between;
    }

    .logo {
        font-size: 0.9rem;
        flex-shrink: 0;
        z-index: 10001;
        position: relative;
    }

    .mobile-menu-toggle {
        display: flex;
        z-index: 10001;
        position: relative;
    }

    .header-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        background: #ffffff;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 5rem 2rem 2rem 2rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 10000;
        overflow-y: auto;
    }

    .header-nav.active {
        transform: translateX(0);
    }

    .nav-links {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        align-items: stretch;
        margin-bottom: 2rem;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        width: 100%;
    }

    .nav-item {
        display: none !important;
    }

    .mobile-only-link {
        display: block !important;
    }

    .nav-link {
        font-size: 1.25rem;
        padding: 1.25rem 0;
        display: block !important;
        color: #000000 !important;
        font-weight: 600;
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        opacity: 1 !important;
        visibility: visible !important;
    }

    .nav-link.desktop-only-link {
        display: none !important;
    }

    /* Color each menu item uniquely */
    .mobile-only-link:nth-of-type(1) {
        color: #3b82f6 !important; /* Blue for Search */
    }

    .mobile-only-link:nth-of-type(2) {
        color: #a855f7 !important; /* Purple for Master */
    }

    .nav-links > a[href="/pricing"] {
        color: #ef4444 !important; /* Red for Pricing */
    }

    .nav-links > a[href="/blog"] {
        color: #f97316 !important; /* Orange for Blog */
    }

    .nav-item .nav-link {
        border-bottom: none;
    }

    a.nav-link:hover {
        opacity: 0.7;
    }

    span.nav-link {
        cursor: default;
        opacity: 0.6;
        position: relative;
    }

    span.nav-link[data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        left: 50%;
        top: calc(100% + 0.75rem);
        transform: translateX(-50%);
        background: #000000;
        border: 1px solid #000000;
        border-radius: 8px;
        padding: 0.625rem 1rem;
        font-size: 0.8rem;
        font-weight: 400;
        color: #ffffff;
        white-space: normal;
        width: calc(100vw - 6rem);
        max-width: 280px;
        text-align: center;
        line-height: 1.5;
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
        z-index: 10002;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }

    span.nav-link[data-tooltip]:active::after {
        opacity: 1;
    }

    .dropdown-arrow {
        width: 8px;
        height: 8px;
        border-width: 1.5px;
        margin-left: 0.5rem;
        border-color: #000000 !important;
    }

    .dropdown-menu {
        position: static !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0;
        padding: 0;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        pointer-events: auto;
        box-shadow: none !important;
        min-width: auto;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
        width: 100%;
    }

    .dropdown-menu::before {
        display: none !important;
    }

    .nav-item.dropdown-open .dropdown-menu {
        max-height: 300px !important;
        opacity: 1 !important;
        padding: 0.5rem 0 0.75rem 1.5rem !important;
        display: block !important;
        overflow: visible !important;
        visibility: visible !important;
        background: rgba(0, 0, 0, 0.03) !important;
    }

    .nav-item.dropdown-open .dropdown-item {
        display: block !important;
    }

    .dropdown-menu .dropdown-item,
    a.dropdown-item {
        font-size: 1rem !important;
        padding: 0.75rem 0 !important;
        border-radius: 0 !important;
        color: #000000 !important;
        font-weight: 500 !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        text-decoration: none !important;
        background: transparent !important;
        border: none !important;
        width: 100%;
        text-align: left;
        line-height: 1.5 !important;
        position: relative;
        z-index: 1;
    }

    .nav-item.dropdown-open .dropdown-menu .dropdown-item,
    .nav-item.dropdown-open a.dropdown-item {
        color: #000000 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .dropdown-menu .dropdown-item:hover,
    .dropdown-menu .dropdown-item:focus,
    .dropdown-menu .dropdown-item:active,
    a.dropdown-item:hover,
    a.dropdown-item:focus,
    a.dropdown-item:active {
        background: transparent !important;
        opacity: 0.7 !important;
    }

    .header-actions {
        display: flex !important;
        flex-direction: column;
        gap: 1rem;
        padding-top: 1.5rem;
        width: 100%;
    }

    .btn-login {
        font-size: 1rem !important;
        padding: 1rem !important;
        text-align: center;
        background: transparent !important;
        border: 2px solid #000000 !important;
        border-radius: 10px;
        display: block !important;
        transition: all 0.2s;
        color: #000000 !important;
        text-decoration: none;
        font-weight: 600;
    }

    .btn-login:hover {
        background: #000000 !important;
        color: #ffffff !important;
        border-color: #000000 !important;
        opacity: 1 !important;
    }

    .btn-signup {
        padding: 1rem !important;
        font-size: 1rem !important;
        border-radius: 10px;
        display: block !important;
        text-align: center;
        background: #000000 !important;
        color: #ffffff !important;
        text-decoration: none;
        border: 2px solid #000000 !important;
        font-weight: 600;
    }

    .btn-signup:hover {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .nav-link[data-tooltip]::after {
        display: none;
    }

    /* User menu mobile styles */
    .user-menu {
        width: 100%;
    }

    .user-menu-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 1rem !important;
        font-size: 1rem !important;
        border-radius: 10px;
        background: transparent !important;
        border: 2px solid #000000 !important;
        color: #000000 !important;
    }

    .user-menu-toggle:hover {
        background: #000000 !important;
        color: #ffffff !important;
    }

    .user-menu-toggle:hover .user-avatar {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .user-menu-toggle:hover .dropdown-arrow {
        border-color: #ffffff !important;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
        background: #000000 !important;
        color: #ffffff !important;
    }

    .user-name {
        max-width: none;
        flex: 1;
    }

    .user-dropdown {
        position: static !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0;
        padding: 0;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        pointer-events: auto;
        box-shadow: none !important;
        min-width: auto;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
        width: 100%;
    }

    .user-menu.dropdown-open .user-dropdown {
        max-height: 200px !important;
        opacity: 1 !important;
        padding: 0.5rem 0 0.75rem 1.5rem !important;
        display: block !important;
        overflow: visible !important;
        visibility: visible !important;
        background: rgba(0, 0, 0, 0.03) !important;
    }

    .user-dropdown .dropdown-item {
        font-size: 1rem !important;
        padding: 0.75rem 0 !important;
        border-radius: 0 !important;
        color: #000000 !important;
        font-weight: 500 !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        text-decoration: none !important;
        background: transparent !important;
        border: none !important;
        width: 100%;
        text-align: left;
    }

    .user-dropdown .dropdown-item:hover {
        opacity: 0.7 !important;
    }

    .dropdown-divider {
        margin: 0.75rem 0;
        opacity: 0.1;
        background: #000000;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 1rem 1.25rem;
    }

    .logo {
        font-size: 0.85rem;
    }

    .mobile-menu-toggle {
        width: 26px;
        height: 26px;
    }

    .header-nav {
        padding: 4.5rem 1.5rem 1.5rem 1.5rem;
    }

    .nav-link {
        font-size: 1.15rem;
        padding: 1.15rem 0;
    }

    .dropdown-item {
        font-size: 0.95rem;
        padding: 0.7rem 0;
    }

    .btn-login, .btn-signup {
        font-size: 0.95rem;
        padding: 0.925rem;
    }
}
