/**
 * TAPOS Customer Account
 *
 * Styles for the [tapos_account] icon and dropdown, and the
 * [tapos_account_page] embeds. Deliberately low-specificity and
 * colour-neutral (currentColor) so the icon inherits the header it sits in.
 */

.tapos-account {
    position: relative;
    display: inline-block;
    text-align: left;
    vertical-align: middle;
}

/* ---------------------------------------------------------------- Toggle */

.tapos-account-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    border-radius: 4px;
    background: none;
    color: inherit;
    font: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.tapos-account-toggle:hover {
    opacity: 0.75;
}

.tapos-account-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.tapos-account-icon {
    display: inline-flex;
    align-items: center;
}

.tapos-account-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.tapos-account--icon-only .tapos-account-label {
    /* Visually hidden, still announced by screen readers */
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Caret only appears once there is a menu to open */
.tapos-account-caret {
    display: none;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.2s ease;
}

.tapos-account[data-state="in"] .tapos-account-caret {
    display: inline-block;
}

.tapos-account[data-state="in"] .tapos-account-toggle[aria-expanded="true"] .tapos-account-caret {
    transform: rotate(180deg);
}

/* ----------------------------------------------------------------- Menu */

.tapos-account-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 9999; /* below the booking modal's 999999 */
    min-width: 190px;
    padding: 6px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: tapos-account-drop 0.18s ease;
}

.tapos-account-menu[hidden] {
    display: none;
}

@keyframes tapos-account-drop {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tapos-account-item {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 18px;
    border: 0;
    background: none;
    color: #222;
    font: inherit;
    font-size: 15px;
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.tapos-account-item:hover,
.tapos-account-item:focus {
    background: #f2f4f7;
    color: #000;
    text-decoration: none;
}

.tapos-account-item:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

.tapos-account-item--logout {
    margin-top: 6px;
    border-top: 1px solid #e8e8e8;
    color: #a32020;
}

/* ------------------------------------------------------- Embedded pages */

.tapos-account-page {
    width: 100%;
    /* Apple mobile browsers need this for the iframe to scroll - see the
       TAPOS online ticketing manual's iframe notes. */
    -webkit-overflow-scrolling: touch;
}

.tapos-account-page iframe {
    display: block;
    width: 100%;
    min-height: 400px;
    border: 0;
}

/* While the embedded page is fetching its next screen */
.tapos-account-page.is-loading {
    position: relative;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

/* Shown only to administrators, when a shortcode cannot render */
.tapos-account-notice {
    margin: 0;
    padding: 10px 14px;
    border-left: 4px solid #d98500;
    background: #fff6e5;
    color: #5c4300;
    font-size: 14px;
    line-height: 1.4;
}

/* The logout frame exists only to be navigated to the TAPOS logout endpoint */
.tapos-account-logout-frame {
    position: absolute;
    width: 0;
    height: 0;
    border: 0;
    visibility: hidden;
}

@media (max-width: 768px) {
    .tapos-account-menu {
        right: auto;
        left: 0;
    }
}
