:root {
    --primary-color: #006994;
    --primary-dark: #004f6d;
    --primary-light: #4fb3d4;
    --text-color: #1c2a33;
    --muted-color: #5c7485;
    --background-color: #f0f5f8;
    --card-bg: #ffffff;
    --border-color: rgba(0, 105, 148, 0.16);
    --input-bg: #f6fbfe;
    --shadow-color: rgba(15, 35, 48, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--background-color);
    min-height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    padding: 40px 16px;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(240, 245, 248, 0.92);
    z-index: 999;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 6px solid rgba(0, 105, 148, 0.18);
    border-top-color: var(--primary-color);
    animation: loading-spin 1s linear infinite;
}

@keyframes loading-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.page-wrapper {
    width: 100%;
    max-width: 520px;
}

.payment-container {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 32px 28px;
    box-shadow: 0 18px 40px var(--shadow-color);
    border: 1px solid rgba(0, 105, 148, 0.08);
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(0, 105, 148, 0.2);
    color: var(--primary-dark);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.status-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #c9b75f;
}

.timer-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.chip-label {
    opacity: 0.85;
    font-size: 0.85rem;
}

#timer {
    font-variant-numeric: tabular-nums;
    font-size: 1rem;
}

h1 {
    margin: 0 0 12px;
    font-size: 1.8rem;
    font-weight: 700;
}

.intro-text {
    margin: 0;
    color: var(--muted-color);
    line-height: 1.6;
}

.divider {
    margin: 24px 0;
    height: 1px;
    width: 100%;
    background: rgba(0, 105, 148, 0.12);
}

section {
    margin-bottom: 24px;
}

section:last-of-type {
    margin-bottom: 0;
}

.qr-section {
    text-align: center;
}

.qr-section h2,
.copy-section h2,
.instructions h2 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.qr-code-container {
    margin: 0 auto;
    padding: 14px;
    border-radius: 16px;
    background: rgba(0, 105, 148, 0.06);
    border: 1px solid rgba(0, 105, 148, 0.18);
    display: inline-flex;
}

#qrcode img,
#qrcode canvas {
    width: 200px !important;
    height: 200px !important;
    border-radius: 12px;
}

.copy-section {
    text-align: left;
}

.copy-hint {
    margin: 0 0 12px;
    color: var(--muted-color);
    line-height: 1.5;
}

.pix-code-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--input-bg);
    border-radius: 14px;
    padding: 10px;
    border: 1px solid rgba(0, 105, 148, 0.16);
}

#pix-code {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    background: #ffffff;
    color: var(--text-color);
    box-shadow: inset 0 1px 3px rgba(17, 43, 56, 0.08);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#pix-code:focus {
    outline: 2px solid rgba(0, 105, 148, 0.3);
}

#copy-button {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    background: var(--primary-color);
    box-shadow: 0 10px 18px rgba(0, 105, 148, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
}

#copy-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(0, 105, 148, 0.32);
}

#copy-button:active {
    transform: translateY(0);
    box-shadow: 0 6px 12px rgba(0, 105, 148, 0.24);
}

#copy-feedback {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0, 105, 148, 0.12);
    color: var(--primary-dark);
    font-weight: 500;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#copy-feedback::before {
    content: "✔";
    font-size: 0.85rem;
}

.hidden {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

.instructions {
    text-align: left;
}

.instruction-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    background: #f7fbff;
    border: 1px solid rgba(0, 105, 148, 0.14);
}

.instruction-group h3 {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.steps {
    list-style: decimal;
    margin: 0;
    padding-left: 20px;
    display: block;
}

.steps li {
    margin: 6px 0;
    line-height: 1.5;
    color: var(--text-color);
}

.steps li span {
    display: inline;
}

.payment-container.expired {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    min-height: 320px;
}

.payment-container.expired h1 {
    margin: 8px 0 0;
    font-size: 1.7rem;
    color: var(--primary-dark);
}

.payment-container.expired .expired-text {
    margin: 0;
    color: var(--muted-color);
    line-height: 1.6;
    max-width: 320px;
}

.expired-badge {
    background: rgba(245, 115, 115, 0.14);
    border: 1px solid rgba(245, 115, 115, 0.3);
    color: #c0392b;
}

.expired-badge::before {
    background: #f08a72;
}

.desktop-hidden {
    display: none;
}

@media (max-width: 600px) {
    body {
        padding: 28px 12px;
    }

    .payment-container {
        padding: 24px 20px;
    }

    .status-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .pix-code-container {
        flex-direction: column;
        align-items: stretch;
    }

    #copy-button {
        width: 100%;
        text-align: center;
    }

    .mobile-hidden {
        display: none;
    }
}

@media (min-width: 601px) {
    .instruction-box {
        flex-direction: column;
    }
}
