/* ========================================================================
   SISTEMA DE CARDS EXPANDÍVEIS - ELIMINAR SCROLL E MELHORAR UX
   ======================================================================== */

/* Reset para remover scroll horizontal */
body, html {
    overflow-x: hidden !important;
}

.container, .container-fluid {
    overflow-x: hidden !important;
}

/* Forçar cards como visualização padrão */
.infractions-container {
    display: block !important;
}

#results-container {
    display: none !important;
}

/* ========================================================================
   CARDS EXPANDÍVEIS PARA INFRAÇÕES
   ======================================================================== */

.infractions-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.infraction-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.infraction-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #007bff;
}

.infraction-card.expanded {
    border-color: #007bff;
    box-shadow: 0 4px 16px rgba(0, 123, 255, 0.15);
}

/* ========================================================================
   SEÇÃO PRINCIPAL (SEMPRE VISÍVEL)
   ======================================================================== */

.card-main {
    padding: 16px;
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    grid-template-areas: 
        "codigo descricao pontos valor gravidade"
        "expand expand expand expand expand";
    gap: 12px;
    align-items: center;
    min-height: 80px;
}

.card-codigo {
    grid-area: codigo;
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
    min-width: 80px;
    text-align: center;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #e9ecef;
}

.card-descricao {
    grid-area: descricao;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #444;
    padding-right: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-pontos {
    grid-area: pontos;
    text-align: center;
    min-width: 60px;
}

.pontos-badge {
    background: #17a2b8;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.card-valor {
    grid-area: valor;
    text-align: center;
    min-width: 100px;
}

.valor-badge {
    background: #28a745;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.card-gravidade {
    grid-area: gravidade;
    text-align: center;
    min-width: 100px;
}

.gravidade-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gravidade-leve {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.gravidade-media {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.gravidade-grave {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.gravidade-gravissima {
    background: #5c0011;
    color: white;
    border: 1px solid #4a000e;
}

/* ========================================================================
   BOTÃO DE EXPANSÃO
   ======================================================================== */

.expand-button {
    grid-area: expand;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #6c757d;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.expand-button:hover {
    background: #e9ecef;
    color: #495057;
}

.expand-button.expanded {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.expand-icon {
    transition: transform 0.3s ease;
}

.expand-button.expanded .expand-icon {
    transform: rotate(180deg);
}

/* ========================================================================
   SEÇÃO EXPANDIDA (DETALHES ADICIONAIS)
   ======================================================================== */

.card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.card-details.expanded {
    max-height: 300px;
    padding: 20px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.detail-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 600;
}

.detail-value {
    font-size: 0.95rem;
    color: #333;
    font-weight: 500;
}

/* ========================================================================
   RESPONSIVIDADE
   ======================================================================== */

/* Tablets */
@media (max-width: 1023px) and (min-width: 768px) {
    .card-main {
        grid-template-columns: auto 1fr auto auto;
        grid-template-areas: 
            "codigo descricao pontos gravidade"
            "valor valor valor valor"
            "expand expand expand expand";
        gap: 10px;
    }
    
    .card-valor {
        grid-area: valor;
        text-align: left;
        margin-top: 8px;
    }
    
    .details-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }
}

/* Celulares */
@media (max-width: 767px) {
    .card-main {
        grid-template-columns: auto 1fr;
        grid-template-areas: 
            "codigo descricao"
            "pontos gravidade"
            "valor valor"
            "expand expand";
        gap: 8px;
        padding: 12px;
    }
    
    .card-codigo {
        font-size: 1rem;
        padding: 6px 10px;
        min-width: 70px;
    }
    
    .card-descricao {
        font-size: 0.9rem;
        -webkit-line-clamp: 3;
    }
    
    .pontos-badge, .valor-badge {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    .gravidade-badge {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .detail-item {
        padding: 10px;
    }
}

/* Celulares pequenos */
@media (max-width: 480px) {
    .card-main {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "codigo"
            "descricao"
            "pontos"
            "valor"
            "gravidade"
            "expand";
        text-align: center;
        gap: 6px;
        padding: 10px;
    }
    
    .card-codigo {
        justify-self: center;
        margin-bottom: 8px;
    }
    
    .card-descricao {
        text-align: left;
        -webkit-line-clamp: 4;
    }
    
    .expand-button {
        margin-top: 12px;
        padding: 10px;
    }
    
    .infraction-card {
        margin-bottom: 8px;
    }
}

/* ========================================================================
   ESTADOS E ANIMAÇÕES
   ======================================================================== */

.infraction-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.infraction-card.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animação de entrada */
.infraction-card {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================================================
   MELHORIAS VISUAIS
   ======================================================================== */

.no-results-card {
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    color: #6c757d;
    margin: 20px 0;
}

.no-results-card i {
    font-size: 3rem;
    margin-bottom: 16px;
    color: #adb5bd;
}

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    margin: 20px 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Indicador de informações adicionais */
.info-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ffc107;
    color: #333;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.infraction-card {
    position: relative;
}

/* Destaque para cards ativos */
.infraction-card:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ========================================================================
   CONTROLES DE PAGINAÇÃO E FILTROS AJUSTADOS
   ======================================================================== */

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.results-count {
    font-weight: 600;
    color: #495057;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.toggle-btn:hover:not(.active) {
    background: #f8f9fa;
} 