/* ===== CONFIGURAÇÃO DE PAGAMENTOS - ESTILOS PREMIUM ===== */

/* Configurações Globais da Seção */
.pagamentos-management {
    padding: 2rem 1.5rem 3rem;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header da Configuração de Pagamentos */
.payment-config-header {
    position: relative;
}

.payment-config-header::before {
    content: '';
    position: absolute;
    top: -1rem;
    left: -2rem;
    right: -2rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99,102,241,0.3), transparent);
}

.payment-stats-bar .stat-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.payment-stats-bar .stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* Grid de Gateways */
.gateways-grid {
    position: relative;
}

.gateways-grid::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle at 20% 50%, rgba(99,102,241,0.03), transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(139,92,246,0.03), transparent 50%);
    border-radius: 30px;
    pointer-events: none;
}

/* Cards dos Gateways */
.gateway-card {
    position: relative;
    overflow: hidden;
}

.gateway-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

.gateway-card:hover::before {
    left: 100%;
}

/* Estados dos Gateways */
.gateway-card.gateway-connected {
    border-color: rgba(16,185,129,0.3);
    box-shadow: 0 8px 32px rgba(16,185,129,0.1);
}

.gateway-card.gateway-disconnected {
    border-color: rgba(239,68,68,0.2);
}

.gateway-card.gateway-testing {
    border-color: rgba(245,158,11,0.3);
    box-shadow: 0 8px 32px rgba(245,158,11,0.1);
}

/* Logos dos Gateways */
.gateway-logo {
    position: relative;
    overflow: hidden;
}

.gateway-logo::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.gateway-card:hover .gateway-logo::after {
    opacity: 1;
    transform: rotate(45deg) translateX(100%);
}

/* Status Badges */
.status-badge {
    position: relative;
    overflow: hidden;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
    50% { box-shadow: 0 0 0 4px rgba(16,185,129,0.1); }
}

.status-badge.status-secure {
    animation-delay: 0s;
}

/* Métodos de Pagamento Tags */
.payment-methods span {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.payment-methods span:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Barra de Progresso da Configuração */
.config-progress {
    position: relative;
}

#mp-progress-bar {
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Botões de Ação */
.gateway-actions button {
    position: relative;
    overflow: hidden;
}

.gateway-actions button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.gateway-actions button:hover::before {
    width: 300px;
    height: 300px;
}

.gateway-actions button span,
.gateway-actions button i {
    position: relative;
    z-index: 1;
}

/* Gateway "Em Breve" */
.gateway-card.gateway-paypal {
    position: relative;
}

.gateway-card.gateway-paypal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(139,92,246,0.05), rgba(99,102,241,0.05));
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gateway-card.gateway-paypal:hover::after {
    opacity: 1;
}

/* Card "Mais Gateways" */
.gateway-more {
    position: relative;
}

.gateway-more::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(135deg, transparent, rgba(99,102,241,0.3), transparent);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    transition: all 0.3s ease;
    opacity: 0;
}

.gateway-more:hover::before {
    opacity: 1;
    background: linear-gradient(135deg, rgba(99,102,241,0.4), rgba(139,92,246,0.4), rgba(99,102,241,0.4));
}

/* Configurações Globais */
.global-payment-settings {
    position: relative;
    margin-top: 3rem;
}

.global-payment-settings::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05), rgba(255,255,255,0.1));
    border-radius: 22px;
    z-index: -1;
}

/* Grupos de Configuração */
.setting-group {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.setting-group:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
    transform: translateY(-2px);
}

/* Switches Personalizados */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch input + span {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.15);
    transition: 0.3s ease;
    border-radius: 26px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.switch input + span:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.switch input:checked + span {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 0 20px rgba(16,185,129,0.3);
}

.switch input:checked + span:before {
    transform: translateX(22px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

/* Animações de Entrada */
.gateway-card {
    animation: slideInUp 0.6s ease-out backwards;
}

.gateway-card:nth-child(1) { animation-delay: 0.1s; }
.gateway-card:nth-child(2) { animation-delay: 0.2s; }
.gateway-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estados de Loading/Carregamento */
.gateway-loading {
    position: relative;
    overflow: hidden;
}

.gateway-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Tooltips */
[title] {
    position: relative;
}

[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    animation: tooltipFadeIn 0.2s ease;
}

[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 95%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0,0,0,0.9);
    z-index: 1000;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Responsividade Melhorada */
@media (max-width: 1024px) {
    .gateways-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
    
    .payment-stats-bar {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .pagamentos-management {
        padding: 1.5rem 1rem 2rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .gateway-card {
        padding: 1.5rem 1.2rem;
    }
    
    .gateways-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .global-payment-settings > div {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .payment-config-header h2 {
        font-size: 1.5rem;
    }
    
    .gateway-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .gateway-actions {
        width: 100%;
    }
    
    .gateway-actions button:first-child {
        flex-grow: 1;
    }
}

/* ===== LOGOS DOS GATEWAYS ===== */

/* Container do Logo do Mercado Pago */
.mp-logo-container {
    position: relative;
}

.mp-logo-container svg {
    transition: all 0.3s ease;
}

.mp-logo-container:hover svg {
    transform: scale(1.05);
}

/* Fallback para logos que não carregam */
.gateway-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Estados Especiais */
.gateway-card.testing {
    animation: testingPulse 2s ease-in-out infinite;
}

@keyframes testingPulse {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(245,158,11,0.1);
    }
    50% {
        box-shadow: 0 8px 32px rgba(245,158,11,0.3);
    }
}

.gateway-card.connected {
    animation: connectedGlow 3s ease-in-out infinite;
}

@keyframes connectedGlow {
    0%, 100% {
        box-shadow: 0 8px 32px rgba(16,185,129,0.1);
    }
    50% {
        box-shadow: 0 8px 32px rgba(16,185,129,0.2);
    }
}

/* ===== MODAIS E OVERLAYS ===== */

/* Animação de Fade In para Modais */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        backdrop-filter: blur(0px);
    }
    to { 
        opacity: 1; 
        backdrop-filter: blur(10px);
    }
}

/* Modal de Ajuda */
.payment-help-modal {
    animation: fadeIn 0.3s ease;
}

.payment-help-modal > div {
    animation: modalSlideIn 0.4s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal de Solicitação */
.request-gateway-modal {
    animation: fadeIn 0.3s ease;
}

.request-gateway-modal > div {
    animation: modalSlideIn 0.4s ease;
}

/* Estilização de Forms nos Modais */
.request-gateway-modal select:focus,
.request-gateway-modal textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 1px #6366f1;
    background: rgba(255,255,255,0.1);
}

/* Botões dos Modais */
.request-gateway-modal button[type="submit"]:hover {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(99,102,241,0.4);
}

/* ===== ANIMAÇÕES DE LOADING ===== */

/* Efeito de Carregamento nos Cards */
.gateway-loading {
    position: relative;
    overflow: hidden;
    opacity: 0.7;
}

.gateway-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 1.5s infinite;
    z-index: 1;
}

/* ===== EFEITOS VISUAIS ESPECIAIS ===== */

/* Gradiente Animado para Títulos */
.payment-config-header h2 {
    background-size: 200% 200%;
    animation: gradientShift 3s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Efeito de Brilho nos Status Badges */
.status-badge.status-secure::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, rgba(16,185,129,0.3), transparent, rgba(16,185,129,0.3));
    border-radius: inherit;
    z-index: -1;
    animation: badgeGlow 2s linear infinite;
}

@keyframes badgeGlow {
    0% {
        transform: rotate(0deg);
        opacity: 0.5;
    }
    100% {
        transform: rotate(360deg);
        opacity: 0.5;
    }
}

/* ===== MICROINTERAÇÕES ===== */

/* Efeito de Clique nos Botões */
.gateway-actions button:active {
    transform: translateY(1px) scale(0.98);
}

/* Hover nos Cards de Estatística */
.stat-card:hover {
    transform: translateY(-2px) scale(1.02);
}

/* Efeito de Foco nos Switches */
.switch input:focus + span {
    box-shadow: 0 0 0 2px rgba(99,102,241,0.3);
}

/* ===== INDICADORES DE ESTADO ===== */

/* Indicador de Conexão Ativa */
.gateway-card.connected::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(16,185,129,0.5);
    animation: connectionPulse 2s infinite;
    z-index: 2;
}

@keyframes connectionPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* ===== MELHORIAS DE ACESSIBILIDADE ===== */

/* Focus States Melhorados */
button:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Contraste Melhorado para Textos Pequenos */
.gateway-features li,
.payment-methods span {
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ===== OTIMIZAÇÕES DE PERFORMANCE ===== */

/* GPU Acceleration para Animações */
.gateway-card,
.stat-card,
.status-badge,
.gateway-actions button {
    will-change: transform;
    transform: translateZ(0);
}

/* Redução de Motion para Usuários Sensíveis */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .gateway-card:hover {
        transform: none;
    }
    
    .stat-card:hover {
        transform: none;
    }
}
