/* ==================== ESTILOS CUSTOMIZADOS - REDE CREDENCIADA ==================== */

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Subtítulo nos filtros */
.subtitle-filtros {
    font-size: 0.875rem;
    font-weight: normal;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Etapas dos filtros */
.etapa-filtro {
    padding: 1rem 0;
}

/* Cards de informação do plano */
.info-card {
    height: 100%;
    border-left: 4px solid #1B3184;
    transition: all 0.3s ease;
}

.info-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.info-card .card-subtitle {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.info-card .card-text {
    font-size: 0.95rem;
    margin: 0;
}

/* Cores dos cards de plano baseado na situação */
.info-card.status-ativo {
    border-left-color: #4a7c4e;
}

.info-card.status-ativo .card-text {
    color: #4a7c4e;
}

.info-card.status-suspensa {
    border-left-color: #8b6f47;
}

.info-card.status-suspensa .card-text {
    color: #8b6f47;
}

.info-card.status-inativo {
    border-left-color: #a94442;
}

.info-card.status-inativo .card-text {
    color: #a94442;
}

/* Botões de Rede (Médica/Odonto) */
.btn-group-rede {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-rede {
    flex: 1;
    min-width: 200px;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.btn-rede.active {
    background: #1B3184;
    border-color: #1B3184;
    color: white;
}

.btn-rede i {
    font-size: 1.2rem;
}

/* Switches customizados */
.switch-custom {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    width: 100%;
}

.switch-custom .form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
}

.switch-custom .form-check-input:checked {
    background-color: #1B3184;
    border-color: #1B3184;
}

.switch-custom label {
    margin-left: 0.5rem;
    cursor: pointer;
}

/* Cards de prestadores */
.card-prestador {
    border-left: 4px solid #00a0e6;
    transition: all 0.3s ease;
}

.card-prestador:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px);
}

.prestador-nome {
    color: #1B3184;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.prestador-fantasia {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.endereco-info {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.endereco-info p {
    line-height: 1.6;
}

.endereco-info i {
    color: #00a0e6;
    width: 20px;
}

/* Botões dos cards */
.card-prestador .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

.card-prestador .btn i {
    font-size: 1rem;
}

/* Select de planos */
#cod_plano_comercial {
    font-size: 0.95rem;
    padding: 0.75rem;
}

/* Modais */
.modal-header {
    background: linear-gradient(135deg, #1B3184 0%, #00a0e6 100%);
    color: white;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-body ul {
    max-height: 400px;
    overflow-y: auto;
}

.modal-body .list-group-item {
    border-left: 3px solid #00a0e6;
    margin-bottom: 0.5rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .prestador-nome {
        font-size: 1.1rem;
    }
    
    .prestador-fantasia {
        font-size: 0.9rem;
    }
    
    .endereco-info {
        font-size: 0.85rem;
    }
    
    .switch-custom {
        margin-bottom: 1rem;
    }
    
    .info-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .card-prestador .btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }
    
    .badges-container .badge {
        font-size: 0.7rem;
    }
}

/* Loading state */
.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;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Melhorias de acessibilidade */
.btn:focus,
.form-check-input:focus,
.form-select:focus,
.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 160, 230, 0.25);
    border-color: #00a0e6;
}

/* Scroll suave */
html {
    scroll-behavior: smooth;
}

/* Estilo para links no endereço */
.endereco-info a {
    color: #00a0e6;
    text-decoration: none;
    transition: all 0.2s ease;
}

.endereco-info a:hover {
    color: #1B3184;
    text-decoration: underline;
}

/* Alert customizado */
.alert {
    border-left: 4px solid;
}

.alert-primary {
    border-left-color: #1B3184;
}

.alert-warning {
    border-left-color: #ffc107;
}

/* Accordion customizado */
.accordion-button {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    color: #212529;
    text-align: left;
    background-color: #fff;
    border: 0;
    border-radius: 0;
    overflow-anchor: none;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, border-radius 0.15s ease;
}

.accordion-button:not(.collapsed) {
    background-color: #1B3184;
    color: white;
}

.accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(27, 49, 132, 0.25);
}

/* Seta do accordion - customizada */
.accordion-button::after {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-left: auto;
    content: "";
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-size: 1.25rem;
    transition: transform 0.2s ease-in-out;
}

/* Quando está aberto (not collapsed), gira a seta 180 graus */
.accordion-button:not(.collapsed)::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
    transform: rotate(-180deg);
}

/* Accordion collapse */
.accordion-collapse {
    transition: height 0.35s ease;
    overflow: hidden;
}

.accordion-collapse:not(.show) {
    display: none;
}

.accordion-collapse.show {
    display: block;
}

/* Dropdown customizado para autocomplete */
.dropdown-custom {
    position: relative;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.25rem 0.25rem;
    display: none;
    z-index: 1000;
}

.dropdown-custom.show {
    display: block;
}

.dropdown-item-custom {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: all 0.2s ease;
}

.dropdown-item-custom:hover {
    background-color: #f8f9fa;
}

.dropdown-item-custom.selected {
    background-color: #1B3184;
    color: white;
}

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

.no-results {
    padding: 1rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* Select2 Customização */
.select2-container--default .select2-selection--single {
    height: 48px !important;
    padding: 8px 12px;
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem !important;
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 30px;
    color: #495057;
    font-size: 1rem;
    padding-left: 0;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #6c757d;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px !important;
    top: 1px !important;
    right: 5px !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: #00a0e6 !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 160, 230, 0.25) !important;
    outline: none !important;
}

.select2-dropdown {
    border: 1px solid #ced4da !important;
    border-radius: 0.25rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-width: 100% !important;
    z-index: 9999 !important;
    box-sizing: border-box !important;
}

.select2-results {
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #1B3184 !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: #e7f3ff !important;
    color: #1B3184;
}

.select2-container--default .select2-search--dropdown {
    padding: 8px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.5rem;
    font-size: 1rem;
    width: 100% !important;
    box-sizing: border-box !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: #00a0e6;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 160, 230, 0.25);
}

.select2-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.select2-container--default .select2-results__option {
    padding: 10px 12px;
    font-size: 0.95rem;
    word-wrap: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}

.select2-container--default .select2-selection--single .select2-selection__clear {
    margin-right: 10px;
    font-size: 1.2rem;
}

/* Previne overflow horizontal causado pelo Select2 */
body {
    overflow-x: hidden !important;
}

.container {
    overflow-x: hidden !important;
}

.select2-container--open .select2-dropdown {
    left: 0 !important;
    right: auto !important;
}

/* Ajustes responsivos */
@media (max-width: 768px) {
    .select2-dropdown {
        max-width: calc(100vw - 40px) !important;
        left: 20px !important;
    }
    
    .select2-results {
        max-height: 250px !important;
    }
}

/* ==================== PAGINAÇÃO ==================== */
.pagination {
    margin: 0;
}

.pagination .page-link {
    color: #1B3184;
    border-color: #dee2e6;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}

.pagination .page-link:hover {
    background-color: #e7f3ff;
    border-color: #1B3184;
    color: #1B3184;
}

.pagination .page-item.active .page-link {
    background-color: #1B3184;
    border-color: #1B3184;
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    background-color: #f8f9fa;
}

#info-paginacao {
    font-size: 0.9rem;
    color: #6c757d;
}
