* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f4f4f9;
    text-align: center;
    margin: 0;
    height: 100dvh;
    overflow: hidden;
}

.title {
    color: #1a237e;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

/* Grid Responsiva */
.dashboard-grid {
    display: grid;
    /* No PC/TV: 5 colunas. No Celular: se ajusta sozinho */
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    /* padding: 0 10px 0 10px; */
    max-width: 1200px;
    margin: 0 auto;
}

/* Estilo Base do Card */
.card {
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    gap: 8px;
    color: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.card:hover {
    transform: scale(1.02);
}

.count {
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.description {
    font-weight: bold;
    font-size: 0.9rem;
    line-height: 1.3;
}

/* Cores dos Cards */
.bg-red    { background-color: #d32f2f !important; }
.bg-yellow { background-color: #fbc02d !important; }
.bg-green  { background-color: #388e3c !important; }
.bg-blue   { background-color: #1976d2 !important; }
.bg-dark   { background-color: #373b44 !important; }

/* Ajuste para telas muito grandes (TVs) */
@media (min-width: 1600px) {
    .dashboard-grid { max-width: 1600px; gap: 15px; }
    /* .card { min-height: 250px; padding: 30px; } */
    /* .count { font-size: 1.2rem; } */
    /* .description { font-size: 1.1rem; } */
}


/* Cores baseadas na sua lógica */
.status-sucess { background-color: #388e3c !important; } /* Verde */
.status-alert  { background-color: #f1c40f !important; color: #333 !important; } /* Amarelo */
.status-danger { background-color: #e74c3c !important; animation: pulse 2s infinite; } /* Vermelho */
.status-dark   { background-color: #2c3e50 !important; animation: pulse-dark 2s infinite; } /* Grafite */

/* Animações de Alerta para tempos altos */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

@keyframes pulse-dark {
    0% { box-shadow: 0 0 0 0 rgba(44, 62, 80, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(44, 62, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(44, 62, 80, 0); }
}

.tempo-espera {
    font-size: 1.5rem;
    font-weight: bold;
}


/* Estilo do Modal */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.modal-content {
    background-color: #fefefe;
    margin: 2% auto;
    padding: 20px;
    width: 95%;
    max-height: 90vh;
    border-radius: 8px;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.close-button {
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    color: #333;
}

/* Grid de Detalhamento (igual à foto enviada) */
.detalhamento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

/* Estilo do Card de Detalhe (Pequeno e Vermelho) */
.card-detalhe {
    background-color: #d32f2f;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.75rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-detalhe span { font-weight: bold; }
.card-detalhe .data { border-bottom: 1px solid rgba(255,255,255,0.3); padding-bottom: 5px; }

/* Cursor de clique nos cards principais */
.card { cursor: pointer; }



.ranking-wrapper{
    height: 100%;
}

/* Layout em colunas para PC */
.main-layout {
    display: flex;
    gap: 10px;
    padding: 10px;
    width: 100%;
    height: 100%;

}

.left-side {
    flex: 3; /* Ocupa a maior parte */
    width: 100%; /* Garante que ela tente ocupar o espaço todo */
    height: 100%;
    overflow:hidden auto ;
    padding: 0 10px 0 10px
}

.right-side {
    flex: 1;
    min-width: 320px;
    background-color: #f8f9fa;
    border-left: 2px solid #ddd;
    padding:10px;
    transition: 0.3s ease;
    height: 100%;
    overflow-y: auto;
}

/* Estilos dos Rankings */
.title-ranking { font-size: 1.1rem; color: #1a237e; text-align: center; margin-bottom: 10px; }
.filter-group { display: flex; gap: 5px; justify-content: center; margin-bottom: 10px; }
.btn-rank { background: #b0c4de; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 0.75rem; }
.btn-rank.active { background: #5c7ca6; color: white; }

/* Responsividade Celular/Tablet */
@media (max-width: 1100px) {
    .right-side {
        position: fixed;
        right: -100%; /* Escondido */
        top: 0;
        height: 100%;
        z-index: 999;
        box-shadow: -5px 0 15px rgba(0,0,0,0.2);
    }
    
    .right-side.open { right: 0; } /* Abre lateralmente */
    
    .btn-mobile-ranking {
        display: block;
        position: fixed;
        bottom: 20px;
        right: 20px;
        background: #1a237e;
        color: white;
        border: none;
        padding: 15px;
        border-radius: 50px;
        z-index: 1000;
        cursor: pointer;
    }

    .main-layout {
        flex-direction: column; /* No celular, tudo fica em uma coluna só */
        padding: 5px;
    }

    .left-side {
        flex: none; /* Desativa o flex 3 no celular */
        width: 100%; /* Força 100% de largura */
    }
    
    /* Ajuste extra: faz os títulos diminuírem um pouco no celular */
    .title {
        font-size: 1.4rem;
        margin-top: 20px !important;
    }
}

@media (min-width: 1101px) {
    .btn-mobile-ranking { display: none; }
}


/* Estilo dos Mini Cards de Ranking */
.ranking-placeholder {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 10px;
}

.rank-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.rank-card:hover {
    transform: translateX(-5px);
}

.rank-pos {
    margin-right: 10px;
    font-size: 1rem;
    opacity: 0.9;
}

.rank-name {
    flex: 1;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
}

.rank-total {
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #e0e0e0;
  border-top: 5px solid #007bff; /* Cor do traço que gira */
  border-radius: 50%;
  animation: spin 1s linear infinite; /* Rotação infinita */
  margin: 20px auto; /* Centraliza horizontalmente */
}

.hidden-spinner{
    display: block;
}

/* Animação que faz girar */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}   