/* Tab order: nav is before search in DOM. Visual order: use flex order so buttons are left of search on desktop. */
.nhsuk-header__content {
    display: flex;
    flex-wrap: wrap;
}

.nhsuk-header__content .nhsuk-header__menu {
    order: 0;
}
.nhsuk-header__content .header-btn-links {
    order: 1;
}
.nhsuk-header__content .nhsuk-header__search {
    order: 2;
}

.header-btn-links {
    display: flex;
    justify-content: flex-end;
    background: transparent;
    position: relative;
}

.header-btn-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 6px;
}

.header-btn-list li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.header-btn-link {
    display: inline-block;
    padding: 6px 20px;
    text-decoration: none;
    border-radius: 5px;
    border: 1px solid #ffffff;
    transition: all 0.3s ease;
    font-size: 14px;
}

.header-btn-link:visited {
    color: white;
}

.header-btn-link:focus,
.header-btn-link:focus-visible {
    outline: 3px solid #ffeb3b;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px #212b32;
}

.register-link {
    background-color: #0065BD;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

.register-link .nhsuk-icon {
    fill: currentColor;
    vertical-align: middle;
    height: 18px;
    width: 18px;
    display: none;
}

.register-link:hover,
.register-link:focus {
    background-color: #ffffff;
    border: 1px solid #0065BD;
    color: #0065BD !important;
}

.register-link:hover .nhsuk-icon,
.register-link:focus .nhsuk-icon {
    fill: #0065BD;
}

.login-link {
    background-color: #DB3328;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

.login-link .nhsuk-icon {
    fill: currentColor;
    vertical-align: middle;
    height: 18px;
    width: 18px;
    display: none;
}

.login-link:hover,
.login-link:focus {
    background-color: #ffffff;
    border: 1px solid #DB3328;
    color: #DB3328 !important;
}

.login-link:hover .nhsuk-icon,
.login-link:focus .nhsuk-icon {
    fill: #DB3328;
}

.phone-link {
    background-color: #005EB8;
    color: white !important;
    padding: 6px 12px;
}

.phone-link:hover{
    background-color: #ffffff;
    border: 1px solid #005EB8;
}

/*
.phone-link:focus {
    background-color: #ffffff;
    border: 2px solid #000000;
    outline: 2px solid #ffeb3b !important;
}
*/
.phone-link svg {
    fill: currentColor;
    vertical-align: middle;
    height: 18px;
    width: 18px;
}

.phone-link:hover svg,
.phone-link:focus svg {
    fill: #005EB8;
}

/* Modal Styles */
.phone-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.phone-modal-content {
    background-color: #ffffff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 500px;
    border-radius: 4px;
    position: relative;
    text-align: center;
}

.phone-modal-content p {
    margin: 20px 0 0 0;
    padding: 10px;
    color: #212b32;
}

.phone-modal-title { font-size: 16px; }

.phone-modal-number { font-weight: 700; font-size: 40px; }
.phone-modal-number a { text-decoration: none; }

.phone-modal-hours { font-size: 16px; }

.phone-modal-close {
    position: absolute;
    right: 10px;
    top: 5px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.phone-modal-close:hover,
.phone-modal-close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.phone-modal-close:focus,
.phone-modal-close:focus-visible,
.phone-modal-content a:focus,
.phone-modal-content a:focus-visible {
    outline: 3px solid #ffeb3b;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px #212b32;
}

/* Mobile Styles */
@media screen and (max-width: 824px) {
    .phone-modal-content {
        width: 90%;
        margin: 30% auto;
        padding: 15px;
    }

    /* Buttons above menu and search on mobile: first in flex order, full width so they sit on their own row */
    .nhsuk-header__content .header-btn-links {
        order: -1;
        width: 100%;
        margin-bottom: 10px;
    }
    .nhsuk-header__content .nhsuk-header__menu {
        order: 0;
    }
    .nhsuk-header__content .nhsuk-header__search {
        order: 1;
    }

    .header-btn-links {
        display: flex;
        justify-content: flex-end;
        max-width: 100%;
        top: 5px;
    }

    .header-btn-list {
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    .login-link,
    .register-link {
        padding: 6px 12px;
    }

    /* Hide Register text + show icon only; keep Login text label visible on mobile */
    .register-link .register-text {
        display: none;
    }
    .register-link .nhsuk-icon {
        display: block;
    }
    .login-link .login-text {
        display: inline;
    }
    .login-link .nhsuk-icon {
        display: none;
    }

    .header-btn-links .register-link {
        display: none;
    }
}

@media screen and (min-width: 825px) and (max-width: 990px) {
    .header-btn-links {
        display: flex;
        position: relative;
        width: 240px;
        float: right;
        top: 10px;
        justify-content: flex-end;
    }
}


@media screen and (min-width: 825px) and (max-width: 833px) {
    .header-btn-links {
        display: none;
    }
}

@media screen and (min-width: 765px) and (max-width: 769px) {
    .header-btn-links {
        display: none;
    }
}