:root {
    --primary-color: #005b8f;
    --secondary-color: #008a4b;
    --accent-color: #c21c22;
    --light: #f8f9fa;
    --dark: #343a40;
}

/* Estilos base para todos os dispositivos */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f8f9fa;
}

.sort-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 0.7rem;
    padding: 0.3rem 0.8rem;
    margin-left: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
}

.sort-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.sort-btn.sorted-asc {
    background: rgba(40, 167, 69, 0.8);
}

.sort-btn.sorted-desc {
    background: rgba(220, 53, 69, 0.8);
}

.sort-btn i {
    font-size: 0.8rem;
}

.table thead th .favorite-header-star {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    display: inline-block;
}

.table thead th .favorite-header-star:hover {
    color: #ffc107;
    transform: scale(1.2);
}

.table thead th:hover {
    background-color: #004b7a;
}

.table thead th:last-child {
    text-align: center;
    width: 2%;
}

.sort-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
}

.sort-btn.sorted-asc {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.sort-btn.sorted-desc {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.sort-btn i {
    font-size: 0.9rem;
}

th {
    position: relative;
    white-space: nowrap;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(0, 91, 143, 0.05);
    --bs-table-hover-bg: rgba(0, 91, 143, 0.1);
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 500;
    padding: 1rem;
    vertical-align: middle;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.table-hover tbody tr {
    transition: all 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: var(--bs-table-hover-bg);
    transform: translateX(2px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.1);
}

.star-button, .favorite-star {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    font-size: 1.2rem;
    color: #6c757d !important; 
    transition: all 0.3s ease;
}

.star-button i.bi-star,
.favorite-star i.bi-star,
.star-button i.fa-star,
.favorite-star i.fa-star {
    color: #6c757d !important;
}

.star-button.favorited i.bi-star-fill,
.favorite-star.active i.bi-star-fill,
.star-button.favorited i.fa-star,
.favorite-star.active i.fa-star {
    color: #ffc107 !important;
} 

.star-button:hover, .favorite-star:hover {
    transform: scale(1.1);
    color: #ffc107 !important;
}

.star-button:hover i, .favorite-star:hover i {
    color: #ffc107 !important;
}

.telefone-link {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.telefone-link:hover {
    color: var(--primary-color);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5%); }
    to { opacity: 1; transform: translateY(0); }
}

tbody tr {
    animation: fadeIn 0.3s ease forwards;
    opacity: 0;
}

.favorited-row {
    background-color: rgba(241, 196, 15, 0.1) !important;
}

.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    margin-left: 0.2rem;
    color: #6c757d;
    transition: color 0.2s;
}

.sort-btn:hover {
    color: #495057;
}

/* Estilo para linha ao passar o mouse */
.table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.075);
}

.sort-btn.sorted-asc {
    color: #0d6efd;
}

.sort-btn.sorted-desc {
    color: #0d6efd;
}

.copy-btn {
    transition: all 0.2s;
}

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

/* ========== RESPONSIVIDADE ========== */

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
    .main-container {
        padding: 0 2%;
        max-width: 100%;
    }
    
    .header-container {
        padding: 0.8% 0;
    }
    
    .brasao {
        width: 50%;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table th,
    .table td {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    .sort-btn {
        padding: 0.25rem 0.6rem;
        font-size: 0.65rem;
    }
    
    .btn-type-access {
        font-size: 0.85rem;
        padding: 0.45rem 0.9rem;
    }
    
    .section-title1 {
        font-size: 1.3rem;
    }
    
    /* Layout da tabela para tablets */
    .table td:nth-child(1) { width: 30%; } /* Nome */
    .table td:nth-child(2) { width: 30%; } /* Local */
    .table td:nth-child(3) { width: 25%; } /* Telefone */
    .table td:nth-child(4) { width: 15%; } /* Favorito */
}

/* Tablets pequenos (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .table th,
    .table td {
        padding: 0.7rem;
        font-size: 0.85rem;
    }
    
    .brasao {
        width: 60%;
    }
    
    .table td:nth-child(1) { width: 25%; }
    .table td:nth-child(2) { width: 25%; }
    .table td:nth-child(3) { width: 35%; }
    .table td:nth-child(4) { width: 15%; }
    
    #table {
        margin-top: 3%;
        margin-bottom: 2rem;
        width: 100%;
    }
}

/* Dispositivos muito pequenos (≤380px) */
@media (max-width: 380px) {
    .brasao {
        width: 30%;
    }
    
    .titulo-prefeitura {
        font-size: 1.3rem;
    }
    
    .subtitulo-prefeitura {
        font-size: 0.65rem;
        letter-spacing: 0.15rem;
    }
    
    .table th,
    .table td {
        padding: 0.4rem;
        font-size: 0.7rem;
    }

    #table{
        margin-bottom: 2rem;
    }
    
    .table td:nth-child(1) { width: 27%; }
    .table td:nth-child(2) { width: 27%; }
    .table td:nth-child(3) { width: 31%; }
    .table td:nth-child(4) { width: 15%; }
    
    .btn-type-access {
        font-size: 0.65rem;
        padding: 0.3rem 0.6rem;
    }
    
    .section-title1 {
        font-size: 0.9rem;
    }
    
    #search-input {
        font-size: 0.8rem;
        padding: 0.5rem;
    }
}

/* Ajustes para orientação paisagem em mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .header-container {
        padding: 0.5rem 0;
    }
    
    .brasao {
        width: 15%;
    }
    
    .main-container {
        margin-top: 0.5%;
    }
    
    .table th,
    .table td {
        padding: 0.4rem;
        font-size: 0.75rem;
    }
    
    #table {
        margin-top: 1%;
    }
}

/* Dispositivos sem hover (touch) */
@media (hover: none) and (pointer: coarse) {
    .table-hover tbody tr:hover {
        background-color: transparent;
        transform: none;
        box-shadow: none;
    }
    
    .star-button:hover, 
    .favorite-star:hover {
        transform: none;
    }
    
    .sort-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Ajustes de impressão */
@media print {
    .help-btn,
    .btn-type-access,
    .sort-btn,
    .star-button {
        display: none !important;
    }
    
    .table th {
        background-color: #005b8f !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
