/**
 * Feuille de style principale pour SurVeille
 * Style minimaliste et responsive
 */

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f6f9;
    margin: 0;
    padding: 0;
}

.container {
    width: 100%;
}

.container-fluid-custom {
    padding: 0;
}

/* Typographie */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 15px;
    color: #2c3e50;
}

h1 {
    font-size: 2em;
}

h2 {
    font-size: 1.5em;
}

h3 {
    font-size: 1.2em;
}

p {
    margin-bottom: 15px;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Header et Navigation */
/* --- DASHBOARD HEADER --- */
.dashboard-header {
    background: #fff;
    padding: 20px ;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}
.header-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.logo-left {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}
.header-title {
    margin: 0 auto;
    font-size: 2em;
    font-weight: bold;
    text-align: center;
    color: #2c3e50;
}

/* --- MAIN LAYOUT --- */
.dashboard-main {
    display: flex;
    flex-direction: row;
    min-height: 70vh;
    gap: 24px;
}
.dashboard-nav {
    margin: 10px;
    min-width: 300px;
    max-width: 300px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 24px 10px 24px 10px;
    box-shadow: 0 0 8px rgba(0,0,0,0.04);
    height: fit-content;
    position: sticky;
    top: 24px;
    z-index: 10;
}
.dashboard-section {
    margin-top: 20px !important;
}


/* --- FOOTER --- */
.dashboard-footer {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 18px 0 14px 0;
    background: #fff;
    font-size: 1em;
    color: #7f8c8d;
    border-top: 1px solid #eaeaea;
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100vw;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.03);
}

body {
    padding-bottom: 64px; /* pour éviter que le contenu soit masqué par le footer */
}

.dashboard-footer p {
    margin: 0;
    padding: 0 8px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .dashboard-main {
        flex-direction: column;
    }
    .dashboard-nav {
        max-width: 100%;
        min-width: 0;
        margin-bottom: 18px;
        padding: 14px 0;
    }
}
@media (max-width: 600px) {
    .header-title {
        font-size: 1.3em;
    }
    .dashboard-footer {
        flex-direction: column;
        gap: 0;
        font-size: 0.9em;
    }
    .dashboard-footer p {
        padding: 2px 0;
    }
}

header {
    /* Suppression de la marge basse pour coller la nav */
    margin-bottom: 0;
}

header h1 {
    margin-bottom: 20px;
}

nav {
    padding: 0 !important;
}

nav ul {
    list-style: none;
    display: flex;
    background-color: #2c3e50;
    border-radius: 5px;
    overflow: hidden;
    padding: 0 !important;
}

/* --- BOUTON FILTRES CENTRÉ --- */
.btn-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px auto 80px auto;
    padding: 20px !important;
    max-width: 400px;
    width: 100%;
}

/* --- NAVIGATION VERTICALE --- */
.dashboard-nav ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: none;
    border-radius: 0;
    overflow: visible;
    padding: 0;
}
.dashboard-nav .nav-item {
    margin: 0;
}
.dashboard-nav .nav-link {
    display: block;
    width: 100%;
    padding: 12px 16px;
    color: #fff;
    background: #2c3e50;
    border-radius: 5px;
    margin: 0;
    transition: background 0.2s;
}
.dashboard-nav .nav-link.active,
.dashboard-nav .nav-link:hover {
    background: #3498db;
    color: #fff;
    text-decoration: none;
}


/*nav ul li {
    flex: 1;
}*/

nav ul li a {
    display: block;
    padding: 12px 15px;
    color: #fff;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s;
}

nav ul li a:hover,
nav ul li a.active {
    background-color: #3498db;
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    border-color: #3498db;
    outline: none;
}

small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 0.85em;
}

.Btn-gestion{
    margin: 20px 0;
}

.btn {
    display: inline-block;
    padding: 10px 15px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
    text-decoration: none;
}

.btn-secondary {
    background-color: #7f8c8d;
}

.btn-secondary:hover {
    background-color: #6c7a7d;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 5px 10px;
    font-size: 14px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

.form-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* Tableaux */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.data-table .actions {
    white-space: nowrap;
}

.data-table .actions a {
    margin-right: 5px;
}

/* Sections */
.admin-section {
    margin-top: 10px;
    margin-bottom: 30px;
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgb(0 0 0 / 59%);
}

.admin-section h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.action-buttons {
    margin-bottom: 20px;
}

.action-buttons .btn {
    margin-right: 10px;
    margin-bottom: 10px;
}

/* Alertes */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
}

.dashboard-item {
    flex: 1;
    min-width: 300px;
    margin: 0 10px 20px;
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.stat-item {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 15px;
    margin: 5px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.stat-item-result {
    background-color:white;
    border-radius: 50px;
}

.stat-value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: #3498db;
}

.stat-label {
    display: block;
    color: #7f8c8d;
    margin-top: 5px;
}

/* Résultats */
.theme-form-add {
    display: flex;
}

/* Grille des résultats */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin: 25px 0;
}

/* Carte de résultat */
.result-card {
    background: #ffffff;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    min-height: 300px; /* Hauteur minimale pour éviter les cartes trop petites */
    box-shadow: 10px 5px 5px #c9c2c2;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e6e9f0 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.result-category {
    font-size: 0.75em;
    font-weight: 700;
    color: #cb225f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    background: rgba(74, 108, 247, 0.1);
    border-radius: 12px;
}

.result-date {
    font-size: 0.8em;
    color: #6b7280;
    font-weight: 500;
}

.result-title {
    margin: 0;
    padding: 20px 20px 10px;
}

/* Conteneur de l'image du résultat */
.result-image {
    width: 100%;
    height: 200px; /* Hauteur fixe pour toutes les images */
    overflow: hidden;
    background-color: #f5f7fa;
    margin-bottom: 15px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* Style de base pour toutes les images */
.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Couvre toute la zone en conservant le ratio */
    display: block;
    transition: all 0.3s ease;
}

/* Pour les images qui doivent conserver leur ratio complet */
.result-image img[src*='nofound.png'] {
    object-fit: contain;
    width: auto;
    max-width: 80%;
    max-height: 80%;
}

/* État de chargement */
.result-image.loading::before {
    content: '⏳ Chargement...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #3498db;
    font-size: 12px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
}

/* État d'erreur */
.result-image.error::before {
    content: '⚠️ Erreur de chargement';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #e74c3c;
    font-size: 12px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Style pour les images externes */
.result-image img[src^='http'] {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
}

/* Style pour le débogage */
.result-image .debug-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 3;
}


/* Styles pour l'en-tête du résultat */
.result-header {
    padding: 10px 20px;
}

/* Styles pour le titre du résultat */
.result-title h3 {
    font-size: 1em;
}

.result-title a {
    color: #1b6fe5;
    text-decoration: none;
    font-size: 1em;
    line-height: 1.4;
    font-weight: 600;
    display: block;
    transition: color 0.2s ease;
}

.result-title a:hover {
    color: #4a6cf7;
}

.result-content {
    padding: 0 20px 15px;
    flex: 1 0 auto;
    margin-bottom: 15px;
}

.result-content p {
    margin: 0;
    color: #4b5563;
    font-size: 0.85em;
    line-height: 1.4;
    /* Propriété avec préfixe pour WebKit/Blink */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    /* Propriété standard */
    display: -webkit-box;
    line-clamp: 4;
    box-orient: vertical;
    /* Propriétés communes */
    overflow: hidden;
    text-overflow: ellipsis;
    /* Fallback pour les navigateurs non supportés */
    max-height: 6.4em; /* 4 lignes * 1.6 line-height */
}

.result-footer {
    padding: 12px 20px;
    background-color: #f9fafb;
    border-top: 1px solid #f3f4f6;
    font-size: 0.85em;
    margin-top: auto;
    position: relative;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
}

.result-keyword {
    display: inline-block;
    margin: 0 5px 5px 0;
    color: #4b5563;
    background: #f3f4f6;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
}

.result-source {
    display: block;
    color: #6b7280;
    font-style: normal;
    font-size: 0.85em;
    margin-top: 10px;
    font-weight: 500;
}

/* Badge de source */
.result-source:before {
    content: '🔗 ';
    margin-right: 5px;
    opacity: 0.7;
}

/* Effet de surbrillance au survol */
.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #222224, #c7c5d6);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.result-card:hover::before {
    transform: scaleX(1);
}

/* Responsive */
@media (max-width: 992px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.results-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.filter-section {
    background-color: #fff;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.form-date-select, .form-cle-source , .form-theme-cat{
    display: flex ;
}

.filters{
    margin-top: 20px;
}

.filter-form  {
    display: column;
    flex-wrap: wrap;
}

.filter-form .form-group {
    flex: 1;
    min-width: 200px;
    margin-right: 15px;
}

.results-count {
    margin-bottom: 20px;
    color: #7f8c8d;
}

.results-list {
    margin-bottom: 20px;
}

.result-item {
    padding: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
}

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

.result-item h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.result-meta {
    margin-bottom: 10px;
    color: #7f8c8d;
    font-size: 0.9em;
}

.result-meta span {
    margin-right: 15px;
}

/* Grille de résultats */
.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 20px 0;
}

/* Carte de résultat */
.result-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* En-tête de la carte */
.result-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.result-category {
    font-size: 0.5em;
    font-weight: 600;
    color: #3498db;
    text-transform: uppercase;
}

.result-date {
    font-size: 0.75em;
    color: #7f8c8d;
}

/* Contenu de la carte */
.result-content {
    padding: 12px;
    flex-grow: 1;
}

.result-title {
    margin: 0 0 8px 0;
    font-size: 1em;
    line-height: 1.4;
}

.result-title a {
    font-size: 0.8em !important;
    color: #2c3e50;
    text-decoration: none;
}

.result-title a:hover {
    color: #3498db;
    text-decoration: underline;
}

/* Image du résultat */
.result-image {
    width: 100%;
    height: 150px;
    overflow: hidden;
    position: relative;
}

.result-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.result-card:hover .result-image img {
    transform: scale(1.03);
}

/* Pied de carte */
.result-footer {
    padding: 8px 12px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.85em;
}

/* Mots-clés */
.result-keyword {
    display: inline-block;
    background-color: #e8f4fd;
    color: #2c7be5;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 8px;
    margin-right: 4px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Source */
.result-source {
    font-size: 0.75em;
    color: #7f8c8d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Responsive */
@media (max-width: 1200px) {
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

@media (max-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* Pagination */
.pagination {
    margin: 25px 0;
    justify-content: center;
   background-color: rgba(33, 37, 41, 0)
}

.page-link {
    color: #2c3e50;
    border: 1px solid #dee2e6;
    margin: 0 3px;
    border-radius: 4px !important;
    padding: 6px 12px;
    font-size: 0.9em;
}

.page-item.active .page-link {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

.page-link:hover {
    color: #3498db;
    background-color: #f8f9fa;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

/* Message d'information */
.alert-info {
    background-color: #e7f5ff;
    border-color: #a5d8ff;
    color: #1864ab;
    padding: 12px;
    border-radius: 5px;
    margin: 15px 0;
    font-size: 0.9em;
}

/* Amélioration de l'accessibilité */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.result-keywords {
    margin-bottom: 5px;
}

.result-categories {
    margin-bottom: 10px;
}

.result-excerpt {
    color: #555;
}

/* Logs */
.results-log {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-family: monospace;
    white-space: pre-wrap;
    max-height: 500px;
    overflow-y: auto;
}

.results-log p {
    margin-bottom: 5px;
    line-height: 1.4;
}

/* Info box */
.info-box {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.info-box pre {
    background-color: #eee;
    padding: 10px;
    border-radius: 3px;
    overflow-x: auto;
    font-family: monospace;
}



/* Utilitaires */

.container, .container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.dashboard-section {
    flex: 1;
    margin-top: 20px;
}

#filtersModal .modal-body {
    overflow: visible !important;
}
#filtersModal .d-flex {
    flex-wrap: wrap;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    nav {
    padding: 0 !important;
}

nav ul {
    flex-direction: column;
    padding: 0 !important;
}
    
    .dashboard-item {
        min-width: 100%;
    }
    
    .filter-form .form-group {
        min-width: 100%;
        margin-right: 0;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
    }
}
