/*
 * Sign in / Create account dialog (guests). Markup: inc/modules/custom-access/views/header-links.php.
 * Replaces the older look from custom-access.css, tdtv-sidebar.css and tdtv-ui-primitives.css,
 * so selectors are scoped to .tdtv-auth and win with specificity (+ !important where the
 * old rules used it). Desktop: centred card. Phones: bottom sheet.
 */

html body .tdtv-auth.custom-access-modal-backdrop.in {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(5, 5, 8, .74) !important;
    animation: tdtv-auth-fade .2s ease both;
}

html body .tdtv-auth.custom-access-modal-backdrop.in .custom-access-modal {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 400px !important;
    max-height: calc(100vh - 32px) !important;
    max-height: calc(100dvh - 32px) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden auto !important;
    border: 1px solid var(--tdtv-border-strong, rgba(255, 255, 255, .14)) !important;
    border-radius: 18px !important;
    background: var(--tdtv-surface, #16171c) !important;
    background-image: radial-gradient(120% 60% at 50% 0%, rgba(255, 221, 149, .07), transparent 60%) !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .6) !important;
    color: var(--tdtv-text, #f5f6f8);
    text-align: left;
    animation: tdtv-auth-pop .26s cubic-bezier(.2, .7, .2, 1) both;
    overscroll-behavior: contain;
}

/* Old decorations: notebook holes + "SECURE". */
html body .tdtv-auth .custom-access-modal::before,
html body .tdtv-auth .custom-access-modal::after,
html body .tdtv-auth .custom-access-modal-title::after {
    content: none !important;
    display: none !important;
}

/* ---- Header ---- */

html body .tdtv-auth .custom-access-modal-header {
    position: relative;
    margin: 0 !important;
    padding: 26px 24px 0 !important;
    border: 0 !important;
    background: none !important;
    text-align: center;
}

html body .tdtv-auth .custom-access-modal-close {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
    float: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    height: 34px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, .06) !important;
    color: var(--tdtv-muted, #9aa0ac) !important;
    font-size: 17px !important;
    transition: background-color .15s ease, color .15s ease;
}

html body .tdtv-auth .custom-access-modal-close:hover,
html body .tdtv-auth .custom-access-modal-close:focus-visible {
    background: rgba(255, 255, 255, .12) !important;
    color: #fff !important;
}

.tdtv-auth__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 0 auto 12px;
    border-radius: 14px;
    background: rgba(255, 221, 149, .12);
    box-shadow: inset 0 0 0 1px rgba(255, 221, 149, .22);
    color: var(--tdtv-accent, #ffdd95);
    font-size: 22px;
}

html body .tdtv-auth .custom-access-modal-title {
    display: block !important;
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #fff !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    line-height: 1.25 !important;
    text-align: center !important;
    text-transform: none !important;
}

.tdtv-auth__lead {
    max-width: 320px;
    margin: 6px auto 0 !important;
    color: var(--tdtv-muted, #9aa0ac);
    font-size: 13.5px;
    line-height: 1.5;
}

/* Segmented tabs: Sign in | Create account. */
html body .tdtv-auth .custom-access-modal-tabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 18px 0 0 !important;
    padding: 4px !important;
    border: 1px solid var(--tdtv-border, rgba(255, 255, 255, .07)) !important;
    border-radius: 12px !important;
    background: var(--tdtv-bg, #0d0d10) !important;
    list-style: none !important;
}

html body .tdtv-auth .custom-access-modal-tab-item {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
}

html body .tdtv-auth .custom-access-modal-tab-item.tdtv-auth__tab-hidden {
    display: none !important;
}

html body .tdtv-auth .custom-access-modal-tab-item .custom-access-tab-trigger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 38px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 10px !important;
    border: 0 !important;
    border-radius: 9px !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
    color: var(--tdtv-muted, #9aa0ac) !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    transition: background-color .18s ease, color .18s ease;
}

html body .tdtv-auth .custom-access-modal-tab-item .custom-access-tab-trigger:hover {
    color: #fff !important;
}

html body .tdtv-auth .custom-access-modal-tab-item.active .custom-access-tab-trigger {
    background: var(--tdtv-surface-3, #262932) !important;
    color: #fff !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .4) !important;
}

/* ---- Body ---- */

html body .tdtv-auth .custom-access-modal-body {
    margin: 0 !important;
    padding: 18px 24px 22px !important;
    background: none !important;
}

html body .tdtv-auth .custom-access-modal-tab-pane.active {
    display: block !important;
    animation: tdtv-auth-fade .2s ease both;
}

.tdtv-auth__label,
.tdtv-auth__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 6px;
    color: #c9ccd3;
    font-size: 12.5px;
    font-weight: 600;
}

.tdtv-auth__label-row .tdtv-auth__label {
    margin: 0;
}

html body .tdtv-auth .custom-access-input {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 46px !important;
    box-sizing: border-box !important;
    margin: 0 0 4px !important;
    padding: 0 14px !important;
    border: 1px solid var(--tdtv-border-strong, rgba(255, 255, 255, .14)) !important;
    border-radius: 10px !important;
    background: var(--tdtv-bg, #0d0d10) !important;
    color: var(--tdtv-text, #f5f6f8) !important;
    font-size: 15px !important;
    line-height: normal !important;
    box-shadow: none !important;
    transition: border-color .15s ease, box-shadow .15s ease;
}

html body .tdtv-auth .custom-access-input::placeholder {
    color: #5f6470;
}

html body .tdtv-auth .custom-access-input:focus,
html body .tdtv-auth .custom-access-input:focus-visible {
    outline: none !important;
    border-color: rgba(255, 221, 149, .6) !important;
    box-shadow: 0 0 0 3px rgba(255, 221, 149, .14) !important;
}

html body .tdtv-auth .ca-error,
html body .tdtv-auth .ca-success {
    min-height: 12px;
    margin: 0 0 8px !important;
    font-size: 12px !important;
    line-height: 1.4;
}

html body .tdtv-auth .ca-error:empty {
    min-height: 0;
    margin-bottom: 10px !important;
}

html body .tdtv-auth .custom-access-button {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    max-width: none !important;
    height: 46px !important;
    margin: 8px 0 0 !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: var(--tdtv-accent, #ffdd95) !important;
    color: #17181d !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    letter-spacing: .01em !important;
    text-transform: none !important;
    box-shadow: 0 8px 22px rgba(255, 221, 149, .16) !important;
    transform: none !important;
    cursor: pointer;
    transition: filter .15s ease, box-shadow .15s ease, transform .1s ease;
}

html body .tdtv-auth .custom-access-button:hover,
html body .tdtv-auth .custom-access-button:focus-visible {
    filter: brightness(1.05);
    box-shadow: 0 10px 26px rgba(255, 221, 149, .26) !important;
}

html body .tdtv-auth .custom-access-button:active {
    transform: scale(.985) !important;
}

.tdtv-auth__link {
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    color: var(--tdtv-accent, #ffdd95) !important;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.tdtv-auth__link:hover,
.tdtv-auth__link:focus-visible {
    text-decoration: underline;
}

.tdtv-auth__switch {
    margin: 16px 0 0 !important;
    color: var(--tdtv-muted, #9aa0ac);
    font-size: 13px;
    text-align: center;
}

.tdtv-auth__switch .tdtv-auth__link {
    font-size: 13px;
}

@keyframes tdtv-auth-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Individual transform properties, so the !important transform reset above doesn't block it. */
@keyframes tdtv-auth-pop {
    from { opacity: 0; translate: 0 10px; scale: .97; }
    to   { opacity: 1; translate: 0 0;   scale: 1; }
}

@keyframes tdtv-auth-sheet {
    from { translate: 0 100%; }
    to   { translate: 0 0; }
}

/* ---- Phones: bottom sheet ---- */
@media (max-width: 560px) {
    html body .tdtv-auth.custom-access-modal-backdrop.in {
        align-items: flex-end;
        padding: 0;
    }

    html body .tdtv-auth.custom-access-modal-backdrop.in .custom-access-modal {
        max-width: none !important;
        max-height: 92vh !important;
        max-height: 92dvh !important;
        border-width: 1px 0 0 !important;
        border-radius: 20px 20px 0 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
        animation: tdtv-auth-sheet .3s cubic-bezier(.2, .7, .2, 1) both;
    }

    /* Grab handle. */
    html body .tdtv-auth .custom-access-modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 38px;
        height: 4px;
        margin-left: -19px;
        border-radius: 4px;
        background: rgba(255, 255, 255, .18);
    }

    html body .tdtv-auth .custom-access-modal-header {
        padding: 26px 18px 0 !important;
    }

    html body .tdtv-auth .custom-access-modal-body {
        padding: 16px 18px 22px !important;
    }

    .tdtv-auth__mark {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
        font-size: 19px;
    }

    html body .tdtv-auth .custom-access-modal-title {
        font-size: 20px !important;
    }

    /* 16px stops iOS zooming into the field. */
    html body .tdtv-auth .custom-access-input {
        font-size: 16px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    html body .tdtv-auth.custom-access-modal-backdrop.in,
    html body .tdtv-auth .custom-access-modal,
    html body .tdtv-auth .custom-access-modal-tab-pane.active {
        animation: none !important;
    }
}
