/* Busca v4 - Estilos Principais */

/* Reset e variáveis */
:root {
    --primary-color: rgb(110, 170, 36);
    --success-color: #28a745;
    --chip-bg: #6ea924;
    --chip-hover: #5a8a1c;
    --border-color: #dee2e6;
    --bg-light: #f8f9fa;
    --text-muted: #6c757d;
    --text-dark: #212529;
    --sidebar-width: 300px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #212529;
    background-color: #f8f9fa;
}

/* Layout principal */
.container-fluid {
    padding: 0;
    margin: 0;
}

.row {
    margin: 0;
}

.col-md-3, .col-md-9 {
    padding: 0;
}

/* Sidebar de filtros */
.filters-sidebar {
    /*background: #fff;*/
    /*border-right: 1px solid var(--border-color);*/
    padding: 12px;
    /*height: 100vh;*/
    /*overflow-y: auto;*/
    position: sticky;
    top: 0;
}

@media (min-width: 768px) {
    .fito-busca-layout {
        align-items: flex-start;
    }

    .fito-busca-layout > .col-md-3,
    .fito-busca-layout > .col-md-9 {
        align-self: flex-start;
    }

    .fito-busca-layout .filters-sidebar {
        top: 1rem;
        max-height: calc(100vh - 1rem);
        overflow-y: auto;
    }
}

/* Secao de busca */
.search-section {
    margin-bottom: 10px;
    /*background: white;*/
    padding: 8px 4px;
    border-bottom: 1px solid #e0e0e0;
}

    .search-section .input-group {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
       /* border-radius: 6px;*/
        overflow: hidden;
    }

    .search-section .form-control {
        border: 1px solid var(--border-color);
        padding: 8px 12px;
        font-size: 14px;
        border-right: none;
        height: auto !important;
    }

        .search-section .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: none;
           /* border-radius: 10px;*/
        }

    .search-section .btn {
        padding: 8px 12px;
        border: 1px solid var(--primary-color);
        background: var(--primary-color);
        color: white;
    }

        .search-section .btn:hover {
            background: #0056b3;
            border-color: #0056b3;
        }

/* Chips section */
.chips-section {
    margin-bottom: 20px;
    min-height: 40px;
    padding: 8px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-direction: column;
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--chip-bg);
    color: white;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    transition: all 0.2s ease;
    margin: 2px 1px 1px 2px;
}

    .chip:hover {
        background: var(--chip-hover);
        transform: translateY(-1px);
    }

    .chip .remove-chip {
        background: none;
        border: none;
        color: white;
        cursor: pointer;
        padding: 0;
        margin-left: 4px;
        font-size: 14px;
        line-height: 1;
        opacity: 0.7;
        transition: all 0.2s ease;
        width: 16px;
        height: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

        .chip .remove-chip:hover {
            opacity: 1;
            background: rgba(255,255,255,0.2);
            transform: scale(1.1);
        }

/*chip .remove-chip::before {
            content: '×';
            font-weight: bold;
        }*/

.clear-filters {
    color: #dc3545;
    text-decoration: none;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
    background: white;
    border: 1px solid #dc3545;
    font-weight: 500;
    display: inline-block;
}

    .clear-filters:hover {
        color: white;
        background: #dc3545;
        text-decoration: none;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
    }

/* Blocos de filtro */
.filter-block {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease;
}

    .filter-block:hover {
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }

.filter-block-header {
    background: var(--bg-light);
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

    .filter-block-header:hover {
        background: #e9ecef;
    }

    .filter-block-header h5 {
        margin: 0;
        font-size: 14px;
        font-weight: 600;
        color: #495057;
        display: flex;
        align-items: center;
        gap: 6px;
    }

.block-count {
    background: #e9ecef;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.filter-block-header i {
    color: var(--text-muted);
    font-size: 12px;
    transition: transform 0.2s;
}

.filter-block-header.collapsed i {
    transform: rotate(180deg);
}

.filter-block-content {
    padding: 10px;
    transition: all 0.3s ease;
}

    .filter-block-content.collapsed {
        display: none;
    }

/* Busca dentro do filtro */
.search-filter {
    margin-bottom: 8px 8px 8px 4px;
}

    .search-filter .form-control {
        font-size: 13px;
        padding: 6px 8px;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        height: 30px !important;
    }

        .search-filter .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
        }

/* Lista de filtros */
.filter-list {
    max-height: 200px;
    overflow-y: auto;
}

.filtro-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid #f1f3f4;
    transition: all 0.2s;
    border-radius: 4px;
    margin: 1px 0;
}

    .filtro-item:last-child {
        border-bottom: none;
    }

    .filtro-item:hover {
        background: var(--bg-light);
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .filtro-item input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin: 0;
        cursor: pointer;
    }

    .filtro-item label {
        margin: 0;
        cursor: pointer;
        flex: 1;
        font-size: 13px;
        line-height: 1.4;
    }

    .filtro-item a {
        color: #495057;
        text-decoration: none;
        display: block;
    }

        .filtro-item a:hover {
            color: var(--primary-color);
            text-decoration: none;
        }

    .filtro-item.hidden {
        display: none;
    }

/* Ver mais */
.ver-mais-container {
    margin-top: 5px;
    padding-top: 0px;
    border-top: 1px solid #f1f3f4;
    padding-left: 10px;
}

.ver-mais-bloco {
    display: block;
    width: 100%;
    padding: 4px 5px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

    .ver-mais-bloco:hover {
        background: #e9ecef;
        color: var(--primary-color);
        text-decoration: none;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .ver-mais-bloco.expandido {
        background: #dc3545;
        color: white;
        border-color: #dc3545;
    }

        .ver-mais-bloco.expandido:hover {
            background: #c82333;
            color: white;
        }

/* Link "Ver mais" */
.ver-mais {
    color: var(--chip-bg);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 0;
    display: block;
    text-align: center;
    border-top: 1px solid #f1f3f4;
    margin-top: 6px;
    transition: all 0.2s ease;
}

    .ver-mais:hover {
        color: var(--chip-hover);
        background: #f8f9fa;
        text-decoration: none;
    }

/* Botao limpar todos */
.btn-limpar {
    background: #6c757d;
    color: white;
    border: 1px solid #6c757d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

    .btn-limpar:hover {
        background: #5a6268;
        border-color: #5a6268;
        color: white;
        text-decoration: none;
        transform: translateY(-1px);
    }



/* Itens adicionais */
.item-adicional {
    animation: slideIn 0.3s ease-out;
}

/* Mobile search bar */
.mobile-search-bar {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

    .mobile-search-bar .form-control {
        font-size: 14px;
        padding: 10px 12px;
    }

    .mobile-search-bar .btn {
        padding: 10px 12px;
    }

/* area de resultados */
.results-area {
    padding: 20px;
    background: white;
    min-height: 100vh;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.results-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #212529;
}

.results-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* Cards de resultado */
.result-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

    .result-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        transform: translateY(-1px);
    }

.card-content {
    display: flex;
    gap: 16px;
}

.card-image {
    width: 80px;
    height: 80px;
    background: var(--bg-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
}

.card-info {
    flex: 1;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
    color: #212529;
}

.card-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.card-description {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
}

/* Scrollbar customizada */
.filters-sidebar::-webkit-scrollbar,
.filter-list::-webkit-scrollbar {
    width: 6px;
}

.filters-sidebar::-webkit-scrollbar-track,
.filter-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.filters-sidebar::-webkit-scrollbar-thumb,
.filter-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

    .filters-sidebar::-webkit-scrollbar-thumb:hover,
    .filter-list::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8;
    }

/* Animacoes */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile */
.mobile-bar {
    display: none;
    background: white;
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Chips section mobile */
.chips-section-mobile {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 8px 10px;
    min-height: 40px;
}

    .chips-section-mobile .container-fluid {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

#chips-container-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

/* Ocultar secao de chips mobile quando vazia */
.chips-section-mobile:not(:has(.chip)) {
    display: none;
}

.clear-filters-mobile {
    color: #dc3545;
    text-decoration: none;
    font-size: 12px;
    padding: 3px 12px;
    border-radius: 4px;
    transition: all 0.2s;
    background: white;
    border: 1px solid #dc3545;
    font-weight: 500;
    display: inline-block;
    white-space: nowrap;
}

    .clear-filters-mobile:hover {
        color: white;
        background: #dc3545;
        text-decoration: none;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
    }

/* Responsividade */
@media (max-width: 767px) {
    .mobile-bar {
        display: block;
    }

    .filters-sidebar {
        display: none;
    }

    .results-area {
        padding: 8px;
    }

    .result-card {
        padding: 10px;
        margin-bottom: 8px;
    }

    .card-content {
        gap: 12px;
    }

    .card-image {
        width: 60px;
        height: 60px;
    }

    .card-title {
        font-size: 14px;
    }

    .chip {
        font-size: 11px;
        padding: 4px 8px;
    }

    .chips-section {
        margin-bottom: 8px;
        padding: 6px;
    }

    .filter-block {
        margin-bottom: 8px;
    }
}

/* Estados especiais */
.filtro-item.selecionado {
    background: #e3f2fd;
    border-left: 3px solid var(--primary-color);
    font-weight: 500;
}

.block-count.atualizado {
    background: var(--chip-bg);
    color: white;
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Modal Mobile Customizado */
.modal-dialog-mobile-custom {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    height: auto;
    width: 70%;
    max-width: none;
    margin: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.modal.show .modal-dialog-mobile-custom {
    transform: translateX(0);
}

.modal-dialog-mobile-custom .modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.modal-dialog-mobile-custom .modal-header {
    position: relative;
    padding: 5px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.modal-dialog-mobile-custom .modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

.btn-close-custom {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: #6c757d;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

    .btn-close-custom:hover {
        background: #e9ecef;
        color: #495057;
    }

.modal-dialog-mobile-custom .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

.modal-dialog-mobile-custom .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex-shrink: 0;
    padding: 10px 20px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #e0e0e0;
    background: #f8f9fa;
}

@supports (-webkit-touch-callout: none) {
    .modal-dialog-mobile-custom {
        height: 100%;
    }

    .modal-dialog-mobile-custom .modal-content {
        min-height: -webkit-fill-available;
    }
}

.btn-aplicar-mobile {
    /*width: 100%;*/
    padding: 4px 16px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
}

/* Backdrop customizado para modal mobile */
#modalFiltros .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.4);
}

/* Ajustes para mobile filters dentro do modal */
.modal-dialog-mobile-custom .mobile-filters {
    padding: 16px 20px;
}

.mobile-filters .search-filter {
    padding: 0px 7px 2px;
}

.modal-dialog-mobile-custom .filter-block {
    margin-bottom: 16px;
}

.modal-dialog-mobile-custom .filter-block-header {
    padding: 12px 10px;
}

.modal-dialog-mobile-custom .filter-block-content {
    padding-left: 0;
}

/* Responsividade para telas muito pequenas */
@media (max-width: 480px) {
    .modal-dialog-mobile-custom {
        width: 85%;
    }
}

@media (max-width: 360px) {
    .modal-dialog-mobile-custom {
        width: 95%;
    }
}



/* Estilo para a sobreposicao (backdrop) */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

    #loading-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    #loading-overlay p {
        color: white;
        margin-top: 15px;
        font-size: 1.2em;
    }




