@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== Design System Unificado - Zipn4 ===== */
:root {
    --bg-primary: #f0f2f5;
    --bg-card: #ffffff;
    --bg-surface: #f8f9fb;
    --bg-input: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success-color: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --error-color: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --warning-color: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --border: rgba(15, 23, 42, 0.08);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.12);
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0b0f1a;
        --bg-card: #141925;
        --bg-surface: #1a2035;
        --bg-input: #1e2538;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
        --accent: #818cf8;
        --accent-hover: #6366f1;
        --accent-glow: rgba(129, 140, 248, 0.2);
        --success-bg: rgba(16, 185, 129, 0.15);
        --error-bg: rgba(239, 68, 68, 0.15);
        --warning-bg: rgba(245, 158, 11, 0.15);
        --border: rgba(255, 255, 255, 0.06);
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image:
        radial-gradient(ellipse 800px 600px at 20% 0%, var(--accent-glow), transparent 60%),
        radial-gradient(ellipse 600px 400px at 80% 100%, rgba(99, 102, 241, 0.06), transparent 50%);
}

/* ===== Container Principal ===== */
.container {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    padding: 2.25rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.5s ease forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Header ===== */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.5;
}

/* ===== Formulário ===== */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input[type="text"] {
    width: 100%;
    padding: 0.95rem 1.05rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background: var(--bg-input);
    transition: all 0.2s ease;
    outline: none;
}

input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    background: var(--bg-card);
}

input[type="text"]::placeholder {
    color: var(--text-muted);
}

/* ===== Botão Principal ===== */
.btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-top: 0.75rem;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ===== Resultado do Pagamento ===== */
#payment-result {
    display: none;
    text-align: center;
    animation: fadeUp 0.5s ease;
}

.result-header {
    margin-bottom: 1.5rem;
}

.result-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    letter-spacing: -0.01em;
}

.amount-line {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.01em;
}

/* ===== Success Icon ===== */
.success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: var(--success-bg);
    color: var(--success-color);
    border-radius: 50%;
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* ===== QR Code ===== */
.qr-container {
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: var(--shadow-sm);
}

.qr-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.expiration-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

/* ===== Copy/Paste ===== */
.copy-paste-container {
    text-align: left;
    background: var(--bg-surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.copy-input-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.copy-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    padding: 0 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.25s ease;
    min-height: 44px;
}

.copy-btn:hover {
    box-shadow: 0 4px 15px var(--accent-glow);
    transform: translateY(-1px);
}

/* ===== Processando ===== */
.processing-status {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
}

/* ===== Loaders ===== */
.loader-small {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-card);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    width: 90%;
    max-width: 420px;
    text-align: center;
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1) translateY(0);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-icon-container {
    margin-bottom: 1.5rem;
}

.modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: bold;
    border: 3px solid transparent;
}

.modal-icon.warning {
    color: var(--warning-color);
    border-color: rgba(245, 158, 11, 0.3);
    background: var(--warning-bg);
}

.modal-icon.error {
    color: var(--error-color);
    border-color: rgba(239, 68, 68, 0.3);
    background: var(--error-bg);
}

.modal-icon.success {
    color: var(--success-color);
    border-color: rgba(16, 185, 129, 0.3);
    background: var(--success-bg);
}

#modal-title {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-weight: 700;
}

#modal-message {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.btn-modal-ok {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    width: 100%;
}

.btn-modal-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.modal-actions {
    margin-top: 0.5rem;
}

/* ===== Footer ===== */
footer {
    margin-top: auto;
    padding: 24px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

/* ===== Responsividade ===== */
@media (max-width: 640px) {
    body {
        padding: 16px;
        align-items: flex-start;
    }

    .container {
        padding: 1.75rem 1.5rem;
        border-radius: 20px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .btn {
        padding: 0.95rem;
    }

    .copy-input-group {
        flex-direction: column;
    }

    .copy-btn {
        width: 100%;
    }
}
