/* ==============================================================================
   ESTILOS GERAIS E DESIGN SYSTEM - GERADOR DE PAGAMENTOS PIX
   ============================================================================== */

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-focus: #0f172a;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary: #0f172a;
    --primary-hover: #1e293b;
    --primary-text: #ffffff;
    
    --brand-pix: #00b493;
    --brand-pix-bg: #e6f7f4;
    
    --status-waiting-bg: #fef3c7;
    --status-waiting-text: #92400e;
    --status-waiting-dot: #d97706;
    
    --status-paid-bg: #dcfce7;
    --status-paid-text: #166534;
    --status-paid-dot: #16a34a;
    
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --error-border: #fecaca;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.04), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-elevated: 0 20px 30px -10px rgba(15, 23, 42, 0.08);
    
    --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 30px 16px 50px 16px;
}

.app-container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #ffffff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg {
    width: 22px;
    height: 22px;
}

.brand-info h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}

.badge-gateway {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: #e2e8f0;
    padding: 1px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Card Principal */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-card);
    transition: all 0.25s ease;
}

.card-header {
    margin-bottom: 24px;
}

.card-header h2 {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.card-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* Campo de Valor */
.amount-field-group {
    margin-bottom: 18px;
}

.amount-field-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.amount-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 18px;
    transition: all 0.2s ease;
}

.amount-input-wrapper:focus-within {
    border-color: var(--border-focus);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.06);
}

.currency-symbol {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted);
    margin-right: 8px;
    user-select: none;
}

.amount-input-wrapper input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    outline: none;
}

.amount-input-wrapper input::placeholder {
    color: #cbd5e1;
}

/* Valores Rápidos */
.preset-values-group {
    margin-bottom: 22px;
}

.presets-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.presets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.btn-preset {
    background: #f1f5f9;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.btn-preset:hover {
    background: #e2e8f0;
    color: var(--text-primary);
}

.btn-preset.active {
    background: var(--primary);
    color: #ffffff;
}

/* Acordeom */
.accordion-section {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-bottom: 24px;
}

.accordion-toggle {
    width: 100%;
    background: none;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 0;
}

.accordion-toggle:hover {
    color: var(--text-primary);
}

.chevron-icon {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.accordion-toggle.open .chevron-icon {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding-top: 14px;
}

.accordion-content.open {
    display: block;
}

.input-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--border-focus);
}

/* Banner de Erro */
.error-banner {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-text);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.86rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.error-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Botões */
.btn-primary {
    width: 100%;
    background: var(--primary);
    color: var(--primary-text);
    border: none;
    padding: 16px 20px;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s ease;
    width: 100%;
}

.btn-secondary svg {
    width: 16px;
    height: 16px;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

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

/* ==============================================================================
   TELA DE PAGAMENTO
   ============================================================================== */

.payment-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.payment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.payment-title-wrap h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.tx-id-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Status Pills */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.status-waiting {
    background: var(--status-waiting-bg);
    color: var(--status-waiting-text);
}

.status-waiting .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-waiting-dot);
    animation: pulse 1.8s ease-in-out infinite;
}

.status-paid {
    background: var(--status-paid-bg) !important;
    color: var(--status-paid-text) !important;
}

.status-paid .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-paid-dot) !important;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* Box de Valor */
.amount-highlight-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.amount-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.amount-val {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

/* QR Code */
.qrcode-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.qrcode-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-container canvas,
.qrcode-container img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.qrcode-instruction {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 280px;
}

/* Copia e Cola */
.copia-cola-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.copia-cola-header label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.copia-cola-box {
    display: flex;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 4px 4px 12px;
    align-items: center;
}

.copia-cola-box input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: monospace;
    font-size: 0.82rem;
    color: var(--text-secondary);
    outline: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-copy {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-copy svg {
    width: 14px;
    height: 14px;
}

.btn-copy:hover {
    background: var(--primary-hover);
}

.btn-copy.copied {
    background: #10b981 !important;
    color: #ffffff;
}

/* Banner de Sucesso */
.payment-success-card {
    background: #ecfdf5;
    border: 2px solid #a7f3d0;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: fadeIn 0.4s ease-out;
}

.success-icon-wrap {
    width: 44px;
    height: 44px;
    background: #10b981;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.success-icon-wrap svg {
    width: 24px;
    height: 24px;
}

.success-info h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: #065f46;
    margin-bottom: 2px;
}

.success-info p {
    font-size: 0.85rem;
    color: #047857;
    margin-bottom: 4px;
}

.paid-time {
    font-size: 0.75rem;
    font-weight: 600;
    color: #059669;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Ações e Polling Note */
.payment-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.polling-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.ping-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3b82f6;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6);
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Footer */
.app-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Responsividade */
@media (max-width: 480px) {
    body {
        padding: 16px 12px 40px 12px;
    }
    
    .card {
        padding: 24px 18px;
    }
    
    .presets-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .amount-input-wrapper input {
        font-size: 1.85rem;
    }
    
    .qrcode-container {
        width: 200px;
        height: 200px;
    }
}
