/*
 * public/css/navbar.css
 * ---------------------------------------------------------------------------
 * PURPOSE:
 *   Styles for the top navigation bar, including the user dropdown menu.
 * ---------------------------------------------------------------------------
 */

/* -------------------------------------------------------------------------- */
/* NAVBAR                                                                     */
/* -------------------------------------------------------------------------- */

.nav-box {
    position: relative;
    width: 100%;
    height: var(--header-height, 80px);
}

#nav-main {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 120;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;

    width: 100%;
    height: var(--header-height, 80px);

    background-color: var(--bg-primary, #FFFFFF);
    border-bottom: 1px solid var(--tertiary, #EBEBEB);
    box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

#nav-main-bar {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    height: var(--header-height, 80px);
    min-width: 0;
}

.nav-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 0.75rem;
}

.nav-icon a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.imgAirbnb {
    display: block;

    width: 6.2rem;
    height: 2rem;
    max-width: none;

    margin-top: 3px;
    margin-left: 0.75rem;

    object-fit: contain;
    filter: none;
}

/* -------------------------------------------------------------------------- */
/* USER MENU                                                                  */
/* -------------------------------------------------------------------------- */

.nav-user {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;

    min-width: 5.5rem;
    height: 3rem;

    margin-right: 1.5rem;
    padding: 0.35rem 0.35rem 0.35rem 0.7rem;

    background-color: var(--bg-primary, #FFFFFF);
    border: 1px solid var(--border-light, #DDDDDD);
    border-radius: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

    cursor: pointer;

    transition:
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.nav-user-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.nav-menu-icon {
    position: relative;
    display: inline-block;
    flex: 0 0 1.35rem;
    width: 1.35rem;
    height: 1.35rem;
}

.nav-user:hover {
    box-shadow: var(--shadow-tertiary, 0 2px 4px rgba(0, 0, 0, 0.18));
    border-color: rgba(34, 34, 34, 0.35);
}

.nav-user:focus-visible {
    outline: 2px solid var(--text-dark, #222222);
    outline-offset: 3px;
}

#png-img-bar {
    position: absolute;
    inset: 50% auto auto 50%;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    object-fit: contain;
    transform: translate(-50%, -50%);
}

#png-img-cross {
    position: absolute;
    inset: 50% auto auto 50%;
    display: none;
    width: 1.3rem;
    height: 1.3rem;
    margin: 0;
    object-fit: contain;
    transform: translate(-50%, -50%);
}

#png-img-user {
    width: 2rem;
    height: 2rem;
    max-width: none;

    border-radius: 50%;
    object-fit: cover;
    filter: none;
}

/* -------------------------------------------------------------------------- */
/* USER DROPDOWN                                                              */
/* -------------------------------------------------------------------------- */

.user-fnx {
    position: absolute;
    top: 4.5rem;
    right: 1.2rem;
    z-index: 125;

    display: flex;
    flex-direction: column;
    justify-content: center;

    width: min(15rem, calc(100vw - 2rem));
    min-height: 0;

    padding: 0.75rem;

    background-color: var(--bg-primary, #FFFFFF);
    border: 1px solid var(--border-light, #DDDDDD);
    border-radius: var(--radius-medium, 12px);

    box-shadow: var(--shadow-high, 0 8px 28px rgba(0, 0, 0, 0.28));
}

.user-fnx a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.7rem;

    width: 100%;
    min-width: 9.5rem;
    min-height: 2.6rem;

    padding: 0.55rem 0.75rem;

    color: var(--text-dark, #222222);
    font-size: 0.9rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;

    border: none;
    border-radius: var(--radius-small, 8px);

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.user-fnx a i {
    width: 1.1rem;
    color: var(--text-light, #717171);
    text-align: center;
}

.user-fnx a span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-fnx a:hover {
    color: var(--text-dark, #222222);
    background-color: var(--bg-hover, #F7F7F7);

    border: none;
    box-shadow: none;
}

.user-fnx a:active {
    background-color: var(--tertiary, #EBEBEB);
    box-shadow: none;
}

.user-fnx a:focus-visible {
    outline: 2px solid var(--text-dark, #222222);
    outline-offset: -2px;
}

/* -------------------------------------------------------------------------- */
/* SEARCH                                                                     */
/* -------------------------------------------------------------------------- */

.nav-search {
    display: flex;
    align-items: center;
    justify-content: center;

    width: min(34rem, 42vw);
    min-width: 18rem;
    height: 3.5rem;

    padding: 0.35rem 0.35rem 0.35rem 0.75rem;

    background-color: var(--bg-primary, #FFFFFF);
    border: 1px solid var(--border-light, #DDDDDD);
    border-radius: 50px;

    transition:
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.nav-search:hover {
    box-shadow: var(--shadow-secondary, 0 6px 16px rgba(0, 0, 0, 0.12));
}

.nav-search:focus-within {
    border-color: var(--border-light, #DDDDDD);
    box-shadow: var(--shadow-secondary, 0 6px 16px rgba(0, 0, 0, 0.12));
}

.nav-search form {
    display: flex;
    align-items: center;

    width: 100%;
    min-width: 0;
    height: 100%;
    gap: 0.5rem;

    margin: 0;
    padding: 0;

    border: none;
    background: transparent;
}

.nav-hover {
    box-shadow: none;
}

.nav-hover:active {
    box-shadow: none;
}

/* Match the IDs used by views/includes/navbar.ejs */
#mySearchInput-desktop,
#mySearchInput-mobile {
    display: block;
    flex: 1 1 auto;

    width: 100%;
    min-width: 0;
    height: 2.75rem;

    margin: 0;
    padding: 0 0.4rem;

    color: var(--text-dark, #222222);
    background-color: transparent;

    border: none;
    border-radius: 50px;
    outline: none;
    box-shadow: none;

    font-family: var(--font-body, inherit);
    font-size: 0.9rem;
}

#mySearchInput-desktop::placeholder,
#mySearchInput-mobile::placeholder {
    color: var(--text-light, #717171);
    opacity: 1;
}

#mySearchInput-desktop::-webkit-search-cancel-button,
#mySearchInput-mobile::-webkit-search-cancel-button {
    cursor: pointer;
}

#search-desktop,
#search-mobile {
    display: flex;
    flex: 0 0 2.75rem;
    align-items: center;
    justify-content: center;

    width: 2.75rem;
    height: 2.75rem;
    padding: 0;

    color: #FFFFFF;
    background-color: var(--airbnb-red, #FF385C);

    border: none;
    border-radius: 50%;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        transform 0.15s ease;
}

#search-desktop:hover,
#search-mobile:hover {
    background-color: var(--airbnb-red-dark, #E61E4D);
}

#search-desktop:active,
#search-mobile:active {
    transform: scale(0.96);
}

#search-desktop i,
#search-mobile i {
    color: #FFFFFF;
    font-size: 0.85rem;
}

#search-desktop:focus-visible,
#search-mobile:focus-visible {
    outline: 2px solid var(--text-dark, #222222);
    outline-offset: 3px;
}

/* -------------------------------------------------------------------------- */
/* MOBILE SEARCH                                                              */
/* -------------------------------------------------------------------------- */

#nav-search-hide {
    display: none;
}

@media (max-width: 767px) {
    :root {
        --header-height: 8rem;
    }

    .nav-box,
    #nav-main {
        height: 8rem;
    }

    #nav-main-bar {
        height: 4.5rem;
        flex: 0 0 4.5rem;
    }

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

    #nav-search-hide {
        display: flex;
        align-items: center;

        width: calc(100% - 2rem);
        max-width: 42rem;
        height: 3.5rem;
        min-height: 0;
    }

    #nav-search-hide .nav-search {
        width: 100%;
        min-width: 0;
        height: 3rem;
    }

    #nav-search-hide #mySearchInput-mobile {
        width: 100%;
        height: 2.5rem;
    }

    #nav-search-hide #search-mobile {
        flex-basis: 2.35rem;
        width: 2.35rem;
        height: 2.35rem;
    }

    .nav-user {
        margin-right: 1rem;
    }

    .imgAirbnb {
        margin-left: 0.5rem;
    }

    .user-fnx {
        top: 4.7rem;
        right: 0.75rem;
    }
}

/* -------------------------------------------------------------------------- */
/* SMALL MOBILE SCREENS                                                       */
/* -------------------------------------------------------------------------- */

@media (max-width: 360px) {
    .imgAirbnb {
        width: 5.5rem;
        margin-left: 0.25rem;
    }

    .nav-icon {
        margin-left: 0.25rem;
    }

    .nav-user {
        min-width: 4.75rem;
        margin-right: 0.6rem;
        padding-left: 0.4rem;
    }

    #png-img-bar {
        margin: 0;
    }

    #png-img-cross {
        margin: 0;
    }
}

/* -------------------------------------------------------------------------- */
/* REDUCED MOTION                                                             */
/* -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .nav-user,
    .nav-search,
    .user-fnx a,
    #search-desktop,
    #search-mobile {
        transition: none;
    }
}
