/* ==========================================================================
   GOLDEBET - HISTORY CSS
   Estilos específicos para histórico da roleta e estatísticas
   ========================================================================== */

/* =============
   HISTORY CONTAINER
   ============= */
.history-container {
    background: var(--card-dark);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-md);
    overflow: visible !important; /* PERMITIR TOOLTIPS VISÍVEIS */
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px var(--shadow-dark);
}

.history-container.desktop-only {
    width: 320px;
    flex-shrink: 0;
}

.history-container.mobile-only {
    width: 100%;
    margin-bottom: 1rem;
}

.history-header {
    background: var(--tertiary-dark);
    border: 2px solid var(--primary-gold);
    color: var(--text-light);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.history-header h3 {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
}

.history-filter {
    background: var(--card-dark);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-gold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-filter label {
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.875rem;
}

.color-filter-select {
    background: var(--tertiary-dark);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    padding: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    flex: 1;
}

.color-filter-select:hover {
    border-color: var(--primary-gold);
}

.color-filter-select:focus {
    outline: none;
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

.color-filter-select option {
    background: var(--tertiary-dark);
    color: var(--text-light);
}

.close-history-btn {
    background: none;
    border: none;
    color: var(--primary-dark);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.close-history-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* =============
   SUGGESTIONS CONTAINER
   ============= */
.suggestions-container {
    background: #080301;
    border: 2px solid var(--primary-gold);
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
    overflow: hidden;
    box-shadow: 
        0 20px 40px var(--shadow-dark),
        0 0 20px rgba(250, 0, 0, 0.2);
    position: relative;
}

.suggestions-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-gold), transparent);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    z-index: 1;
}

.suggestions-header {
    background: var(--tertiary-dark);
    border: 2px solid var(--primary-gold);
    color: var(--text-light);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.suggestions-header h4 {
    margin: 0;
    font-weight: 600;
    font-size: 0.875rem;
}

.suggestions-content {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.suggestion-item {
    background: var(--tertiary-dark);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-light);
    transition: all var(--transition-fast);
    text-align: center;
}

.suggestion-item.suggestion-blue {
    background: rgba(55, 66, 250, 0.1);
    border-color: rgba(55, 66, 250, 0.3);
    color: var(--text-light);
}

.suggestion-item.suggestion-red {
    background: rgba(220, 53, 69, 0.2);
    border-color: #FA0000;
    color: #ff6b7a;
}

.suggestion-item.suggestion-searching {
    color: #ffffff !important;
    font-style: italic;
    opacity: 0.8;
}

/* =============
   HISTORY CONTENT
   ============= */
.history-content {
    padding: 1rem;
    max-height: 420px;
    overflow-y: auto;
    background: transparent !important;
}

/* Ajuste específico para desktop - historical content height */
.history-container.desktop-only .history-content {
    max-height: 1200px; /* Altura ajustada para acompanhar iframe + botão */
}

.history-grid {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.history-grid.desktop-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    width: 100%;
}

.history-grid.mobile-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    width: 100%;
}

.history-number {
    background: var(--background-dark);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    padding: 0;
    text-align: center;
    font-weight: 600;
    color: var(--text-light);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1.4/1;
}

.history-number:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

/* =============
   HISTORY NUMBER COLORS
   ============= */
.history-number.red {
    background: var(--tertiary-dark);
    border: 2px solid #FA0000;
    color: #FA0000;
}

.history-number.black {
    background: linear-gradient(135deg, #343a40, #23272b);
    border-color: #495057;
    color: white;
}

.history-number.green {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    border-color: #28a745;
    color: white;
}

/* Cores para Dúzias - MUITO DISTINTAS */
.history-number.duzia-1 {
    background: linear-gradient(135deg, #FA0000, #cc3333);
    border-color: #FA0000;
    color: white;
    box-shadow: 0 0 8px rgba(250, 0, 0, 0.5);
}

.history-number.duzia-2 {
    background: linear-gradient(135deg, #ff9500, #e6850e);
    border-color: #ff9500;
    color: white;
    box-shadow: 0 0 8px rgba(255, 149, 0, 0.5);
}

.history-number.duzia-3 {
    background: linear-gradient(135deg, #9900cc, #7a00a3);
    border-color: #9900cc;
    color: white;
    box-shadow: 0 0 8px rgba(153, 0, 204, 0.5);
}

/* Cores para Colunas - MUITO DISTINTAS */
.history-number.coluna-1 {
    background: linear-gradient(135deg, #ff3333, #cc2929);
    border-color: #ff3333;
    color: white;
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.5);
}

.history-number.coluna-2 {
    background: linear-gradient(135deg, #00cc66, #00a352);
    border-color: #00cc66;
    color: white;
    box-shadow: 0 0 8px rgba(0, 204, 102, 0.5);
}

.history-number.coluna-3 {
    background: linear-gradient(135deg, #6600ff, #5200cc);
    border-color: #6600ff;
    color: white;
    box-shadow: 0 0 8px rgba(102, 0, 255, 0.5);
}

/* =============
   HISTORY LOADING & BUTTONS
   ============= */
.history-loading {
    text-align: center;
    padding: 1rem;
    color: var(--text-gray);
}

.load-more-btn {
    width: 100%;
    background: var(--tertiary-dark);
    border: 2px solid var(--primary-gold);
    color: var(--text-light);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

/* =============
   COLOR LEGEND
   ============= */
.color-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 15px 10px;
    padding: 10px 10px 10px 10px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
}

.legend-item {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
    overflow: visible;
}

.legend-item:hover {
    transform: translateY(-2px) scale(1.1);
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.legend-item:hover .legend-color {
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5);
    border-color: rgba(255, 215, 0, 0.8);
}

/* =============
   TOOLTIP SYSTEM
   ============= */
.legend-tooltip {
    position: absolute !important;
    bottom: calc(100% + 15px) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(0, 0, 0, 0.95) !important;
    color: white !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    white-space: normal !important;
    z-index: 99999 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    display: none !important;
    transition: none !important;
    max-width: 320px !important;
    min-width: 200px !important;
    text-align: center !important;
    line-height: 1.5 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 215, 0, 0.3) !important;
    pointer-events: none !important;
}

.legend-tooltip::after {
    content: '' !important;
    position: absolute !important;
    top: 100% !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border: 6px solid transparent !important;
    border-top-color: rgba(0, 0, 0, 0.95) !important;
}

/* TOOLTIP VISÍVEL - Máxima especificidade e força */
body .color-legend .legend-item.active .legend-tooltip,
body .legend-item.active .legend-tooltip,
body .legend-tooltip.force-visible,
.legend-tooltip[data-visible="true"] {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    z-index: 999999 !important;
    position: absolute !important;
    pointer-events: none !important;
}

/* =============
   LEGEND COLORS
   ============= */
/* Cores da legenda para DÚZIAS */
.legend-color.duzia-1 {
    background: linear-gradient(135deg, #FA0000, #cc3333);
    box-shadow: 0 0 8px rgba(250, 0, 0, 0.5);
}

.legend-color.duzia-2 {
    background: linear-gradient(135deg, #ff9500, #e6850e);
    box-shadow: 0 0 8px rgba(255, 149, 0, 0.5);
}

.legend-color.duzia-3 {
    background: linear-gradient(135deg, #9900cc, #7a00a3);
    box-shadow: 0 0 8px rgba(153, 0, 204, 0.5);
}

/* Cores da legenda para COLUNAS */
.legend-color.coluna-1 {
    background: linear-gradient(135deg, #ff3333, #cc2929);
    box-shadow: 0 0 8px rgba(255, 51, 51, 0.5);
}

.legend-color.coluna-2 {
    background: linear-gradient(135deg, #00cc66, #00a352);
    box-shadow: 0 0 8px rgba(0, 204, 102, 0.5);
}

.legend-color.coluna-3 {
    background: linear-gradient(135deg, #6600ff, #5200cc);
    box-shadow: 0 0 8px rgba(102, 0, 255, 0.5);
}

/* Cores da legenda para CORES (padrão) */
.legend-color.red, .history-number.red {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
}

.legend-color.black, .history-number.black {
    background: #343a40 !important;
    border-color: #343a40 !important;
}

.legend-color.green, .history-number.green {
    background: #28a745 !important;
    border-color: #28a745 !important;
}

/* Cores específicas para Football Studio */
.color-dot.azul {
    background: #FA0000 !important;
}

.color-dot.vermelho {
    background: #dc3545 !important;
}

.color-dot.amarelo {
    background: #17a2b8 !important;
}

/* Altos e Baixos */
.legend-color.baixos, .history-number.baixos { background: #000 !important; border-color: #000 !important; color: white !important; }
.legend-color.altos, .history-number.altos { background: #fff !important; border-color: #fff !important; color: black !important; }

/* Gêmeos */
.legend-color.gemeos, .history-number.gemeos { background: #fff !important; border-color: #fff !important; color: black !important; }

/* Dúzias */
.legend-color.duzia-1, .history-number.duzia-1 { background: #06a4c7 !important; border-color: #06a4c7 !important; }
.legend-color.duzia-2, .history-number.duzia-2 { background: #d60f1c !important; border-color: #d60f1c !important; }
.legend-color.duzia-3, .history-number.duzia-3 { background: #f0b907 !important; border-color: #f0b907 !important; }

/* Colunas */
.legend-color.coluna-1, .history-number.coluna-1 { background: #15b381 !important; border-color: #15b381 !important; }
.legend-color.coluna-2, .history-number.coluna-2 { background: #5a22a8 !important; border-color: #5a22a8 !important; }
.legend-color.coluna-3, .history-number.coluna-3 { background: #db1d59 !important; border-color: #db1d59 !important; }

/* Par e Ímpar */
.legend-color.par, .history-number.par { background: #ff001a !important; border-color: #ff001a !important; }
.legend-color.impar, .history-number.impar { background: #FA0000 !important; border-color: #FA0000 !important; }

/* Cavalos */
.legend-color.cavalo-0, .history-number.cavalo-0 { background: #139a46 !important; border-color: #139a46 !important; }
.legend-color.cavalo-147, .history-number.cavalo-147 { background: #1e94a8 !important; border-color: #1e94a8 !important; }
.legend-color.cavalo-258, .history-number.cavalo-258 { background: #a8431e !important; border-color: #a8431e !important; }
.legend-color.cavalo-369, .history-number.cavalo-369 { background: #db1d59 !important; border-color: #db1d59 !important; }

/* Regiões */
.legend-color.tiers, .history-number.tiers { background: #FA0000 !important; border-color: #FA0000 !important; }
.legend-color.orfaos, .history-number.orfaos { background: #FA0000 !important; border-color: #FA0000 !important; }
.legend-color.vizinhanca, .history-number.vizinhanca { background: #00406b !important; border-color: #00406b !important; }
.legend-color.amigos-zero, .history-number.amigos-zero { background: #cc3333 !important; border-color: #cc3333 !important; }

/* Terminais */
.legend-color.terminal-1, .history-number.terminal-1 { background: #033E3F !important; border-color: #033E3F !important; }
.legend-color.terminal-2, .history-number.terminal-2 { background: #3DA5A5 !important; border-color: #3DA5A5 !important; }
.legend-color.terminal-3, .history-number.terminal-3 { background: #F4A053 !important; border-color: #F4A053 !important; }
.legend-color.terminal-4, .history-number.terminal-4 { background: #d62f40 !important; border-color: #d62f40 !important; }
.legend-color.terminal-5, .history-number.terminal-5 { background: #86381D !important; border-color: #86381D !important; }
.legend-color.terminal-6, .history-number.terminal-6 { background: #EF7364 !important; border-color: #EF7364 !important; }
.legend-color.terminal-7, .history-number.terminal-7 { background: #fff !important; border-color: #fff !important; color: black !important; }
.legend-color.terminal-8, .history-number.terminal-8 { background: #B0C4DE !important; border-color: #B0C4DE !important; }
.legend-color.terminal-9, .history-number.terminal-9 { background: #262526 !important; border-color: #262526 !important; }
.legend-color.terminal-0, .history-number.terminal-0 { background: #139a46 !important; border-color: #139a46 !important; }

/* Ruas */
.legend-color.ruas-canto, .history-number.ruas-canto { background: #139a46 !important; border-color: #139a46 !important; }
.legend-color.ruas-meio, .history-number.ruas-meio { background: #1e23a8 !important; border-color: #1e23a8 !important; }

/* =============
   STRATEGY STATS
   ============= */
.legend-content {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 15px !important;
}

.legend-items {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    flex: 1 !important;
}

.legend-stats-container {
    display: flex !important;
    align-items: center !important;
}

.strategy-stats-button {
    background: linear-gradient(135deg, #FA0000, #cc3333) !important;
    border: 1px solid rgba(250, 0, 0, 0.3) !important;
    border-radius: 6px !important;
    color: white !important;
    padding: 8px 10px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 2px 8px rgba(132, 61, 158, 0.2) !important;
}

.strategy-stats-button:hover {
    background: linear-gradient(135deg, #cc3333, #FA0000) !important;
    border-color: #FA0000 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(132, 61, 158, 0.4) !important;
}

.strategy-stats-button i {
    font-size: 14px !important;
}

/* Tooltip de estatísticas */
.strategy-stats-tooltip {
    position: fixed !important;
    background: linear-gradient(135deg, #080301, #080301) !important;
    border: 2px solid #FA0000 !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
    z-index: 10000 !important;
    opacity: 0 !important;
    transform: translateY(10px) !important;
    transition: all 0.3s ease !important;
    max-width: 350px !important;
    min-width: 300px !important;
}

.strategy-stats-tooltip.visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.strategy-stats-content {
    padding: 20px !important;
    color: white !important;
}

.stats-header {
    position: relative !important;
    margin-bottom: 15px !important;
}

.stats-header h4 {
    margin: 0 !important;
    color: #843D9E !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    text-align: center !important;
    padding-right: 35px !important;
}

.stats-main {
    display: flex !important;
    gap: 20px !important;
    margin-bottom: 15px !important;
}

.stats-chart {
    flex: 0 0 auto !important;
}

.stats-details {
    flex: 1 !important;
}

.stats-row {
    display: flex !important;
    justify-content: space-between !important;
    margin-bottom: 8px !important;
    font-size: 14px !important;
}

.stats-label {
    color: #bbb !important;
}

.stats-value {
    font-weight: 600 !important;
}

.green-text {
    color: #00ff00 !important;
}

.red-text {
    color: #FA0000 !important;
}

/* Gráfico de pizza */
.pizza-chart-container {
    text-align: center !important;
}

.pizza-chart {
    margin-bottom: 10px !important;
}

.pizza-legend {
    font-size: 11px !important;
}

.pizza-legend-item {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    margin-bottom: 3px !important;
}

.pizza-color {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
}

.pizza-color.green {
    background: #00ff00 !important;
}

.pizza-color.red {
    background: #FA0000 !important;
}

/* Breakdown de greens */
.stats-breakdown {
    border-top: 1px solid #444 !important;
    padding-top: 15px !important;
}

.stats-breakdown h5 {
    margin: 0 0 10px 0 !important;
    color: #843D9E !important;
    font-size: 14px !important;
    font-weight: 600 !important;
}

.breakdown-row {
    display: flex !important;
    justify-content: space-between !important;
    margin-bottom: 5px !important;
    font-size: 13px !important;
    color: #ccc !important;
}

.breakdown-value {
    font-weight: 600 !important;
    color: white !important;
}

/* Botão X para fechar tooltip */
.stats-close-btn {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    border-radius: 50% !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #ccc !important;
    font-size: 12px !important;
    transition: all 0.2s ease !important;
    z-index: 10 !important;
}

.stats-close-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    transform: scale(1.1) !important;
}

/* Container para botão de estatísticas ao lado das legendas */
.legend-items-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 15px !important;
    flex-wrap: wrap !important;
}

.legend-stats-button-container {
    flex-shrink: 0 !important;
}

/* Estilos especiais para números com gradientes */
.history-number[style*="linear-gradient"] {
    border: 2px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4) !important;
}

.history-number[style*="linear-gradient"]:hover {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6) !important;
}

/* =============
   RESPONSIVE
   ============= */
@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .history-grid.mobile-grid {
        grid-template-columns: repeat(8, 1fr);
    }
    
    .history-number {
        font-size: 11px;
    }
    
    .history-grid.mobile-grid {
        gap: 2px;
    }
    
    .legend-tooltip {
        max-width: 280px !important;
        min-width: 180px !important;
        font-size: 12px !important;
        padding: 10px 14px !important;
    }
    
    .color-legend {
        padding: 8px 8px 40px 8px;
    }
    
    .legend-items-wrapper {
        gap: 10px !important;
    }
    
    .legend-stats-button-container {
        order: 2 !important; /* Botão por último se quebrar linha */
    }
    
    .strategy-stats-tooltip {
        max-width: 280px !important;
        min-width: 250px !important;
        position: fixed !important;
        z-index: 10001 !important;
    }
    
    .legend-content {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .stats-main {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .stats-chart {
        align-self: center !important;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
    
    .desktop-only {
        display: block !important;
    }
}

/* Forçar visibilidade dos tooltips */
.color-legend,
.history-container,
.history-content {
    overflow-y: visible !important;
}

/* Garantir que todos os containers do histórico tenham background transparente */
#historyContainerMobile,
#historyContainerDesktop {
    background: transparent !important;
}

/* Garantir que o grid do histórico tenha background transparente */
#historyGridMobile,
#historyGridDesktop {
    background: transparent !important;
}
