/* 🎨 Melhorias de UX e Performance - Sistema de Rifas */

/* ============================================
   1. LAZY LOAD DE IMAGENS
   ============================================ */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Placeholder enquanto carrega */
img[data-src] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   2. EFEITOS HOVER SUAVES
   ============================================ */
.btn, button, a.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn:hover, button:hover, a.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active, button:active, a.btn:active {
    transform: translateY(0);
}

/* Efeito ripple nos botões */
.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

/* Links com hover suave */
a:not(.btn):not(.nav-link) {
    transition: color 0.2s ease, opacity 0.2s ease;
}

a:not(.btn):not(.nav-link):hover {
    opacity: 0.8;
}

/* ============================================
   3. LEGIBILIDADE DE TEXTOS SOBRE IMAGENS
   ============================================ */
.SorteioTpl_sorteioTpl__2s2Wu,
.SorteioTpl_info__t1BZr,
.custom-content-wrapper {
    position: relative;
}

.SorteioTpl_info__t1BZr::before,
.custom-content-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 70%, rgba(0,0,0,0.6) 100%);
    pointer-events: none;
    z-index: 1;
    border-radius: inherit;
}

.SorteioTpl_info__t1BZr > *,
.custom-content-wrapper > * {
    position: relative;
    z-index: 2;
}

/* Sombra de texto para melhor legibilidade */
.SorteioTpl_title__3RLtu,
h1, h2, h3 {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   4. RESPONSIVIDADE MELHORADA
   ============================================ */
@media (max-width: 768px) {
    .container-600 {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .SorteioTpl_sorteioTpl__2s2Wu {
        margin-bottom: 1rem;
    }
    
    /* Ajuste de padding em mobile */
    .app-main {
        padding: 1rem 0.5rem;
    }
    
    /* Textos menores em mobile */
    .SorteioTpl_title__3RLtu {
        font-size: 1.2rem !important;
    }
    
    .SorteioTpl_descricao__1b7iL {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    .vendasExpressNumsSelect.v2 .item {
        width: 48% !important;
        margin-bottom: 0.5rem;
    }
    
    .header-app-header {
        padding: 10px 0;
    }
}

/* ============================================
   5. TEMA ESCURO/CLARO
   ============================================ */
[data-theme="dark"] {
    --incrivel-bg: #1a1a1a;
    --incrivel-border: #333;
    --incrivel-bgColor: #e0e0e0;
    --incrivel-cardBg: #2a2a2a;
    --incrivel-cardColor: #e0e0e0;
    --incrivel-formBg: #2a2a2a;
    --incrivel-formColor: #e0e0e0;
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #e0e0e0;
}

[data-theme="dark"] .bg-white {
    background-color: #2a2a2a !important;
}

[data-theme="dark"] .text-dark {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .card,
[data-theme="dark"] .modern-form-card {
    background-color: #2a2a2a;
    border-color: #333;
    color: #e0e0e0;
}

/* Toggle de tema */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* ============================================
   6. CONTADORES E DESTAQUES VISUAIS
   ============================================ */
.raffle-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: #10b981;
    color: white;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.75rem;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2);
    transition: all 0.2s ease;
}

.raffle-counter:hover {
    background: #059669;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.25);
}

.raffle-counter .icon {
    font-size: 0.9rem;
}

/* Badge de rifa ativa */
.badge-active {
    position: relative;
    overflow: hidden;
}

.badge-active::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* ============================================
   7. ANIMAÇÕES SUAVES DE ENTRADA
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.SorteioTpl_sorteioTpl__2s2Wu {
    animation: fadeInUp 0.6s ease-out;
}

/* Stagger animation para múltiplos itens */
.SorteioTpl_sorteioTpl__2s2Wu:nth-child(1) { animation-delay: 0.1s; }
.SorteioTpl_sorteioTpl__2s2Wu:nth-child(2) { animation-delay: 0.2s; }
.SorteioTpl_sorteioTpl__2s2Wu:nth-child(3) { animation-delay: 0.3s; }
.SorteioTpl_sorteioTpl__2s2Wu:nth-child(4) { animation-delay: 0.4s; }

/* ============================================
   8. SCROLL SUAVE
   ============================================ */
html {
    scroll-behavior: smooth;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #2a2a2a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ============================================
   9. CORREÇÃO DE SOBREPOSIÇÃO
   ============================================ */
.vendasExpressNumsSelect .item.mais-popular:before {
    top: -12px !important;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    white-space: nowrap;
}

/* Garantir que textos não sobreponham */
.SorteioTpl_info__t1BZr {
    min-height: 80px;
    padding: 1rem;
}

/* ============================================
   10. PERFORMANCE - WILL-CHANGE
   ============================================ */
.SorteioTpl_sorteioTpl__2s2Wu,
.btn,
.theme-toggle {
    will-change: transform;
}

/* ============================================
   11. LOADING STATES
   ============================================ */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   12. MELHORIAS DE ACESSIBILIDADE
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visível para acessibilidade */
*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ============================================
   13. CORREÇÃO DO INPUT DE QUANTIDADE
   ============================================ */
/* APENAS corrigir a cor do número para preto - caixinha sempre branca */
.vendasExpressNums input.qty,
.vendasExpressNums .form-control.qty,
.vendasExpressNums input.form-control.qty,
input.qty,
.form-control.qty,
input.form-control.text-center.qty,
.vendasExpressNums .center input.qty,
.vendasExpressNums .center .form-control.qty {
    color: #000000 !important;
    background-color: #ffffff !important;
}

/* Garantir que o número seja sempre preto e caixinha sempre branca */
.vendasExpressNums input.qty[value],
.vendasExpressNums .form-control.qty[value],
input.qty[value],
.vendasExpressNums input.qty.has-value,
.vendasExpressNums .form-control.qty.has-value,
input.qty.has-value,
.vendasExpressNums input.qty:focus,
.vendasExpressNums .form-control.qty:focus,
input.qty:focus {
    color: #000000 !important;
    background-color: #ffffff !important;
}

/* Garantir que o container não mude de cor */
.vendasExpressNums,
.vendasExpressNums.has-value,
.vendasExpressNums.has-value-container {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ============================================
   14. DASHBOARD ADMIN MODERNIZADO
   ============================================ */
/* Dashboard mais clean e profissional */
.dashboard-title {
    color: #1f2937;
    font-weight: 700;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #e5e7eb;
}

/* Cards do dashboard mais simples e limpos */
.dashboard-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

.dashboard-card:hover::before {
    transform: scaleX(1);
}

.dashboard-card.green {
    border-left: 4px solid #10b981;
}

.dashboard-card.green::before {
    background: #10b981;
}

.dashboard-card.orange {
    border-left: 4px solid #f59e0b;
}

.dashboard-card.orange::before {
    background: #f59e0b;
}

.dashboard-card.blue {
    border-left: 4px solid #3b82f6;
}

.dashboard-card.blue::before {
    background: #3b82f6;
}

.dashboard-card.teal {
    border-left: 4px solid #14b8a6;
}

.dashboard-card.teal::before {
    background: #14b8a6;
}

.dashboard-card .card-title {
    color: #6b7280;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.dashboard-card .card-value {
    color: #1f2937;
    font-weight: 700;
    font-size: 2rem;
    line-height: 1.2;
}

.dashboard-card .icon-wrapper {
    background: #f3f4f6;
    border-radius: 10px;
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.dashboard-card:hover .icon-wrapper {
    background: #e5e7eb;
    transform: scale(1.05);
}

.dashboard-card.green .icon-wrapper {
    background: #d1fae5;
    color: #10b981;
}

.dashboard-card.orange .icon-wrapper {
    background: #fef3c7;
    color: #f59e0b;
}

.dashboard-card.blue .icon-wrapper {
    background: #dbeafe;
    color: #3b82f6;
}

.dashboard-card.teal .icon-wrapper {
    background: #ccfbf1;
    color: #14b8a6;
}

/* Formulários do dashboard */
.modern-form-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.modern-form-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.modern-form-card::before {
    display: none;
}

.modern-form-card::after {
    display: none;
}

/* Botões do dashboard */
.modern-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
    color: white;
}

/* Inputs e selects do dashboard */
.modern-form-card select,
.modern-form-card input {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #1f2937;
}

.modern-form-card select:focus,
.modern-form-card input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* Responsividade do dashboard */
@media (max-width: 1024px) {
    .dashboard-card {
        padding: 1.25rem;
    }
    
    .dashboard-card .card-value {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .dashboard-title {
        font-size: 1.75rem;
    }
    
    .dashboard-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .dashboard-card .card-value {
        font-size: 1.5rem;
    }
    
    .dashboard-card .icon-wrapper {
        padding: 0.5rem;
    }
    
    .modern-form-card {
        padding: 1rem;
    }
}

/* Animações mais sutis */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-card {
    animation: fadeInUp 0.4s ease-out;
}

.dashboard-card:nth-child(1) { animation-delay: 0.05s; }
.dashboard-card:nth-child(2) { animation-delay: 0.1s; }
.dashboard-card:nth-child(3) { animation-delay: 0.15s; }
.dashboard-card:nth-child(4) { animation-delay: 0.2s; }

