/* Reset básico e estilos globais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Cores base para cada modalidade */
:root {
    --cor-mega-sena: #209869;
    --cor-lotofacil: #e91e63;
    --cor-quina: #ff9800;
    --cor-lotomania: #9c27b0;
    --cor-timemania: #3f51b5;
    --cor-dia-de-sorte: #009688;
    --cor-modalidade: var(--cor-mega-sena); /* Cor padrão, será atualizada dinamicamente */
}

body {
    background: #f5f5f5;
    font-family: 'Segoe UI', 'Courier New', monospace;
}

.clote-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top-color: var(--cor-modalidade, #209869);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Tabs principais estilo CLOTE */
.clote-tabs {
    display: flex;
    flex-wrap: wrap;
    background: #fff;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid #e0e0e0;
}

.clote-tab {
    padding: 15px 30px;
    color: #666;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-right: 1px solid #e0e0e0;
    transition: all 0.2s;
    background: #fff;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.clote-tab:hover {
    background: #f8f8f8;
    color: #333;
}

.clote-tab.active {
    background: var(--cor-modalidade);
    color: white;
    border-right-color: var(--cor-modalidade);
}

/* Sub-tabs (Frequência, Atraso, etc) */
.sub-tabs {
    display: flex;
    flex-wrap: wrap;
    background: #fff;
    border-radius: 0 0 8px 8px;
    margin-bottom: 20px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    gap: 5px;
}

.sub-tab {
    padding: 10px 20px;
    background: #f8f9fa;
    color: #495057;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    border-radius: 20px;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid #dee2e6;
}

.sub-tab:hover {
    background: #e9ecef;
    color: #212529;
}

.sub-tab.active {
    background: var(--cor-modalidade);
    color: white;
    border-color: var(--cor-modalidade);
}

/* Header da modalidade */
.modalidade-header {
    background: white;
    padding: 20px 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--cor-modalidade);
}

.modalidade-titulo {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

.modalidade-badge {
    background: var(--cor-modalidade);
    color: white;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
}

/* Cards de estatísticas */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--cor-modalidade);
}

.stat-label {
    font-size: 13px;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #333;
}

.stat-sub {
    font-size: 14px;
    color: #999;
    margin-top: 5px;
}

/* Container de conteúdo dinâmico */
.content-area {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

/* Headers das seções */
.frequencia-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.frequencia-titulo {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.conjuntos-titulo {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
}

.grafico-titulo {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

/* Grid de números (Frequência) */
.frequencia-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
    margin-top: 20px;
}

.frequencia-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px 5px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.frequencia-card:hover {
    transform: translateY(-2px);
    border-color: var(--cor-modalidade);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.frequencia-numero {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.frequencia-valor {
    font-size: 14px;
    font-weight: 600;
    color: var(--cor-modalidade);
}

.frequencia-percentual {
    font-size: 11px;
    color: #999;
}

/* Tabela de conjuntos */
.conjuntos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.conjuntos-table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.conjuntos-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    color: #333;
}

.conjuntos-table tr:hover {
    background: #f8f9fa;
}

.conjuntos-table .valor-destaque {
    font-weight: 700;
    color: var(--cor-modalidade);
}

/* Cards de análise de conjuntos */
.conjuntos-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.conjunto-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.conjunto-titulo {
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.conjunto-valor {
    font-size: 28px;
    font-weight: 700;
    color: var(--cor-modalidade);
    margin-bottom: 5px;
}

.conjunto-media {
    font-size: 13px;
    color: #999;
}

/* Estilos para CSN */
.csn-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.csn-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #b8c6d4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.csn-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #e8edf5 0%, #b8c6d4 100%);
}

.csn-titulo {
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.csn-valor {
    font-size: 32px;
    font-weight: 700;
    color: var(--cor-modalidade);
    margin-bottom: 12px;
}

.csn-info {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.csn-info small {
    display: block;
    color: #333;
    font-weight: 600;
    margin-bottom: 6px;
    word-break: break-all;
    letter-spacing: 1px;
}

.csn-barra {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.csn-barra-preenchida {
    height: 100%;
    background: var(--cor-modalidade);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Seção de exemplo de combinações */
.combinacoes-section {
    margin-top: 30px;
}

.combinacoes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.combinacoes-titulo {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.combinacoes-filtros {
    display: flex;
    gap: 10px;
    align-items: center;
}

.combinacoes-filtros input,
.combinacoes-filtros select {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
}

.combinacoes-lista {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #dee2e6;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
}

.combinacao-item {
    padding: 8px 12px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
}

.combinacao-item:last-child {
    border-bottom: none;
}

.combinacao-id {
    color: var(--cor-modalidade);
    font-weight: 700;
    min-width: 80px;
}

.combinacao-numeros {
    font-weight: 500;
    color: #333;
}

.combinacao-freq {
    margin-left: auto;
    color: #999;
    font-size: 12px;
}

/* Controles */
.acoes-box {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    justify-content: flex-end;
}

.btn-clote {
    padding: 8px 16px;
    background: white;
    border: 2px solid var(--cor-modalidade);
    color: var(--cor-modalidade);
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-clote:hover {
    background: var(--cor-modalidade);
    color: white;
}

.btn-clote.primary {
    background: var(--cor-modalidade);
    color: white;
}

.btn-clote.primary:hover {
    filter: brightness(0.9);
}

.erro-mensagem {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 600;
}

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

.atraso-freq {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
}

.previsao-alta {
    color: #dc3545;
    font-weight: 700;
}

.previsao-normal {
    color: #209869;
    font-weight: 700;
}

.previsao-baixa {
    color: #6c757d;
    font-weight: 700;
}

.ciclo-legenda {
    margin-top: 20px;
    font-size: 13px;
    color: #555;
}

.ciclo-legenda ul {
    margin-top: 8px;
    padding-left: 20px;
}

/* Estilos para Combinações Frequentes */
.combinacoes-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.combinacoes-titulo {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--cor-modalidade);
}

.combinacoes-controles-box {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 15px;
}

.controle-grupo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.controle-grupo label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.controle-grupo select,
.controle-grupo input[type="number"],
.controle-grupo input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.controle-grupo input[type="checkbox"] {
    cursor: pointer;
}

.controle-acoes {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.combinacoes-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.combinacao-item {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.combinacao-item:hover {
    background: #e8f5e9;
    border-color: var(--cor-modalidade);
    box-shadow: 0 2px 8px rgba(32, 152, 105, 0.1);
}

.combinacao-id {
    color: #999;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.combinacao-numeros {
    font-weight: 700;
    color: #333;
    font-size: 14px;
    word-spacing: 3px;
    flex: 1;
}

.combinacao-freq {
    background: var(--cor-modalidade);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    min-width: 45px;
    text-align: center;
}

/* ==================== GRÁFICO DE FREQUÊNCIA ==================== */
.grafico-container {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-top: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--cor-modalidade);
}

.grafico-titulo {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.grafico-barras {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 300px;
    background: linear-gradient(to top, #f8f9fa 0%, transparent 100%);
    border-radius: 6px;
    padding: 15px 10px;
    gap: 3px;
    position: relative;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.grafico-barras::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: #dee2e6;
}

.barra {
    flex: 1;
    background: linear-gradient(to top, var(--cor-modalidade), rgba(32, 152, 105, 0.7));
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 4px;
    box-shadow: 0 2px 4px rgba(32, 152, 105, 0.2);
}

.barra:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 8px rgba(32, 152, 105, 0.3);
    z-index: 1;
}

.barra-valor {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 700;
    color: var(--cor-modalidade);
    white-space: nowrap;
    margin-bottom: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.barra:hover .barra-valor {
    opacity: 1;
}

/* Cores para diferentes frequências */
.barra:nth-child(1),
.barra:nth-child(2),
.barra:nth-child(3) {
    background: linear-gradient(to top, #16a34a, rgba(22, 163, 74, 0.7));
}

.barra:nth-child(1):hover,
.barra:nth-child(2):hover,
.barra:nth-child(3):hover {
    box-shadow: 0 6px 12px rgba(22, 163, 74, 0.4);
}

/* Eixo X */
.eixo-x {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    gap: 3px;
    padding: 0 10px;
    position: relative;
}

.eixo-x::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #dee2e6;
}

.eixo-x span {
    flex: 1;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    padding-top: 8px;
    transition: color 0.2s;
}

.eixo-x span:hover {
    color: var(--cor-modalidade);
    font-weight: 700;
}

/* Legenda do gráfico */
.grafico-legenda {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    font-size: 13px;
    flex-wrap: wrap;
}

.legenda-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legenda-cor {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    background: var(--cor-modalidade);
}

.legenda-texto {
    color: #555;
}

/* Responsivo para gráfico */
@media (max-width: 1024px) {
    .grafico-barras {
        height: 250px;
    }
}

@media (max-width: 768px) {
    .frequencia-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .clote-tab {
        padding: 12px 15px;
        font-size: 12px;
    }

    .sub-tab {
        padding: 8px 15px;
        font-size: 12px;
    }

    .combinacoes-controles-box {
        flex-direction: column;
        align-items: stretch;
    }

    .controle-acoes {
        margin-left: 0;
    }

    .combinacoes-lista {
        grid-template-columns: 1fr;
    }

    .grafico-barras {
        height: 200px;
        gap: 2px;
        padding: 10px 5px;
    }

    .grafico-container {
        padding: 15px;
    }

    .eixo-x span {
        font-size: 10px;
        padding-top: 6px;
    }
}

@media (max-width: 480px) {
    .grafico-barras {
        height: 150px;
        gap: 1px;
    }

    .grafico-titulo {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .grafico-container {
        padding: 12px;
        margin-top: 20px;
    }

    .eixo-x span {
        font-size: 9px;
    }

    .barra-valor {
        font-size: 9px;
        margin-bottom: 2px;
    }
}