@import url('tokens.css');

/* --- CORE STYLES --- */
/* :root block removed - using tokens.css */

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

a {
    text-decoration: none;
    color: var(--color-text-slate);
    transition: color 0.25s;
}

/* Fixed Header */
.navbar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: var(--shadow-nav);
    border-bottom: 1px solid #e6e6e6;
}

.nav-body {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.navbar-logo {
    z-index: 1005;
    position: relative;
}

.navbar-logo img {
    width: 224px;
    height: auto;
    display: block;
}

.nav-menu-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
}

.nav-links:not(.mobile) {
    display: flex;
    gap: 4px;
    align-items: center;
    transition: opacity 0.3s ease, filter 0.3s ease, transform 0.3s ease;
}

.nav-link {
    padding: 8px 12px;
    font-weight: 500;
    font-size: var(--font-size-base);
    border-radius: var(--border-radius-sm);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    color: var(--color-text-slate);
    white-space: nowrap;
}

.nav-link>.ph-bold {
    margin-left: 4px;
}

.nav-link:hover {
    color: var(--color-primary);
    background: rgba(28, 82, 139, 0.05);
}

.nav-links .nav-link.active {
    color: var(--color-primary);
}

.nav-buttons {
    display: flex;
    gap: 8px;
    margin-left: 12px;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
}

.btn-solid {
    background-color: var(--color-primary);
    color: white;
    border: 1px solid var(--color-primary);
}

.btn-solid:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
}

.btn-text {
    background-color: transparent;
    color: var(--color-text-slate);
    border: none;
    padding: 8px 16px;
    font-weight: 500;
}

.btn-text:hover {
    color: var(--color-primary);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: white;
}

/* --- New Header Elements --- */
.nav-left {
    display: flex;
    align-items: center;
}

.header-search {
    display: flex;
    align-items: center;
    width: 280px;
    border: 1px solid #ccc;
    border-radius: 24px;
    padding: 4px 16px;
    background: white;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.header-search input {
    border: none;
    outline: none;
    flex-grow: 1;
    padding: 0;
    height: 24px;
    line-height: 24px;
    font-size: var(--font-size-sm);
    color: var(--color-text-slate);
    background: transparent;
    z-index: 10;
    position: relative;
}

.header-search button.search-submit {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    display: flex;
    align-items: center;
    padding: 0;
    margin-right: 8px;
}

.header-search button.search-close {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #999;
    display: none;
    align-items: center;
    padding: 0 0 0 8px;
    transition: color 0.2s;
}

.header-search button.search-close:hover {
    color: var(--color-primary);
}

/* --- Dynamic Placeholder in Header --- */
.header-dynamic-placeholder {
    position: absolute;
    left: 48px;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    pointer-events: none;
    overflow: hidden;
    height: 24px;
    z-index: 5;
}

.header-dynamic-placeholder .static-label {
    color: var(--color-gray-500);
    white-space: nowrap;
    font-size: var(--font-size-sm);
    margin-right: 4px;
    line-height: 24px;
}

.header-dynamic-placeholder .placeholder-wrapper {
    position: relative;
    height: 100%;
    flex-grow: 1;
    overflow: hidden;
}

.header-dynamic-placeholder .placeholder-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    color: var(--color-gray-500);
    font-weight: 300;
    font-size: var(--font-size-sm);
    line-height: 24px;
    transition: transform 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

/* Animations for dynamic placeholder */
.slide-up {
    transform: translateY(-24px);
    opacity: 0;
}

.slide-down {
    transform: translateY(0);
    opacity: 1;
}

.slide-initial {
    transform: translateY(24px);
    opacity: 0;
}

/* Hide on focus */
.hide-on-focus {
    opacity: 0 !important;
    visibility: hidden;
    transition: opacity 0s, visibility 0s;
}

/* --- Search Active Animations --- */
.nav-menu-wrapper.search-active .nav-links:not(.mobile) {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-20px);
}

.nav-menu-wrapper.search-active .header-search {
    width: 750px;
    margin-left: -470px;
    /* 750 - 280 = 470px expanded left */
}

.nav-menu-wrapper.search-active .search-close {
    display: flex;
}

.mobile-search {
    display: none;
}

.dropdown-wrapper {
    position: absolute;
    left: 0;
    top: 65px;
    width: 100%;
    pointer-events: none;
    z-index: 999;
    perspective: 2000px;
}

.dropdown-background {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--color-white);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-soft);
    z-index: 1;
    transform-origin: 0 0;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dropdown-wrapper.open .dropdown-background {
    opacity: 1;
}

.dropdown-content-area {
    position: relative;
    z-index: 2;
}

.dropdown-menu {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    visibility: hidden;
    padding: 8px;
    display: grid;
    gap: 8px;
    min-width: 180px;
    transition: opacity 0.2s;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    color: var(--color-text-slate);
    font-size: var(--font-size-base);
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.dropdown-item:hover {
    color: var(--color-primary);
    background-color: var(--color-gray-100);
}

/* --- Mobile Elements --- */
.menu-toggle {
    display: none;
}

.mobile-nav-menu {
    display: none;
}

/* --- Mobile Breakpoint (Max-width 992px) --- */

@media (max-width: 992px) {

    .nav-menu-wrapper,
    .dropdown-wrapper {
        display: none !important;
    }

    /* --- STATIC HAMBURGER TOGGLE --- */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        position: relative;
        z-index: 1005;
        /* Above the menu */
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        font-size: var(--font-size-2xl);
        /* Icon size */
        color: var(--color-text-slate);
    }

    /* No spans, just the icon color change */
    .menu-toggle.active {
        color: var(--color-primary);
    }

    /* --- FULL SCREEN MOBILE MENU (STATIC) --- */
    .mobile-nav-menu {
        display: none;
        /* Hidden by default */
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: calc(100vh - 80px);
        /* Subtract header height */
        background: white;
        margin-top: 80px;
        padding: 16px 16px 100px 16px;
        /* Add bottom padding for scroll */

        /* NO TRANSITIONS, NO TRANSFORMS */
        z-index: 1001;
        overflow-y: auto;
    }

    /* Just display:flex when active */
    .mobile-nav-menu.active {
        display: flex;
    }

    .overlay {
        display: none;
    }

    .mobile-search {
        display: flex;
        align-items: center;
        width: 100%;
        border: 1px solid #ccc;
        border-radius: 24px;
        padding: 4px 16px;
        background: white;
        margin-bottom: 24px;
    }

    .mobile-search input {
        border: none;
        outline: none;
        flex-grow: 1;
        padding: 8px 0;
        font-size: var(--font-size-sm);
    }

    .mobile-search button {
        background: transparent;
        border: none;
        font-size: 20px;
        color: #666;
        cursor: pointer;
    }

    .mobile-nav-menu .nav-links {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .mobile-nav-menu .nav-item {
        border-bottom: 1px solid #f0f0f0;
        width: 100%;
    }

    .mobile-nav-menu .nav-item:last-child {
        border: none;
    }

    .mobile-nav-menu .nav-link {
        width: 100%;
        display: flex;
        justify-content: space-between;
        padding: 24px 16px;
        font-size: var(--font-size-md);
        font-weight: 500;
    }

    /* Rotate icon instantly */
    .nav-item.open>.nav-link i {
        transform: rotate(180deg);
        color: var(--color-primary);
    }

    .nav-item.open>.nav-link {
        color: var(--color-primary);
    }

    .mobile-menu-content {
        display: none;
        background: #fbfbfb;
        margin: 0 -16px;
        padding: 16px 32px 24px;
        border-bottom: 1px solid #eee;
    }

    .mobile-menu-content .dropdown-item {
        padding: 16px 8px;
        font-size: var(--font-size-md);
        color: #666;
    }

    .nav-buttons {
        flex-direction: column;
        margin: 32px 0 0 0;
        gap: 24px;
        width: 100%;
    }

    .nav-buttons .btn {
        width: 100%;
        padding: 16px;
        font-size: var(--font-size-base);
    }

    .mobile-nav-menu .nav-buttons .btn-text {
        border: 1px solid var(--color-primary);
        color: var(--color-primary);
    }
}

@media (max-width: 500px) {
    .navbar-container {
        max-width: 100vw;
    }

    .nav-body {
        padding: 16px;
    }
}