body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    min-width: 400px; /* Ensure minimum width for the application */
}

header {
    background-color: #333;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
}

main {
    padding: 1rem;
    margin: 1rem auto;
    /* Let Bootstrap handle container width */
}

/* Keep section styling for now, might replace with panels */
section {
    background-color: #fff;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px; /* Bootstrap 3 uses less rounded corners by default */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* h1, h2 styling will be handled by Bootstrap */
/* h1, h2 {
    color: #333;
} */

/* Footer styling can be kept or adjusted */
footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem 0;
    color: #666;
}

/* Remove custom layout styles, Bootstrap grid will handle it */
/*
#main-layout { ... }
#col-saved-searches { ... }
#col-search-form { ... }
#col-search-results { ... }
#col-saved-searches section, ... { ... }
@media (max-width: 1200px) { ... }
*/

/* Map Loader Styles */
.map-container {
    position: relative; /* Needed for absolute positioning of the loader */
}

.map-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8); /* Semi-transparent white background */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it's above map tiles */
    text-align: center;
    color: #333;
    font-size: 1.1em;
}

.map-loader .spinner {
    margin-bottom: 10px; /* Add space between spinner and text */
}

/* Style for read table rows */
#results-table tbody tr.read { /* Changed class name */
    /* background-color: #e9e9e9 !important; */ /* Removed to allow striping */
    font-weight: normal; /* Ensure read items are not bold */
    opacity: 0.7; /* Make read items slightly faded */
}

/* Style for unread table rows */
#results-table tbody tr:not(.read) {
    font-weight: bold; /* Make unread items bold */
}

/* Style for rows with notes in the results table */
#results-table tbody tr.has-note {
    background-color: #ffffcc !important; /* Light yellow background, !important to override striping */
}

/* Style for collapsible panel header icon */
#saved-searches .panel-heading a.collapsed .glyphicon-chevron-down::before {
    content: "\e114"; /* Unicode for glyphicon-chevron-up */
}

/* --- Side Panel Styles (common) --- */
.side-panel {
    position: fixed;
    top: 0; /* Align to top */
    right: -550px; /* Start off-screen by default (max width + 50px) */
    height: 100vh; /* Full viewport height */
    background-color: #f8f9fa; /* Light background */
    border-left: 1px solid #dee2e6; /* Border */
    box-shadow: -2px 0 5px rgba(0,0,0,0.1); /* Shadow on the left */
    z-index: 1040; /* Above most content, below modals if any were kept */
    transition: right 0.15s ease-in-out; /* Faster transition (0.15s) */
    display: flex; /* Use flexbox for layout */
    flex-direction: column; /* Stack header, body, footer vertically */
    padding-top: 50px; /* Add padding to account for fixed navbar */
}

/* Notes panel (same width as agency) */
#note-side-panel {
    width: 500px; /* Same width as agency panel */
    right: -550px; /* Start off-screen (width + 50px) */
    height: 100vh; /* Full viewport height */
}

/* Agency panel (wider) */
#agency-side-panel {
    width: 500px; /* Wider panel for agency */
    right: -550px; /* Start off-screen (width + 50px) */
    height: 100vh; /* Full viewport height */
}

/* Common open state */
.side-panel.open {
    right: 0 !important; /* Slide in when open - use !important to override any inline styles */
}

/* Common styling for panel headers */
.side-panel .panel-header {
    padding: 10px 15px;
    background-color: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.side-panel .panel-header h4 {
    margin: 0;
    font-size: 1.2em;
}

.side-panel .close-panel-button {
    background: none;
    border: none;
    font-size: 1.5em;
    line-height: 1;
    opacity: 0.5;
    padding: 0; /* Reset padding */
    cursor: pointer;
}

.side-panel .close-panel-button:hover {
    opacity: 0.8;
}

/* Common styling for panel bodies */
.side-panel .panel-body {
    padding: 15px;
    overflow-y: auto; /* Allow scrolling if content exceeds height */
    flex-grow: 1; /* Allow body to take up remaining space */
}

/* Common styling for panel footers */
.side-panel .panel-footer {
    padding: 10px 15px;
    background-color: #e9ecef;
    border-top: 1px solid #dee2e6;
    text-align: right; /* Ensure right alignment for non-floated buttons */
    overflow: hidden; /* Add clearfix for floated elements */
}

/* Ensure stars are clickable */
#note-side-panel .star {
    cursor: pointer;
}

/* Agency specific styles */
#agency-side-panel h5 {
    font-weight: bold;
    margin-top: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#agency-side-panel h5 button {
    margin-left: 10px;
}

#agency-contacts-table {
    margin-top: 10px;
}


/* --- Row Highlighting for Editing --- */
#results-table tbody tr.note-editing {
    background-color: #d9edf7 !important; /* Light blue highlight, !important to override striping */
    /* Add other styles as needed, e.g., border */
    /* border-left: 3px solid #31708f; */
}

#notes-table tbody tr.note-editing {
    background-color: #d9edf7 !important; /* Same light blue highlight */
}

/* Classe pour masquer les colonnes de tableau */
.hidden-column {
    display: none;
}

/* Styles pour les colonnes triables et indicateurs de tri */
th.sortable {
    cursor: pointer;
    position: relative;
    user-select: none;
}

th.sortable:hover {
    background-color: #f0f0f0;
}

th.sort-asc, th.sort-desc {
    background-color: #e0f0ff;
}

.sort-icon {
    margin-left: 4px;
    color: #337ab7;
}

/* Tooltip d'aide pour le tri multi-colonnes */
.sort-help-tooltip {
    position: relative;
    display: inline-block;
    font-size: 0.8em;
    color: #337ab7;
    cursor: help;
    margin-left: 5px;
}

.sort-help-tooltip .tooltip-text {
    visibility: hidden;
    width: 320px;
    background-color: #555;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -160px;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: normal;
}

.sort-help-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Directory Styles */
#directory-section {
    margin-bottom: 20px;
}

#directory-section .table-hover tbody tr {
    cursor: pointer; /* Show pointer cursor on rows */
}

#contact-modal .modal-content {
    border-radius: 0;
}

/* Set pointer for clickable table rows */
#results-table tbody tr,
#notes-table tbody tr,
#directory-table tbody tr {
    cursor: pointer;
}

/* Style for inactive saved searches */
.inactive-search-item {
    background-color: #f8f8f8; /* Light grey background */
    /* Optionally add other styles, e.g., slightly faded text */
    /* opacity: 0.8; */
}

/* Style pour le bouton "Tout marquer comme lu" */
#mark-all-read-button {
    margin-bottom: 5px !important; /* Marge de 5px sous le bouton */
}

/* --- Styles pour le système d'onglets --- */

/* Conteneur des onglets */
#search-tabs-container {
    border-bottom: 1px solid #ddd;
    background-color: #f8f9fa;
    border-radius: 4px 4px 0 0;
}

/* Liste des onglets */
#search-tabs-list {
    margin-bottom: 0;
    border-bottom: none;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 5px 5px 0 5px;
}

/* Éléments d'onglet */
#search-tabs-list li {
    position: relative;
    display: flex;
    margin-bottom: -1px;
    max-width: 200px;
    flex-shrink: 0;
}

/* Liens d'onglet */
#search-tabs-list li a {
    position: relative;
    display: flex;
    align-items: center;
    padding: 6px 8px;
    margin-right: 2px;
    line-height: 1.42857143;
    border: 1px solid transparent;
    border-radius: 4px 4px 0 0;
    text-decoration: none;
    color: #555;
    background-color: #fff;
    border-color: #ddd #ddd transparent;
    font-size: 12px;
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: all 0.15s ease-in-out;
}

/* Onglet actif */
#search-tabs-list li.active a {
    color: #555;
    cursor: default;
    background-color: #fff;
    border: 1px solid #ddd;
    border-bottom-color: transparent;
    font-weight: bold;
}

/* Hover sur les onglets */
#search-tabs-list li:not(.active) a:hover {
    border-color: #eee #eee transparent;
    background-color: #f5f5f5;
}

/* Indicateur de couleur dans les onglets */
.tab-color-indicator {
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Bouton de fermeture des onglets */
.close-tab-btn {
    margin-left: 6px !important;
    padding: 0 !important;
    width: 14px !important;
    height: 14px !important;
    line-height: 12px !important;
    text-align: center !important;
    font-size: 12px !important;
    font-weight: bold !important;
    color: #999 !important;
    background: none !important;
    border: none !important;
    border-radius: 2px !important;
    cursor: pointer !important;
    transition: all 0.15s ease-in-out !important;
    flex-shrink: 0 !important;
}

.close-tab-btn:hover {
    color: #333 !important;
    background-color: #e0e0e0 !important;
}

.close-tab-btn:active {
    background-color: #d0d0d0 !important;
}

/* Responsive pour les onglets */
@media (max-width: 768px) {
    #search-tabs-list li {
        max-width: 120px;
    }
    
    #search-tabs-list li a {
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .close-tab-btn {
        width: 12px !important;
        height: 12px !important;
        font-size: 10px !important;
        margin-left: 4px !important;
    }
}

/* Animations pour l'ajout/suppression d'onglets */
@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#search-tabs-list li {
    animation: fadeInTab 0.2s ease-out;
}

/* Style pour éviter la déformation du layout */
#search-tabs-container .nav-tabs {
    border-bottom: none;
}

/* Assurer que le conteneur des onglets ne déborde pas */
#search-tabs-container {
    overflow-x: auto;
    overflow-y: hidden;
}

#search-tabs-list {
    min-width: max-content;
}

/* Scrollbar personnalisée pour le conteneur des onglets si nécessaire */
#search-tabs-container::-webkit-scrollbar {
    height: 4px;
}

#search-tabs-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

#search-tabs-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

#search-tabs-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Les styles pour .range-slider-container et ses enfants ont été supprimés 
   car nous utilisons maintenant noUiSlider qui a son propre CSS via CDN. */
/* Un style de base pour les conteneurs de noUiSlider peut être conservé ou ajouté si nécessaire. */
.nouislider-container { /* Wrapper div pour chaque slider noUiSlider */
    margin-bottom: 10px; /* Réduire la marge pour un look plus compact */
    padding: 5px 0; /* Ajouter un peu de padding vertical si les sliders sont directement dans les cellules */
}

/* Styles pour rendre noUiSlider plus petit */
.noUi-target {
    height: 8px; /* Réduire encore la hauteur de la piste principale */
}

.noUi-handle {
    width: 16px !important; /* Réduire encore la largeur du handle */
    height: 16px !important; /* Réduire encore la hauteur du handle */
    right: -8px !important; /* Ajuster la position du handle (moitié de la largeur) */
    top: -5px !important; /* Ajuster la position verticale du handle (height/2 - target_height/2)ish */
    border-radius: 50%; /* Rendre les poignées rondes */
}
.noUi-handle::before,
.noUi-handle::after {
    /* Ajuster ou cacher les barres sur les poignées si elles semblent trop grandes */
    width: 1px; 
    height: 6px; 
    left: 6px; /* (handle_width/2 - bar_width/2) - 1px approx */
    top: 4px;  /* (handle_height/2 - bar_height/2) */
}

.noUi-connect {
    background: #007bff; /* Couleur de la connexion Bootstrap primary */
}

/* Style pour le titre de la colonne au-dessus du slider */
#results-table-head th .column-slider-title {
    font-weight: bold; /* Bootstrap le fait déjà pour les th, mais pour être sûr */
    display: block;
    text-align: center;
    margin-bottom: 3px; /* Espace avant l'affichage des valeurs */
    font-size: 1em; /* Taille normale pour un titre de header */
    line-height: 1.1;
}

/* Styles pour les sliders noUiSlider dans les en-têtes de tableau */
#results-table-head th .nouislider-target-div {
    margin-top: 3px; /* Espace entre la valeur et le slider, réduit */
    margin-bottom: 2px; /* Un peu d'espace en bas */
}

#results-table-head th .slider-value-display {
    font-size: 0.85em; /* Plus petit pour l'en-tête */
    font-weight: normal; /* Le texte de l'en-tête est déjà en gras */
    color: #333;
    margin-bottom: 2px; /* Espace avant le slider */
    line-height: 1.2;
    display: block; /* Assurer que c'est un block pour le centrage et la marge */
    text-align: center; /* Centrer le texte des valeurs */
}

/* Ajuster les en-têtes de tableau qui contiennent des sliders */
#results-table-head th[data-column-name="weight"],
#results-table-head th[data-column-name="length"] {
    vertical-align: top; /* Aligner le contenu en haut pour le texte et le slider */
    padding-top: 4px !important; /* Ajuster le padding pour faire de la place, !important si Bootstrap interfère */
    padding-bottom: 4px !important;
    /* text-align: left; /* Ou center, selon le look désiré pour le texte du label et le slider */
}

/* Aligner verticalement les éléments de la barre de navigation */
.navbar .container-fluid {
    display: flex;
    align-items: center;
}

/* Annuler le flottant par défaut de Bootstrap pour le header */
.navbar-header {
    float: none;
}

/* Grouper les éléments de droite et les pousser vers la droite */
.navbar-right-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto; /* Pousse ce groupe vers la droite */
}

#language-selector {
    height: auto;
    padding: 2px 5px;
    font-size: 14px;
    line-height: 20px;
    border: 1px solid #555;
    background-color: #555;
    color: #fff;
    border-radius: 4px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 5px top 50%;
    background-size: .65em auto;
    padding-right: 20px;
}
