/* ===== CSS Variables ===== */
@font-face {
    font-family: 'TenPoint';
    src: url('6fdfc18ec6d882f2-s.p.woff2') format('woff2'),
         url('ab243448ee4d2ff9-s.p.woff') format('woff');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

:root {
    --black: #000;
    --white: #fff;
    --light: #f5f5f5;
    --bg-color: #FFCC16;
    --bg-color-active: #F6DBFF;
    --bg-color-passive: #EDB6FF;
    --bg-color-textarea: #FFFDEE;
    --bg-success-color: #6BFE82;
    --bg-error-color: #FF3939;
    --purple: #6109BB;
    --font-main: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Space Mono', monospace;
    --border-radius: 1rem;
    --border-radius-s: 0.25rem;
    --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out-quint: cubic-bezier(0.87, 0, 0.13, 1);
    --bounce-out: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 4.1vw;
}

@media (min-width: 1023px) {
    html {
        font-size: 1.1vw;
    }
}

@media (min-width: 1440px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: var(--font-main);
    color: var(--black);
    background-color: var(--bg-color-textarea);
    min-height: 100vh;
    line-height: 1.2;
}

a {
    color: var(--black);
    text-decoration: underline;
}

/* ===== Layout ===== */
.outerContainer {
    width: 100%;
}

.innerContainer {
    display: flex;
    flex-direction: column;
    background: var(--bg-color-textarea);
    min-height: 100vh;
    width: 100%;
    padding: 0 1.5rem;
    padding-bottom: 8.75rem;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

main {
    width: 100%;
    padding-top: 1rem;
}

@media (min-width: 1024px) {
    .outerContainer {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        gap: 1.25rem;
        padding: 0 1.5rem;
        box-sizing: border-box;
        max-width: 1440px;
        margin: 0 auto;
    }

    .innerContainer {
        grid-column: 3 / span 8;
        padding: 0;
    }

    main {
        padding: 0;
        padding-top: 1.5rem;
    }
}

/* ===== Steps ===== */
.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.3s var(--ease-out-quint);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Typography ===== */
.azteco-flow-heading-img {
    display: block;
    width: 100%;
    max-width: 28rem;
    height: auto;
    margin: 0 0 0.5rem;
}

@media (min-width: 1024px) {
    .azteco-flow-heading-img {
        max-width: 45rem;
        margin: 0 0 0.75rem;
    }
}

.azteco-flow-heading {
    font-family: 'TenPoint', Impact, "Arial Black", sans-serif;
    font-size: 4rem;
    font-weight: 300;
    line-height: 0.85;
    margin: 1rem auto 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    padding: 0 0.3125rem;
    min-height: calc(4rem * 0.85);
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    .azteco-flow-heading {
        font-size: 6.25rem;
        line-height: 0.8;
        min-height: calc(6.25rem * 0.8);
        margin: 2.5rem auto 1.25rem;
    }
}

@media (min-width: 1024px) {
    .azteco-flow-heading {
        font-size: 6.25rem;
        line-height: 0.8;
        margin: 2.5rem auto 1.25rem;
    }
}

/* ===== Voucher Buttons Row ===== */
.voucher-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

/* Mobile: center buttons and form */
@media (max-width: 1023px) {
    .voucher-buttons {
        justify-content: center;
    }
    
    #voucher-container {
        margin-left: auto;
        margin-right: auto;
    }
    
    #voucher-container .main-content {
        justify-content: center;
    }
    
    .azteco-flow-heading-img {
        margin-left: auto;
        margin-right: auto;
    }
    
    #confirming-wrapper,
    #invalid-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    #invalid-wrapper .validity,
    #invalid-wrapper .sunset {
        margin-left: auto;
        margin-right: auto;
    }
}

.voucher-buttons .sunset {
    margin-top: 0;
}

.scan-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scan-btn svg {
    flex-shrink: 0;
}

.sunset {
    font-size: 1.25rem;
    line-height: 1.2;
    background: var(--bg-color);
    padding: 1rem;
    border-radius: var(--border-radius);
    width: fit-content;
    max-width: calc(100% - 1.5rem);
    margin-top: 0.25rem;
    box-sizing: border-box;
    border: none;
    cursor: pointer;
    font-family: var(--font-main);
    color: var(--black);
    text-align: left;
    transition: transform 0.35s var(--ease-out-quint);
}

button.sunset:hover {
    transform: scale(0.98);
}

.sunset.alignRight {
    margin-left: auto;
}

@media (min-width: 1024px) {
    .sunset {
        font-size: 1.5rem;
        line-height: 1.08;
        padding: 1rem 2.5rem;
        max-width: 74.5%;
    }
}

/* ===== Container (Purple Box) ===== */
.container {
    background: var(--bg-color-passive);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 0.25rem;
    position: relative;
    width: fit-content;
    max-width: calc(100% - 1.5rem);
    box-sizing: border-box;
    transition: transform 0.5s var(--ease-in-out-quint);
}

.container.active {
    background: var(--bg-color-active);
    padding: 1.5rem 1rem 1.5rem 2rem;
}

.container.alignRight {
    margin-left: auto;
}

.main-content {
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;
    width: fit-content;
    align-items: stretch;
}

.container.active .main-content > * + * {
    margin-left: 0.875rem;
}

@media (min-width: 1024px) {
    .container,
    .container.active {
        max-width: 74.5%;
        padding: 1.25rem 2.5rem;
    }
}

/* ===== Input Grid (16 digit code) ===== */
.inputGrid {
    display: grid;
    justify-content: space-between;
    grid-template-columns: repeat(4, 2.75rem);
    row-gap: 1rem;
    column-gap: 0.75rem;
    flex: 1;
}

.inputGrid input {
    background: none;
    height: 3.375rem;
    width: 2.75rem;
    border: 2px solid var(--black);
    border-radius: var(--border-radius-s);
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    line-height: 0.83;
    text-align: center;
    box-sizing: border-box;
    padding: 0;
    color: var(--black);
}

.inputGrid input::-webkit-outer-spin-button,
.inputGrid input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.inputGrid input[type="number"] {
    -moz-appearance: textfield;
}

.inputGrid input:focus {
    outline: none;
    background: var(--bg-color-textarea);
}

.inputGrid input:valid:not(:focus) {
    border-color: transparent;
}

@media (min-width: 1024px) {
    .inputGrid {
        row-gap: 1.125rem;
        column-gap: 1.08125rem;
        grid-template-columns: repeat(4, 5.1875rem);
    }

    .inputGrid input {
        height: 6.375rem;
        width: 5.1875rem;
        border-width: 3px;
        border-radius: 0.5rem;
        font-size: 4rem;
    }
}

/* ===== Side Decoration (dashes) ===== */
.sideDecoration {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0 0.5rem;
}

.sideDecoration span {
    display: flex;
    align-items: center;
    height: 3.375rem;
}

.azteco-line-icon {
    width: 1rem;
}

@media (min-width: 1024px) {
    .sideDecoration {
        gap: 1.125rem;
    }

    .sideDecoration span {
        height: 6.375rem;
    }

    .sideDecoration .azteco-line-icon {
        width: 1.8125rem;
    }
}

/* ===== Footer & Dialog Toggle ===== */
.voucher-footer {
    margin-top: 1rem;
}

.dialogToggle {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    outline: inherit;
    text-align: left;
    border-bottom: 0.0625rem dotted var(--black);
    width: fit-content;
    font-size: 1rem;
    line-height: 1.2;
    color: var(--black);
}

.dialogToggle.small {
    font-size: 0.875rem;
}

@media (min-width: 1024px) {
    .dialogToggle {
        font-size: 1.125rem;
    }

    .dialogToggle.small {
        font-size: 1rem;
    }
}

/* ===== Loading Wrapper ===== */
.loading-wrapper {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-color);
    padding: 1rem 2.5rem;
    box-sizing: border-box;
    width: fit-content;
    border-radius: var(--border-radius);
    font-size: 1.5rem;
    min-height: 2.875rem;
    align-items: center;
}

.loading-text {
    margin-right: 0.25rem;
    font-weight: 500;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

.dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 100%;
    background: var(--black);
}

.dot:nth-child(3) {
    animation-delay: 0.09s;
}

.dot:nth-child(4) {
    animation-delay: 0.18s;
}

.dot.animated {
    animation: bounce 1.2s ease infinite;
}

@keyframes bounce {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.1) translateY(-30%);
        opacity: 0.7;
    }
    60% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 1023px) {
    .loading-wrapper {
        padding: 1rem;
        font-size: 1.25rem;
    }
}

/* ===== Try New Button ===== */
.try-new-btn {
    margin-top: 1rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: 1.25rem;
}

@media (min-width: 1024px) {
    .try-new-btn {
        font-size: 1.5rem;
    }
}

/* ===== Confirming/Invalid Wrappers ===== */
#confirming-wrapper {
    margin-top: 0.5rem;
}

#invalid-wrapper {
    margin-top: 0.5rem;
}

#invalid-wrapper .validity {
    margin-bottom: 0.5rem;
}

/* ===== Validity Badge ===== */
.validity {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem;
    border-radius: var(--border-radius);
    font-size: 1.25rem;
    line-height: 1.2;
    width: fit-content;
    max-width: calc(100% - 0.125rem);
    margin: 0;
    box-sizing: border-box;
    background: var(--bg-error-color);
}

.validity.success {
    background: var(--bg-success-color);
}

.validity.alignRight {
    margin-left: auto;
}

.azteco-validity-icon {
    width: 1.625rem;
    margin-left: 0.5rem;
}

@media (min-width: 1024px) {
    .validity {
        font-size: 1.5rem;
        line-height: 1.08;
        padding: 1rem 2.5rem;
        max-width: 74.5%;
    }
}

/* ===== Voucher Details ===== */
.voucher-details {
    background: var(--bg-color-passive);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 0.5rem 0;
}

.voucher-details.active {
    background: var(--bg-color-active);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.detail-row.highlight {
    background: var(--bg-color);
    margin: 0.5rem -1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
}

.detail-label {
    font-size: 1rem;
    color: var(--black);
}

.detail-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.breakdown {
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-top: 1rem;
    padding-top: 1rem;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #666;
    padding: 0.25rem 0;
}

@media (min-width: 1024px) {
    .voucher-details {
        max-width: 74.5%;
        padding: 1.25rem 2.5rem;
    }

    .detail-label {
        font-size: 1.125rem;
    }

    .detail-value {
        font-size: 1.5rem;
    }

    .breakdown-row {
        font-size: 1rem;
    }
}

/* ===== Wallet Input ===== */
.wallet-content {
    width: 100%;
}

.walletInputWrapper {
    position: relative;
    width: 100%;
}

.walletInputWrapper input {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-family: var(--font-mono);
    border: none;
    border-radius: var(--border-radius);
    background: var(--bg-color-passive);
    color: var(--black);
}

.walletInputWrapper input:focus {
    outline: none;
    background: var(--bg-color-textarea);
}

.walletInputWrapper input::placeholder {
    color: #666;
}

.wallet-status {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    display: none;
}

.wallet-status.show {
    display: block;
}

.expiry-notice {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.75rem;
}

@media (min-width: 1024px) {
    .walletInputWrapper input {
        font-size: 1.25rem;
        padding: 1.25rem 2.5rem 1.25rem 1.25rem;
        max-width: 74.5%;
    }
}

/* ===== Buttons ===== */
.primary-button,
.secondary-button {
    display: block;
    width: fit-content;
    padding: 1rem 2rem;
    border-radius: 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    font-family: var(--font-main);
    cursor: pointer;
    transition: transform 0.35s var(--ease-out-quint);
    border: none;
    margin-top: 1rem;
    background-color: var(--bg-color);
    color: var(--black);
}

.secondary-button {
    padding: 0.5rem 1.5rem;
    border-radius: 1.375rem;
    line-height: 1.4;
}

@media (any-hover: hover) {
    .primary-button:hover,
    .secondary-button:hover {
        transition-duration: 0.25s;
        transform: scale(0.94);
    }
}

@media (min-width: 1024px) {
    .primary-button {
        font-size: 1.25rem;
        padding: 1.25rem 2.5rem;
    }
}

/* ===== Success Screen ===== */
.success-amount {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: var(--font-mono);
    margin: 0.5rem 0 1.5rem;
}

.success-details {
    background: var(--bg-color-passive);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.success-row {
    padding: 0.5rem 0;
}

.success-row:not(:last-child) {
    border-bottom: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 0.5rem;
}

.success-row .label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.success-row .value {
    font-size: 1rem;
    font-family: var(--font-mono);
    font-weight: 500;
    word-break: break-all;
}

.truncate {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.feedback-banner {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    font-size: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 1024px) {
    .success-amount {
        font-size: 4rem;
    }

    .success-details {
        max-width: 74.5%;
    }
}

/* ===== Lightning / QR Section ===== */
.highlight-text {
    font-weight: 600;
}

.qr-section {
    background: var(--bg-color-passive);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    margin: 1rem 0;
}

.qr-code {
    display: inline-block;
    margin-bottom: 1rem;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    background: linear-gradient(45deg, #000 25%, transparent 25%),
                linear-gradient(-45deg, #000 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #000 75%),
                linear-gradient(-45deg, transparent 75%, #000 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    opacity: 0.1;
    border-radius: 0.5rem;
}

.qr-instruction {
    font-size: 1rem;
    color: #666;
    margin: 0.5rem 0;
}

.qr-instruction.small {
    font-size: 0.875rem;
    color: #999;
}

@media (min-width: 1024px) {
    .qr-section {
        max-width: 74.5%;
    }

    .qr-placeholder {
        width: 250px;
        height: 250px;
    }
}

/* ===== Dialog ===== */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 3rem 1.5rem;
    z-index: 99999;
    overflow-y: auto;
}

.dialog-overlay.show {
    display: flex;
}

.dialog-content {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    position: relative;
    animation: slideUp 0.4s var(--ease-out-quint);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dialog-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background: var(--light);
    border: none;
    border-radius: var(--border-radius-s);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s var(--bounce-out);
}

.dialog-close:hover {
    transform: rotate(90deg) scale(0.9);
}

.dialog-close svg {
    width: 1.25rem;
    height: 1.25rem;
}

.dialog-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-right: 3rem;
}

.dialog-body p {
    font-size: 1rem;
    color: #666;
    margin-bottom: 1rem;
}

.code-example {
    display: inline-block;
    background: var(--bg-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
}

.dialog-body ul {
    list-style: none;
}

.dialog-body ul li {
    display: flex;
    position: relative;
    padding-left: 1rem;
    margin-bottom: 0.75rem;
}

.dialog-body ul li::before {
    content: '';
    position: absolute;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--purple);
    left: 0;
    top: 0.5rem;
}

.dialog-body ul li p {
    margin: 0;
    color: var(--black);
}

/* ===== QR Scanner Dialog ===== */
.qr-scanner-content {
    max-width: 400px;
}

.qr-scanner-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

#qr-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qr-scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-scanner-frame {
    width: 70%;
    height: 70%;
    border: 3px solid var(--bg-color);
    border-radius: 1rem;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.qr-scanner-hint {
    text-align: center;
    font-size: 0.875rem;
    color: #666;
    margin: 0 0 1rem 0;
}

.capture-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: var(--bg-color);
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-main);
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.35s var(--ease-out-quint);
}

.capture-btn:hover {
    transform: scale(0.98);
}

.capture-btn:active {
    transform: scale(0.95);
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: 2px solid var(--black);
    border-radius: var(--border-radius);
    font-family: var(--font-main);
    font-size: 1.125rem;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.35s var(--ease-out-quint);
    margin-top: 0.5rem;
}

.upload-btn:hover {
    transform: scale(0.98);
    background: var(--light);
}

.upload-btn:active {
    transform: scale(0.95);
}
