/*
 * dialogs.css
 *
 * Payment dialog (method choice, basic card type, Adyen terminal steps
 * with progress bar, double-swipe refund card, complete, timeout), receipt
 * preview with action bar, Tax Free offer prompts and the Global Blue iframe.
 */

.dialog__amount.is-negative {
    color: var(--warning-text);
}

/* VAT Exempt: how the amount due was reached */
.dialog__amount-note {
    font-size: var(--fs-secondary);
    font-weight: 700;
    color: var(--accent-strong);
}

.chip--start {
    align-self: flex-start;
}

.soft--accent {
    background: var(--accent-tint);
}

.soft--accent .soft__label,
.soft--accent .soft__value {
    color: var(--accent-strong);
}

/* The void confirmation can open on top of the return dialog (returning items of a sale
   with an issued Tax Free form voids the form first), so it sits one layer higher. */
.void-confirmation-overlay {
    z-index: var(--z-void-confirm);
}

/* ---------- Method choice ---------- */

.method-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.method-tile {
    min-height: 120px;
    border: 0;
    border-radius: var(--r-24);
    background: var(--control);
    color: var(--ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color var(--dur-fast) var(--ease), transform var(--dur-press) var(--ease);
}

.method-tile:active {
    transform: scale(.98);
}

@media (hover: hover) and (pointer: fine) {
    .method-tile:hover {
        background: var(--hover);
    }
}

.method-tile--ink {
    background: var(--ink);
    color: var(--on-fill);
}

@media (hover: hover) and (pointer: fine) {
    .method-tile--ink:hover {
        background: var(--ink-hover);
    }
}

.method-tile__label {
    font-size: var(--fs-lead);
    font-weight: 800;
}

.payment-method-button.selected {
    transform: scale(.98);
}

/* ---------- Basic card type ---------- */

.card-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.card-type {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px;
    border: 0;
    border-radius: var(--r-24);
    background: var(--surface-2);
    color: var(--ink);
    text-align: left;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
    .card-type:hover {
        transform: translateY(-3px);
        box-shadow: 0 14px 30px rgba(20, 22, 27, .12);
    }
}

.card-type:active {
    transform: scale(.98);
}

.card-type__card {
    position: relative;
    display: block;
    aspect-ratio: 1.586 / 1;
    border-radius: var(--r-14);
    background: var(--ink);
    color: var(--on-fill);
    overflow: hidden;
}

.card-type__chip {
    position: absolute;
    left: 14px;
    top: 16px;
    width: 30px;
    height: 22px;
    border-radius: var(--r-4);
    background: var(--card-chip);
}

.card-type__flag {
    position: absolute;
    right: 14px;
    top: 16px;
    width: 28px;
    height: 19px;
    border-radius: var(--r-4);
    object-fit: cover;
}

.card-type__mark {
    position: absolute;
    right: 14px;
    top: 14px;
}

.card-type__digits {
    position: absolute;
    left: 14px;
    bottom: 14px;
    font-size: var(--fs-caption);
    font-weight: 700;
    letter-spacing: .14em;
    color: var(--muted-on-ink);
}

.card-type__text {
    display: flex;
    flex-direction: column;
    padding: 0 2px 2px;
}

.card-type__title {
    font-weight: 800;
    font-size: var(--fs-lead);
}

.card-type__hint {
    font-size: var(--fs-secondary);
    color: var(--muted);
}

.card-type--foreign {
    background: var(--accent-tint);
    box-shadow: inset 0 0 0 1.5px var(--accent-ring);
}

@media (hover: hover) and (pointer: fine) {
    .card-type--foreign:hover {
        box-shadow: inset 0 0 0 1.5px var(--accent-ring), 0 14px 30px rgba(20, 22, 27, .12);
    }
}

.card-type--foreign .card-type__card {
    background: var(--accent);
}

.card-type--foreign .card-type__digits {
    color: var(--accent-on-muted);
}

.card-type--foreign .card-type__title {
    color: var(--accent-strong);
}

.card-type--foreign .card-type__hint {
    color: var(--text-2);
}

/* ---------- Terminal progress ---------- */

.pay-progress {
    list-style: none;
    display: flex;
    gap: 6px;
}

.pay-progress__step {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pay-progress__bar {
    height: 6px;
    border-radius: var(--r-pill);
    background: var(--hairline);
    transition: background-color var(--dur-enter) var(--ease);
}

.pay-progress__label {
    font-size: var(--fs-caption);
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pay-progress__step.is-done .pay-progress__bar {
    background: var(--accent);
}

.pay-progress__step.is-active .pay-progress__bar {
    background: var(--accent-ring);
}

.pay-progress__step.is-done .pay-progress__label,
.pay-progress__step.is-active .pay-progress__label {
    color: var(--accent-strong);
}

.pay-progress__step.is-error .pay-progress__bar {
    background: var(--warning);
}

.pay-progress__step.is-error .pay-progress__label {
    color: var(--warning-text);
}

/* ---------- Terminal stages ---------- */

.pay-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 10px 0 4px;
    text-align: center;
}

.pay-stage__text {
    align-items: center;
    gap: 4px;
}

.pulse-disc {
    position: relative;
    width: 190px;
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.pulse-disc__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--accent-ring);
    animation: sf-pulse 1.8s ease-out infinite;
}

.pulse-disc__core {
    position: relative;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-fill);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pulse-disc--sm {
    width: 120px;
    height: 120px;
}

.pulse-disc--sm .pulse-disc__core {
    width: 84px;
    height: 84px;
}

.ring-spinner {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 10px solid var(--accent-tint);
    border-top-color: var(--accent);
    animation: sf-spin 1s linear infinite;
    margin-top: 8px;
}

.refund-stage {
    display: flex;
    align-items: center;
    gap: 18px;
}

.note-accent {
    padding: 14px 16px;
    border-radius: var(--r-20);
    background: var(--accent-tint);
    color: var(--accent-strong);
}

.done-disc {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: var(--success);
    color: var(--on-fill);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 12px var(--success-tint);
    margin: 12px 0 4px;
}

.pay-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    grid-auto-flow: column;
    gap: 8px;
}

.offer-panel {
    padding: 20px;
    gap: 12px;
}

.offer-panel__icon {
    width: 52px;
    height: 52px;
    border-radius: var(--r-18);
    background: var(--surface);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.offer-panel__title {
    font-size: var(--fs-title);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.timeout-head {
    display: flex;
    align-items: center;
    gap: 14px;
}

.checklist {
    gap: 8px;
    padding: 14px 16px;
    border-radius: var(--r-20);
}

.checklist__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checklist__list li {
    display: flex;
    gap: 10px;
}

.checklist__list strong {
    color: var(--accent);
}

/* ---------- Receipt ---------- */

.receipt-overlay {
    z-index: var(--z-receipt); /* above other dialogs, as before the redesign */
    align-items: flex-start;
    padding: 24px 16px;
}

.receipt-stack {
    width: 100%;
    max-width: 420px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.receipt-paper {
    width: 380px;
    max-width: 100%;
    padding: 28px 26px 30px;
    border-radius: var(--r-6) var(--r-6) 0 0;
    background: var(--surface);
    box-shadow: 0 20px 50px rgba(20, 22, 27, .22);
    font-family: var(--font-mono);
    font-size: var(--fs-caption);
    line-height: 1.55;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: sf-pop var(--dur-enter) var(--ease);
}

.receipt-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.receipt-shop-name {
    font-family: var(--font-mono);
    font-size: var(--fs-lead);
    font-weight: 800;
    letter-spacing: .02em;
}

.receipt-separator {
    border: 0;
    border-top: 1px dashed var(--ink);
}

.receipt-separator--bold {
    border-top: 2px solid var(--ink);
}

.receipt-lines {
    display: flex;
    flex-direction: column;
}

.receipt-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.receipt-line span:last-child {
    text-align: right;
}

.receipt-line--total {
    font-size: var(--fs-lead);
    font-weight: 800;
}

.receipt-items {
    display: grid;
    grid-template-columns: 30px 1fr auto auto;
    column-gap: 6px;
    row-gap: 4px;
}

.receipt-items__head {
    font-weight: 800;
}

.receipt-items .text-right {
    text-align: right;
}

.receipt-note {
    text-align: center;
}

.receipt-barcode {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    letter-spacing: .2em;
}

.receipt-barcode svg {
    max-width: 100%;
    height: 54px;
}

.receipt-thank-you {
    text-align: center;
    font-weight: 800;
    font-size: var(--fs-secondary);
}

.receipt-bar {
    position: sticky;
    bottom: 12px;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: var(--r-28);
    background: var(--surface);
    box-shadow: 0 20px 50px rgba(20, 22, 27, .18);
    font-family: var(--font);
}

.receipt-bar__text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding-left: 8px;
    font-size: var(--fs-secondary);
}

.receipt-bar__title {
    font-weight: 800;
    font-size: var(--fs-body);
}

.receipt-fade-enter-active,
.receipt-fade-leave-active {
    transition: opacity var(--dur-fast) var(--ease);
}

.receipt-fade-enter-from,
.receipt-fade-leave-to {
    opacity: 0;
}

/* ---------- Global Blue iframe ---------- */

.gb-ui-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-gb-ui);
    display: flex;
    padding: 16px;
    background: rgba(201, 205, 213, .8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: sf-fade var(--dur-fast) var(--ease);
}

.gb-ui-frame {
    position: relative;
    flex: 1;
    max-width: 1650px;
    margin: 0 auto;
    border-radius: var(--r-24);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-dialog);
}

.gb-ui-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.gb-ui-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--on-fill);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(20, 22, 27, .25);
    transition: transform var(--dur-fast) var(--ease);
}

@media (hover: hover) and (pointer: fine) {
    .gb-ui-close:hover {
        transform: scale(1.06);
    }
}

/* ---------- Phones: dialogs become bottom sheets ---------- */

@media (max-width: 600px) {
    .dialog-overlay:not(.receipt-overlay) {
        align-items: flex-end;
        padding: 0;
    }

    .dialog-overlay:not(.receipt-overlay) .dialog {
        max-width: none;
        margin: 0;
        border-radius: var(--r-32) var(--r-32) 0 0;
        padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
        max-height: 100vh;
        max-height: 100dvh;
        overflow-y: auto;
        animation: sf-sheet-up var(--dur-enter) var(--ease);
    }

    .card-type-grid,
    .method-grid {
        gap: 10px;
    }

    .card-type {
        padding: 10px;
    }

    .pulse-disc {
        width: 150px;
        height: 150px;
    }

    .pulse-disc__core {
        width: 104px;
        height: 104px;
    }

    .pulse-disc--sm {
        width: 96px;
        height: 96px;
    }

    .pulse-disc--sm .pulse-disc__core {
        width: 68px;
        height: 68px;
    }

    .gb-ui-overlay {
        padding: 0;
    }

    .gb-ui-frame {
        border-radius: 0;
    }

    .receipt-paper {
        padding: 22px 18px 24px;
    }

    .receipt-items {
        grid-template-columns: 26px 1fr auto auto;
    }
}
