:root{
    --primary-color: #2b448b;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --white-color: #ffffff;
    --black-color: #000000;
    --blue-color: #0d6efd;
    --gray-light: #e9ecef;
    --gray-medium: #666666;
    --gray-border: #eee;
    --gray-background: #f9f9f9;
    --link-color: #0073aa;
}

#top-menu-nav:has(#cl-location-dropdown) {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
}
#cl-location-dropdown {
    margin: 0px;
    width: 100%;
    padding: 0px !important;
}
#cl-location-dropdown .row{
    margin: 0px !important;
}
#cl-location-select {
    padding: 5px;
    min-width: 250px;
    max-width: 100%;
}
#cl-find-closest {
    padding: 5px 15px;
    display: none;
}
#cl-closest-result {
    margin-top: 15px;
    font-weight: bold;
    display: none;
}

/* Modal styling - use standard Bootstrap z-index values */
.modal.show {
    z-index: 109999955; /* Bootstrap's standard modal z-index */
}

.modal-backdrop {
    z-index: 99998; /* Bootstrap's standard backdrop z-index */
}

.modal.show .modal-dialog {
    transform: translateY(-50%);
    top: 50%;
}

/* Ensure backdrop is properly removed */
body.modal-open {
    overflow: hidden;
}

body:not(.modal-open) .modal-backdrop {
    display: none !important;
}

/* Wrapper para el dropdown y el icono */
.cl-dropdown-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

#cl-location-modal .modal-title{
    color: var(--black-color);
    z-index: 99999;
}

#cl-location-dropdown .select2-container{
    width: 80% !important;
}

.select2-container--open .select2-dropdown {
    z-index: 99999;
}

/* Icono de búsqueda */
.cl-search-icon:disabled,
.cl-search-icon {
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    padding: 0px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--primary-color);
    background-color: var(--primary-color);
    color: var(--white-color);
}

.cl-search-icon svg {
    width: 16px;
    height: 16px;
    fill: var(--white-color);
    transition: all 0.2s ease;
    opacity: 0.8;
}

.cl-search-icon:disabled,
.cl-search-icon:hover {
    opacity: 1;
}

#db-info-text:has(#cl-location-dropdown){
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
}

#db-info-text:has(#cl-location-dropdown) .header-button{
    margin: 0px !important;
    min-width: fit-content;
    padding: 5px 10px !important;
}

/* Ajustar el Select2 para que no tome todo el ancho */
.cl-dropdown-wrapper .select2-container {
    flex: 1;
}

/* Fix Select2 dropdown text overflow */
.select2-container--default .select2-results__option {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Ensure Select2 dropdown doesn't exceed container width */
.select2-container {
    max-width: 100% !important;
}

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

.select2-results__options {
    max-height: 300px;
}

/* Style for Select2 selection */
.select2-container--default .select2-selection--single {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 20px; /* Space for the arrow */
}

/* Ensure dropdown positioning doesn't exceed viewport */
.select2-dropdown {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    max-width: none !important;
}

/* Change Select2 option text color to black */
.select2-container--default .select2-results__option {
    color: var(--black-color) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary-color) !important;
    color: var(--white-color) !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--gray-light) !important;
    color: var(--black-color) !important;
}

/* Selected option text color */
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--black-color) !important;
}

/* Placeholder text color */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--gray-medium) !important;
}

/* OSM Attribution Footer Styling */
#cl-osm-attribution {
    text-align: center;
    padding: 15px 0;
    font-size: 12px;
    color: var(--gray-medium);
    border-top: 1px solid var(--gray-border);
    background-color: var(--gray-background);
}

#cl-osm-attribution a {
    color: var(--link-color);
    text-decoration: none;
}

#cl-osm-attribution a:hover {
    text-decoration: underline;
}

/* Custom corporate buttons using primary color */
.btn-corporate {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--white-color) !important;
}

.btn-corporate:hover {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--white-color) !important;
    opacity: 0.9;
}

.modal-body li,
.modal-body p.text-muted{
    margin-top: 10px;
}

@media screen and (max-width: 1100px){
    #db-info-text:has(#cl-location-dropdown){
        flex-direction: column-reverse;
    }
}