/*
 * Shared portal presentation for /payment.
 * Business state and payment interactions remain in app.js/app.css; this
 * layer aligns the visual language with the current /cabinet interface.
 */

html {
    overflow-y: auto;
    scrollbar-gutter: auto;
}

@font-face {
    font-family: PaymentPortalInter;
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/assets/payment/fonts/inter-normal-latin.woff2') format('woff2');
}

.payment-portal {
    font-family: var(--portal-font-family);
}

.payment-portal {
    min-width: 320px;
    color: var(--portal-ink);
    background: var(--portal-page-background);
}

.payment-portal #app {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: none;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.payment-portal #app.has-test-mode {
    padding-top: 40px;
}

.payment-portal #app > main {
    box-sizing: border-box;
    width: calc(100% - 48px);
    margin-bottom: 36px;
}

/*
 * #app is a column flex-container. Without an explicit width its children
 * with auto side margins shrink to their content: the loading card becomes
 * as narrow as the spinner and the empty-contract card as narrow as its
 * heading. Keep every payment state on the same stable content column.
 */
.payment-portal #app:not(.loaded) > main:has(.loading) {
    width: calc(100% - 48px);
    min-height: 220px;
    height: 220px;
    padding: 30px;
}

.payment-portal #app:not(.loaded) .loading {
    display: flex;
    min-height: 158px;
    height: auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.payment-portal #app:not(.loaded) .loading svg {
    position: static;
    width: 48px;
    height: 48px;
    margin: 0;
}

.payment-portal .payment-loading__label {
    color: var(--portal-muted);
    font-family: var(--portal-font-family);
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
}

.payment-portal #app > .vv_bottom_external {
    margin-top: auto;
}

/* Public extension points retain the same selectors as Cabinet. */
:where(.payment-portal) .vv_top_external,
:where(.payment-portal) .vv_bottom_external {
    display: flex;
    position: relative;
    width: 100%;
    flex-shrink: 0;
    justify-content: center;
    line-height: normal;
}

/* Keep the payment reset from changing administrator-provided content. */
:where(.payment-portal) :is(.vv_top_external, .vv_bottom_external),
:where(.payment-portal :is(.vv_top_external, .vv_bottom_external)) *,
:where(.payment-portal :is(.vv_top_external, .vv_bottom_external)) *::before,
:where(.payment-portal :is(.vv_top_external, .vv_bottom_external)) *::after {
    box-sizing: border-box;
}

:where(.payment-portal :is(.vv_top_external, .vv_bottom_external)) :is(b, strong) {
    font-weight: revert;
}

:where(.payment-portal :is(.vv_top_external, .vv_bottom_external)) :is(ul, ol) {
    list-style: revert;
}

:where(.payment-portal) .footer {
    box-sizing: border-box;
    display: var(--portal-footer-display);
    width: 100%;
    height: auto;
    min-height: 96px;
    padding: 24px 0;
    border: 0;
    border-top: 1px solid #ededed;
    background: var(--portal-footer-background);
    color: var(--portal-muted);
    font-family: var(--portal-font-family);
    font-size: 13px;
    line-height: 18px;
    text-align: center;
}

:where(.payment-portal) .footer__content {
    display: flex;
    width: min(1140px, calc(100% - 48px));
    max-width: none;
    margin: 0 auto;
    padding: 0;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    color: var(--portal-muted);
    font-family: var(--portal-font-family);
    font-size: 13px;
    line-height: 18px;
}

:where(.payment-portal) .footer_item {
    display: flex;
    flex: 1;
    min-width: 0;
    margin: 0 16px;
    overflow-wrap: anywhere;
}

:where(.payment-portal) .footer_item_column {
    flex-direction: column;
}

:where(.payment-portal) .footer_item_row {
    flex-direction: row;
}

:where(.payment-portal) .footer_item_element {
    display: flex;
    color: inherit;
    font-family: var(--portal-font-family);
    font-size: 13px !important;
    line-height: 18px;
    text-align: center;
}

:where(.payment-portal) .footer_item_element_center {
    justify-content: center;
    text-align: center;
}

@media (max-width: 619px) {
    :where(.payment-portal) .footer__content {
        width: calc(100% - 32px);
        flex-direction: column;
        font-size: 12px;
    }

    :where(.payment-portal) .footer_item {
        margin: 0 0 10px;
    }

    :where(.payment-portal) .footer_item_element {
        font-size: 12px !important;
        line-height: 17px;
    }
}

@media (min-width: 620px) and (max-width: 767px) {
    :where(.payment-portal) .footer__content {
        width: calc(100% - 32px);
    }

    :where(.payment-portal) .footer_item {
        margin: 0 8px;
    }
}

.payment-portal .test-mode {
    z-index: 20;
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    padding: 10px 16px;
    position: absolute;
    line-height: 20px;
}

.payment-portal #app > header {
    box-sizing: border-box;
    width: 100%;
    min-height: 72px;
    padding: 0;
    background: var(--portal-header-background);
    border: 0;
    border-radius: 0;
    box-shadow: 0 1px 2px rgba(43, 45, 51, 0.08), 0 4px 12px rgba(43, 45, 51, 0.04);
}

.payment-portal .payment-header-inner {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1140px, calc(100% - 48px));
    min-height: 72px;
    margin: 0 auto;
}

.payment-portal .payment-logo {
    width: var(--portal-logo-width);
    max-width: 240px;
    height: var(--portal-logo-height);
    max-height: 56px;
    object-fit: contain;
    object-position: left center;
}

.payment-portal header .header-actions {
    height: 100%;
    gap: 10px;
}

.payment-portal header .header-actions .phone a {
    min-height: 0;
    gap: 5px;
    padding: 0;
    color: var(--portal-header-phone-color);
    border-radius: 0;
    font-family: PaymentPortalInter, sans-serif;
    letter-spacing: -0.5px;
    font-size: 16px;
    font-weight: 500;
    line-height: 18px;
}

.payment-portal header .header-actions .phone svg {
    display: block;
    width: 14px;
    height: 14px;
    flex: none;
}

.payment-portal header .header-actions .phone a span {
    font-family: inherit;
}

.payment-portal header .header-actions .phone svg path,
.payment-portal .payment-exit-link svg path {
    fill: currentColor;
}

.payment-portal .payment-exit-link {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    margin: 0;
    padding: 0;
    color: var(--portal-header-phone-color);
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 0;
    line-height: 0;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.payment-portal .payment-exit-link:hover {
    color: var(--portal-header-phone-color);
    background: transparent;
    opacity: 0.7;
}

.payment-portal .payment-exit-link:focus-visible,
.payment-portal header .header-actions .phone a:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 4px var(--portal-focus-ring);
}

.payment-portal .payment-exit-link svg {
    display: block;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.payment-portal #app > nav.payment-portal-progress {
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    justify-items: stretch;
    align-items: stretch;
    width: min(1140px, calc(100% - 48px));
    margin: 36px auto 0;
    gap: 16px;
}

.payment-portal .payment-portal-progress__summary {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 64px;
    min-height: 92px;
    padding: 18px 24px;
    background: var(--portal-card-background);
    border: 0;
    border-radius: 18px;
    box-shadow: var(--portal-card-shadow);
}

.payment-portal .payment-portal-progress__item {
    display: flex;
    min-width: 180px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.payment-portal .payment-portal-progress__label {
    color: var(--portal-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 18px;
}

.payment-portal .payment-portal-progress__value {
    min-height: 30px;
    margin-top: 4px;
    color: var(--portal-ink);
    font-family: inherit;
    font-size: 26px;
    font-weight: 500;
    line-height: 30px;
}

.payment-portal .payment-portal-progress__track {
    width: 100%;
    height: 28px;
    overflow: hidden;
    background: var(--portal-slider-track);
    border: 0;
    border-radius: 999px;
}

.payment-portal .payment-portal-progress__fill {
    display: flex;
    min-width: 54px;
    height: 100%;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    background: var(--portal-accent);
    border-radius: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 28px;
    transition: width 0.25s ease;
}

.payment-portal .payment-portal-progress__fill span {
    font-family: inherit;
}

.payment-portal main,
.payment-portal main * {
    font-family: Inter, sans-serif;
}

@media (max-width: 830px) {
    .payment-portal #app > nav.payment-portal-progress {
        display: grid;
        width: calc(100% - 32px);
        margin-top: 28px;
    }

}

@media (max-width: 660px) {
    .payment-portal #app,
    .payment-portal #app.has-test-mode {
        padding-right: 0;
        padding-bottom: 0;
        padding-left: 0;
    }

    .payment-portal #app > main {
        width: calc(100% - 32px);
        margin-bottom: 28px;
    }

    .payment-portal #app:not(.loaded) > main:has(.loading) {
        width: calc(100% - 32px);
        min-height: 200px;
        height: 200px;
        padding: 20px;
    }

    .payment-portal #app.has-test-mode {
        padding-top: 56px;
    }

    .payment-portal .test-mode {
        min-height: 56px;
        padding: 10px 14px;
        font-size: 13px;
        line-height: 17px;
    }

    .payment-portal .payment-header-inner {
        width: calc(100% - 32px);
        height: 72px;
        min-height: 72px;
    }

    .payment-portal #app > header {
        height: 72px;
        min-height: 72px;
    }

    .payment-portal .payment-logo {
        width: var(--portal-logo-mobile-width);
        max-width: 172px;
        height: auto;
        max-height: 48px;
    }

    .payment-portal header .header-actions {
        gap: 8px;
    }

    .payment-portal header .header-actions .phone a,
    .payment-portal .payment-exit-link {
        box-sizing: border-box;
        width: 38px;
        height: 38px;
        min-height: 38px;
        flex: 0 0 38px;
        justify-content: center;
        padding: 10px;
        border-radius: 8px;
    }

    .payment-portal header .header-actions .phone span {
        display: none;
    }

    .payment-portal header .header-actions .phone svg {
        width: 18px;
        height: 18px;
    }

    .payment-portal #app > nav.payment-portal-progress {
        width: calc(100% - 28px);
        gap: 12px;
        margin-top: 22px;
    }

    .payment-portal .payment-portal-progress__track {
        height: 26px;
    }

    .payment-portal .payment-portal-progress__fill {
        line-height: 26px;
    }

    .payment-portal main.state-contracts:has(.contracts .list .contract) {
        width: calc(100% - 32px);
        padding: 20px 0;
    }

}

@media (max-width: 619px) {
    .payment-portal .payment-portal-progress__summary {
        min-height: 0;
        gap: 24px;
        padding: 16px;
        border-radius: 16px;
    }

    .payment-portal .payment-portal-progress__item {
        min-width: 0;
        flex: 1 1 0;
    }

    .payment-portal .payment-portal-progress__label {
        font-size: 12px;
        line-height: 16px;
    }

    .payment-portal .payment-portal-progress__value {
        min-height: 24px;
        font-size: 19px;
        line-height: 24px;
    }
}

/* Keep the shared shell on the same tablet breakpoint as Cabinet and Portal. */
@media (max-width: 767px) {
    .payment-portal .payment-header-inner {
        width: calc(100% - 32px);
        height: 72px;
        min-height: 72px;
    }

    .payment-portal #app > header {
        height: 72px;
        min-height: 72px;
    }

    .payment-portal .payment-logo {
        width: var(--portal-logo-mobile-width);
        max-width: 172px;
        height: auto;
        max-height: 48px;
    }

    .payment-portal header .header-actions {
        gap: 8px;
    }

    .payment-portal header .header-actions .phone a,
    .payment-portal .payment-exit-link {
        box-sizing: border-box;
        width: 38px;
        height: 38px;
        min-height: 38px;
        flex: 0 0 38px;
        justify-content: center;
        padding: 10px;
        border-radius: 8px;
    }

    .payment-portal header .header-actions .phone span {
        display: none;
    }

    .payment-portal header .header-actions .phone svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 400px) {
    .payment-portal .payment-portal-progress__summary {
        gap: 12px;
        padding-inline: 12px;
    }
}

@media (max-width: 400px) {
    .payment-portal .payment-logo {
        width: var(--portal-logo-compact-width);
        max-width: 132px;
    }

}
