body { 
    overflow-x: hidden; 
    height: 100%;
}
body .container-fluid { padding-left: 0 !important; padding-right: 0 !important; }

.app-layout {
    min-height: 100vh !important;
    height: 100vh !important;
    display: flex;
    flex-direction: column;
}

.custom-banner {
    width: 100%;
    max-width: 100vw;
    height: 60px !important;
    min-height: 60px !important;
    max-height: 60px !important;
    flex-shrink: 0;
    background-image: url('https://github.com/marineteneur/images/blob/main/bandeau_Faucon_crecerelle_-_Bruno_Berthemy.jpg?raw=true');
    background-size: cover;
    background-position: center 25%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
    overflow: hidden;
    gap: 16px;
}
.sidebar-toggle-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    border-radius: 8px !important;
    color: white !important;
    font-size: 1.35rem !important;
    cursor: pointer;
    transition: background 0.2s ease;
}
.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    color: white !important;
}
.custom-banner h1 {
    color: white;
    font-size: 1.5rem;
    font-weight: 900;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.custom-banner img {
    flex-shrink: 0;
    height: 50px;
    width: auto;
    max-height: 50px;
    object-fit: contain;
}

.main-content {
    margin-left: 0;
    margin-right: 0;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.main-content > * {
    flex: 1;
    min-height: 0;
}

/* Deux colonnes : sidebar (250px) + page_content (reste) */
.app-columns {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.app-columns .sidebar {
    width: 250px;
    min-width: 250px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
    color: #ecf0f1;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease, min-width 0.25s ease;
}
.app-columns .sidebar.sidebar-collapsed {
    width: 72px;
    min-width: 72px;
}
.app-columns .sidebar .sidebar-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.app-columns .sidebar .sidebar-logos .sidebar-logo-img {
    max-width: 100%;
    height: auto;
    max-height: 48px;
    object-fit: contain;
}
.app-columns .sidebar.sidebar-collapsed .sidebar-logos .sidebar-logo-img {
    max-height: 40px;
}
.app-columns .sidebar .nav-sidebar-icon {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    display: inline-block;
    flex-shrink: 0;
}
.app-columns .sidebar.sidebar-collapsed .nav-sidebar-label {
    display: none;
}
.app-columns .sidebar.sidebar-collapsed .nav-sidebar-icon {
    margin-right: 0;
}
.app-columns .sidebar.sidebar-collapsed .nav-sidebar-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 12px 10px !important;
}
.app-columns .sidebar.sidebar-collapsed .nav-sidebar-btn .nav-sidebar-icon {
    margin: 0;
}
.app-columns .sidebar.sidebar-collapsed .sidebar-refresh-wrap,
.app-columns .sidebar.sidebar-collapsed .sidebar-logout-wrap {
    display: flex;
    justify-content: center;
}
.app-columns .sidebar .nav-sidebar-btn {
    color: #ecf0f1 !important;
    background: transparent !important;
    border: none !important;
    border-left: 3px solid transparent !important;
    border-radius: 0 !important;
    text-align: left !important;
    padding: 10px 14px !important;
    margin: 0 !important;
}
.app-columns .sidebar .nav-sidebar-btn:hover {
    background: rgba(255,255,255,0.1) !important;
    border-left-color: #3498db !important;
}
.app-columns .sidebar .btn-refresh-sidebar {
    color: #ecf0f1 !important;
    background: rgba(46, 204, 113, 0.2) !important;
    border: 1px solid #2ecc71 !important;
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
}
.app-columns .sidebar .btn-refresh-sidebar:hover {
    background: rgba(46, 204, 113, 0.35) !important;
    color: #fff !important;
}
.app-columns .sidebar .sidebar-refresh-wrap {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}
.app-columns .sidebar .sidebar-refresh-wrap .btn-refresh-sidebar {
    margin-top: 0;
}
.app-columns .page_content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 1.5rem 1.5rem 1.5rem 1.5rem;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
}
.app-columns .page_content .tab-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.app-columns .page_content .tab-content .tab-pane.active {
    flex: 1;
    min-height: 0;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}

.accueil-layout {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.accueil-layout .card-accueil-stats {
    flex: 0 0 auto;
}
.accueil-layout .card-passages-maille {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    margin-bottom: 0 !important;
}
.accueil-layout .card-passages-maille .card-body {
    min-height: 0 !important;
}
.accueil-layout .card-passages-maille .card-body .passages-par-carre-wrapper {
    min-height: 0 !important;
}

.card-detail-carte {
    margin-bottom: 1.5rem !important;
}

/* Cartes dans le contenu principal qui ressortent avec une ombre */
.app-columns .page_content .card {
    background-color: #ffffff;
    border: 1px solid #d1dce6;
    box-shadow: 0 4px 12px rgba(44, 62, 80, 0.15);
    border-radius: 8px;
    margin-bottom: 0rem;
    transition: box-shadow 0.3s ease;
}

.app-columns .page_content .card:hover {
    box-shadow: 0 6px 16px rgba(44, 62, 80, 0.2);
}

.app-columns .page_content .card-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-bottom: none;
    color: #ffffff;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: 8px 8px 0 0;
}

/* Card des statistiques générales rétractable */
.card-accueil-stats .card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-accueil-stats.collapsed .card-body {
    display: none;
}

/* Card des carrés en pleine hauteur */
.card-carres-fullheight {
    height: calc(100vh - 60px - 3rem) !important;
    display: flex !important;
    flex-direction: column !important;
    margin-bottom: 0 !important;
}

.card-carres-fullheight .card-body {
    flex: 1;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0;
    padding: 1.25rem !important;
    gap: 0.5rem;
}

.card-carres-fullheight .card-body > input[type="text"] {
    flex-shrink: 0;
    margin-bottom: 0.5rem;
}

.card-carres-fullheight .table-carres-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}

/* Laisser le tableau prendre sa hauteur naturelle pour que la scrollbar du conteneur s'affiche */
.card-carres-fullheight .table-carres-container > * {
    min-height: min-content;
}

/* Grille des statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1rem;
    padding: 0rem 0;
}

/* Cartes de statistiques */
.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 110px;
}

/* Icônes des statistiques */
.stat-card .stat-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

/* Labels des statistiques */
.stat-card .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.3rem;
}

.stat-card .stat-label strong {
    font-weight: 600;
}

/* Valeurs des statistiques */
.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

/* Cartes spécifiques avec couleurs */
.stat-card-total {
    border-left: 4px solid #3498db;
}

.stat-card-total .stat-icon {
    color: #3498db;
}

.stat-card-total .stat-value {
    color: #3498db;
}

.stat-card-points {
    border-left: 4px solid #2ecc71;
}

.stat-card-points .stat-icon {
    color: #2ecc71;
}

.stat-card-points .stat-value {
    color: #2ecc71;
}

/* Passages avec couleurs spécifiques correspondant à la carte */
.stat-card-passage-1 {
    border-left: 4px solid #2563eb;
}

.stat-card-passage-1 .stat-icon,
.stat-card-passage-1 .stat-value {
    color: #2563eb;
}

.stat-card-passage-2 {
    border-left: 4px solid #4f46e5;
}

.stat-card-passage-2 .stat-icon,
.stat-card-passage-2 .stat-value {
    color: #4f46e5;
}

.stat-card-passage-3 {
    border-left: 4px solid #6d28d9;
}

.stat-card-passage-3 .stat-icon,
.stat-card-passage-3 .stat-value {
    color: #6d28d9;
}

.stat-card-passage-4 {
    border-left: 4px solid #a21caf;
}

.stat-card-passage-4 .stat-icon,
.stat-card-passage-4 .stat-value {
    color: #a21caf;
}

.stat-card-passage-5 {
    border-left: 4px solid #c026d3;
}

.stat-card-passage-5 .stat-icon,
.stat-card-passage-5 .stat-value {
    color: #c026d3;
}

.stat-card-passage-6 {
    border-left: 4px solid #f472b6;
}

.stat-card-passage-6 .stat-icon,
.stat-card-passage-6 .stat-value {
    color: #f472b6;
}

/* Responsive pour les petits écrans */
@media (max-width: 1400px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.especes-deux-colonnes .shiny-options-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 12px;
    align-items: start;
}

.filter-panel-territories {
    background-color: #f8f9fa;
    border-radius: 5px;
    padding: 0;
    margin-bottom: 20px;
}
.filter-panel-territories .accordion-body { padding: 0 20px 20px 20px; }

.nav.nav-tabs.shiny-tab-input,
ul.nav-tabs.shiny-tab-input,
#main_tabs .nav.nav-tabs,
#main_tabs [role="tablist"] {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    visibility: hidden !important;
    border: none !important;
}

/* ============================================
   Tableau "Date de saisie des territoires et nombre de données FF par passage et par maille"
   ============================================ */

/* Card des passages par maille */
.app-columns .page_content .card-passages-maille,
.card-passages-maille {
    min-height: 500px !important;
    display: flex !important;
    flex-direction: column !important;
}
.app-columns .page_content .card-passages-maille .card-body,
.card-passages-maille .card-body {
    padding: 1.25rem !important;
    padding-bottom: 1.25rem !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 450px !important;
    gap: 0.75rem;
}
.app-columns .page_content .card-passages-maille .card-body > *:not(.passages-par-carre-wrapper),
.card-passages-maille .card-body > *:not(.passages-par-carre-wrapper) {
    flex-shrink: 0;
}

/* Conteneur du tableau : scroll propre */
.card-passages-maille .card-body .passages-par-carre-wrapper,
.passages-par-carre-wrapper {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    min-height: 390px !important;
    border: 1px solid #d1dce6;
    border-radius: 8px;
    background: #fafbfc;
    box-shadow: inset 0 1px 2px rgba(44, 62, 80, 0.06);
}

/* Tableau : base — bordures uniformes partout */
.passages-par-carre-table {
    font-size: 0.9rem;
    margin-bottom: 0;
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
}
.passages-par-carre-table th,
.passages-par-carre-table td {
    border: 1px solid #d1dce6;
    padding: 0.65rem 0.6rem;
    vertical-align: middle;
}
.passages-par-carre-table th:first-child,
.passages-par-carre-table td:first-child {
    border-left: 1px solid #d1dce6;
    text-align: center;
    font-weight: 600;
    padding-left: 0.9rem;
    background: #fff;
}

/* Points d'observation : code couleur */
.passages-par-carre-table td.points-obs-zero {
    font-weight: 500;
    background-color: #fdedec !important;
    color: #922b21;
}
.passages-par-carre-table td.points-obs-positif {
    font-weight: 600;
    background-color: #eafaf1 !important;
    color: #186a3b;
}

/* En-tête du tableau : bordures identiques au reste */
.passages-par-carre-table thead th {
    background: linear-gradient(180deg, #3d5266 0%, #2c3e50 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: none;
    letter-spacing: 0.02em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    text-align: center;
    padding: 0.7rem 0.55rem;
    border: 1px solid #d1dce6;
}
.passages-par-carre-table thead th:first-child {
    background: linear-gradient(180deg, #3d5266 0%, #2c3e50 100%);
    text-align: center;
    padding-left: 0.9rem;
    border-left: 1px solid #d1dce6;
}
.passages-par-carre-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, color 0.2s;
}
.passages-par-carre-table thead th.sortable:hover {
    background: linear-gradient(180deg, #4a6178 0%, #34495e 100%);
    color: #ecf0f1;
}
.passages-par-carre-table thead th.sortable .sort-indicator {
    font-size: 0.75em;
    margin-left: 3px;
    opacity: 0.9;
}

/* Lignes du corps : alternance et survol */
.passages-par-carre-table tbody tr {
    transition: background-color 0.12s ease;
}
.passages-par-carre-table tbody tr:nth-child(even) {
    background-color: #f8f9fb;
}
.passages-par-carre-table tbody tr:nth-child(odd) {
    background-color: #fff;
}
.passages-par-carre-table tbody tr:hover {
    background-color: #e8eef4 !important;
}
.passages-par-carre-table tbody tr:hover td:first-child {
    background-color: #e8eef4 !important;
}
.passages-par-carre-table tbody td {
    text-align: center;
    color: #34495e;
}
.passages-par-carre-table tbody td:first-child {
    text-align: center;
    font-weight: 600;
    color: #2c3e50;
}

/* Colonne "Passage" (date + suivi sur 2 lignes) */
.passages-par-carre-table td.col-passage {
    white-space: nowrap;
    line-height: 1.4;
    font-size: 0.85rem;
}
.passages-par-carre-table .suivi-present {
    background-color: #e8f4fc !important;
    color: #1a5276;
    font-weight: 500;
}
.passages-par-carre-table .suivi-vide {
    background-color: #fef9e7 !important;
    color: #7d6608;
    font-weight: 500;
}
.passages-par-carre-table .suivi-absent {
    color: #7f8c8d;
    font-weight: 400;
}

/* Lignes cliquables : redirection vers Détail de la maille */
.passages-par-carre-table tbody tr.row-clickable-maille {
    cursor: pointer;
}
.passages-par-carre-table tbody tr.row-clickable-maille:hover {
    background-color: #d6e3f0 !important;
}
.passages-par-carre-table tbody tr.row-clickable-maille:hover td:first-child {
    background-color: #d6e3f0 !important;
}

/* Colonnes P* FF (données Faune France) */
.passages-par-carre-table .nb-ff-zero {
    background-color: #fdedec !important;
    color: #922b21;
    font-weight: 600;
    font-size: 0.85rem;
}
.passages-par-carre-table .nb-ff-positif {
    background-color: #eafaf1 !important;
    color: #186a3b;
    font-weight: 600;
    font-size: 0.85rem;
}
.passages-par-carre-table .ecart-faible {
    background-color: #fdedec !important;
    color: #922b21;
    font-weight: 600;
}

/* Toutes les cellules gardent la même bordure 1px solid #d1dce6 (définie plus haut) */

/* ============================================
   Styles pour la page de connexion
   ============================================ */

.login-background {
  background-image: url('/www/img/Faucon_pelerin_-_Patrick_Harle.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  min-height: 100vh;
}

.centered {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  flex-direction: column;
  padding: 30px 0;
}

.bubble-title {
    background-color: #ffffff;
    color: black;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 26px;
    line-height: 30px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    width: 60%;
    text-align: center;
  }
  
.bubble-title strong {
    display: inline;
    font-size: 26px;
    font-weight: bold;
    color: black;
  }

.login-container {
  width: 300px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  margin-top: 50px;
}

.login-container h2 {
    margin-bottom: 20px;
    color: black;
    font-weight: 600;
    font-size: 1.5rem;
    text-align: center;
}

.login-container input[type="text"],
.login-container input[type="password"] {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  background: white;
  box-sizing: border-box;
}

.login-container input[type="text"]:focus,
.login-container input[type="password"]:focus {
  outline: none;
  border-color: #999;
}

.login-container button {
  width: 100%;
  padding: 10px;
  background: white;
  color: black;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: normal;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 10px;
}

.login-container button:hover {
  background-color: #f5f5f5;
}

.login-container button:active {
  background-color: #e0e0e0;
}

#message {
  margin-top: 15px;
  color: #d32f2f;
  font-weight: 500;
  min-height: 25px;
}

.photo-credit {
  position: fixed !important;
  bottom: 15px !important;
  right: 15px !important;
  color: white !important;
  font-size: 0.85rem !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7) !important;
  z-index: 9999 !important;
  background: rgba(0, 0, 0, 0.6) !important;
  padding: 6px 12px !important;
  border-radius: 5px !important;
  font-weight: 500 !important;
}

