/* style.css */

/* --- IMPORTAÇÃO DE FONTE MODERNA --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CONFIGURAÇÕES GLOBAIS E FONTES --- */
:root {
    --background-light: #f3f4f6;
    --background-dark: #111827;
    --text-light: #1f2937;
    --text-dark: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 0;
    line-height: 1.6;
}

/* --- LOADER INICIAL OTIMIZADO --- */
#initial-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100vh;
    font-size: 1.5rem;
    color: #9ca3af;
    gap: 1rem;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #06b6d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- ANIMAÇÕES OTIMIZADAS --- */
@keyframes fall {
    from {
        transform: translateY(-10vh) rotate(0deg);
        opacity: 0.7;
    }
    to {
        transform: translateY(110vh) rotate(720deg);
        opacity: 0;
    }
}

/* --- CRIPTO TICKER OTIMIZADO --- */
.ticker-wrap {
    overflow: hidden;
    width: 100%;
    background-color: transparent;
    padding: 0.5rem 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.dark .ticker-wrap {
    border-top-color: #374151;
    border-bottom-color: #374151;
}

.ticker-move {
    display: flex;
    justify-content: center;
    white-space: nowrap;
}

/* --- OTIMIZAÇÕES DE PERFORMANCE --- */
.number-ball {
    will-change: transform;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* --- MELHORIAS MODO ESCURO --- */
@media (prefers-color-scheme: dark) {
    html {
        color-scheme: dark;
    }
}

/* --- ESTILOS DE TEXTO (PROSE) --- */
.prose {
    max-width: 65ch;
    margin-left: auto;
    margin-right: auto;
}

.dark .prose-invert {
    color: #d1d5db;
}

.dark .prose-invert h1,
.dark .prose-invert h2,
.dark .prose-invert h3,
.dark .prose-invert h4,
.dark .prose-invert strong {
    color: #f9fafb;
}

/* --- OTIMIZAÇÕES MOBILE AVANÇADAS --- */
@media (max-width: 640px) {
    body {
        font-size: 14px;
        padding: 0 0.5rem;
    }
    
    .number-ball {
        font-size: 0.875rem;
        min-width: 2rem;
        min-height: 2rem;
    }
    
    #initial-loader {
        font-size: 1.25rem;
    }
    
    /* Melhorias para formulários mobile */
    input, select, textarea {
        font-size: 16px; /* Previne zoom no iOS */
        padding: 0.625rem;
        border-radius: 0.5rem;
    }
    
    /* Botões acessíveis no mobile - sem forçar tamanho em botões de modal */
    button {
        min-height: 36px;
        font-size: 0.875rem;
    }
    
    /* Tabelas responsivas */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Cards mais compactos */
    .card {
        margin: 0.5rem 0;
        padding: 1rem;
    }
    
    /* Menu mobile */
    .mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.9);
        z-index: 9999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .mobile-menu.open {
        transform: translateX(0);
    }

    /* === MODAIS RESPONSIVOS PWA === */
    
    /* Overlay: padding mínimo para mobile */
    .fixed.inset-0.z-50,
    .fixed.inset-0.z-\[9999\] {
        padding: 0.375rem !important;
    }

    /* Conteúdo do modal: largura total, border-radius menor */
    .fixed.inset-0 > div[class*="rounded-xl"],
    .fixed.inset-0 > div[class*="rounded-2xl"] {
        border-radius: 0.75rem;
        max-height: 95vh;
    }

    /* Headers de modal: compactos */
    .fixed.inset-0 div[class*="border-b"][class*="sticky"] {
        padding: 0.625rem 0.75rem !important;
        gap: 0.375rem;
    }

    /* Títulos h2 dentro de modais: tamanho menor */
    .fixed.inset-0 h2 {
        font-size: 0.875rem !important;
        line-height: 1.3;
    }

    /* Botões de navegação (<<, >>) dentro de modais */
    .fixed.inset-0 button[class*="px-2"],
    .fixed.inset-0 button[class*="px-3"] {
        padding: 0.25rem 0.5rem !important;
        min-height: 32px !important;
        min-width: 32px !important;
        font-size: 0.8rem !important;
    }

    /* Botões de fechar (X) dentro de modais */
    .fixed.inset-0 button svg[class*="lucide-x"] {
        width: 18px;
        height: 18px;
    }

    /* Tabelas de premiação dentro de modais */
    .fixed.inset-0 table {
        font-size: 0.75rem;
        width: 100%;
    }
    
    .fixed.inset-0 table th,
    .fixed.inset-0 table td {
        padding: 0.375rem 0.5rem;
        white-space: nowrap;
    }

    /* Overflow horizontal para tabelas longas em modais */
    .fixed.inset-0 .overflow-x-auto,
    .fixed.inset-0 div[class*="overflow"] table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Grid dentro de modais - mais compacto */
    .fixed.inset-0 .grid {
        gap: 0.5rem;
    }
    
    /* Padding do conteúdo interno dos modais */
    .fixed.inset-0 div[class*="p-4"]:not([class*="sticky"]):not([class*="border-b"]) {
        padding: 0.75rem !important;
    }

    /* Seção Último Resultado - controles de navegação */
    div[class*="border-gray-300"][class*="rounded-md"][class*="overflow-hidden"] {
        font-size: 0.8rem;
    }
    
    div[class*="border-gray-300"][class*="rounded-md"] span[class*="font-semibold"] {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    div[class*="border-gray-300"][class*="rounded-md"] input {
        width: 3.5rem;
        padding: 0.25rem;
        font-size: 0.8rem;
    }
}

/* Tablets */
@media (min-width: 641px) and (max-width: 1024px) {
    .container {
        padding: 0 1rem;
    }
    
    .grid-cols-auto {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Orientação landscape em mobile */
@media (max-width: 640px) and (orientation: landscape) {
    .mobile-landscape-adjust {
        height: 50vh;
        overflow-y: auto;
    }
}

/* Touch targets maiores (exceto botões compactos dentro de modais) */
@media (pointer: coarse) {
    button:not(.fixed *):not([class*="px-2"]):not([class*="px-3"]),
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Redução de animações para usuários sensíveis */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- GERENCIAMENTO DE FOCO --- */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

/* --- SCROLLBAR CUSTOMIZADO --- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #06b6d4, #3b82f6);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #22d3ee, #06b6d4);
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: #f1f5f9;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #06b6d4 #f1f5f9;
}

/* Scrollbar - Tema Escuro */
.dark ::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.8);
}

.dark ::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #06b6d4, #3b82f6);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #22d3ee, #06b6d4);
    background-clip: padding-box;
}

.dark ::-webkit-scrollbar-corner {
    background: rgba(30, 41, 59, 0.8);
}

/* Firefox - Tema Escuro */
.dark * {
    scrollbar-color: #06b6d4 rgba(30, 41, 59, 0.8);
}

/* Scrollbar para preferência do sistema */
@media (prefers-color-scheme: dark) {
    html:not(.light) ::-webkit-scrollbar-track {
        background: rgba(30, 41, 59, 0.8);
    }
    
    html:not(.light) ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, #06b6d4, #3b82f6);
        border: 2px solid transparent;
        background-clip: padding-box;
    }
    
    html:not(.light) ::-webkit-scrollbar-corner {
        background: rgba(30, 41, 59, 0.8);
    }
    
    html:not(.light) * {
        scrollbar-color: #06b6d4 rgba(30, 41, 59, 0.8);
    }
}

/* --- GRADIENTES MELHORADOS PARA PREMIAÇÃO --- */
.prize-gradient {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.winner-badge {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.improvement-notice {
    background: linear-gradient(135deg, #3498db, #2980b9);
    border: 1px solid rgba(52, 152, 219, 0.3);
}

/* --- MODAL ANIMATIONS --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-slideUp {
    animation: slideUp 0.3s ease-out;
}

/* Modal scrollbar styling */
#register-modal .overflow-y-auto::-webkit-scrollbar {
    width: 8px;
}

#register-modal .overflow-y-auto::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

#register-modal .overflow-y-auto::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#register-modal .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Dark mode scrollbar */
.dark #register-modal .overflow-y-auto::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.dark #register-modal .overflow-y-auto::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

.dark #register-modal .overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
