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

body {
    font-family: Arial, sans-serif;
    margin: 30px;
    text-align: center;
    background-color: #f5f5f5;
}

img {
    height: 170px;
    width: 400px;
    margin-top: 30px;
    margin-bottom: 20px;
}

h1 {
    margin-top: 15px;
    color: #333;
    margin-bottom: 10px;
}

p {
    color: #666;
    margin-bottom: 20px;
}

/* Filtres de genre */
.genre-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.genre-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.genre-checkbox:hover {
    background: #e3f2fd;
    border-color: #2196f3;
}

.genre-checkbox input[type="radio"] {
    margin-right: 8px;
    accent-color: #2196f3;
}

.genre-checkbox span {
    font-weight: 500;
    color: #495057;
}

/* Conteneur de recherche */
.search-container {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
}

form input[type="text"] {
    padding: 12px 20px;
    font-size: 16px;
    height: 50px;
    width: 400px;
    border-radius: 25px;
    border: 2px solid #ddd;
    outline: none;
    transition: border-color 0.3s ease;
}

form input[type="text"]:focus {
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

form button[type="submit"] {
    width: 120px;
    padding: 12px;
    font-size: 16px;
    margin-left: 10px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background 0.3s ease;
}

form button[type="submit"]:hover {
    background: #1976d2;
}

/* Autocomplete */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.autocomplete-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    text-align: left;
    transition: background 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f0f8ff;
    color: #2196f3;
}

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

/* Tableau de résultats */
table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 30px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

th, td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #2196f3;
    color: white;
    font-weight: bold;
}

tr:nth-child(even) {
    background-color: #f8f9fa;
}

tr:hover {
    background-color: #e3f2fd;
}

.highlight {
    color: #e91e63;
    font-weight: bold;
    background-color: #fff5f7;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Lien de retour */
a {
    display: inline-block;
    margin: 20px 0;
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s ease;
}

a:hover {
    background: #5a6268;
}

/* Indicateur de genre dans les résultats */
.genre-indicator {
    background: #4CAF50;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 14px;
    margin-left: 15px;
    font-weight: normal;
}

/* Clavier virtuel */
.vk-wrapper {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.vk {
    display: none;
    gap: 8px;
    flex-wrap: wrap;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 12px;
    background: #9b9b9b;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-width: 700px;
    justify-content: center;
}

.vk-row {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.vk-tools {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    justify-content: center;
    width: 100%;
}

.vk-key {
    min-width: 45px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 16px;
    line-height: 1.2;
    background: white;
    transition: all 0.2s ease;
}

.vk-key:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    transform: translateY(-1px);
}

.vk-key:active {
    transform: scale(0.95);
}

.vk-toggle {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.vk-toggle:hover {
    background: #5a6268;
}

.vk-toggle[aria-pressed="true"] {
    background: #2196f3;
    border-color: #1976d2;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        margin: 15px;
    }

    .genre-filters {
        flex-direction: column;
        align-items: center;
    }

    form input[type="text"] {
        width: 100%;
        max-width: 300px;
    }

    .search-container {
        width: 100%;
    }

    .autocomplete-results {
        width: 90%;
        left: 5%;
        transform: none;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px;
    }
}


/* Styles pour les statistiques */
.stats-container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 10px;
    text-align: center;
}

.stat-card.total {
    background: #2196f3;
    color: white;
    margin-bottom: 30px;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin: 10px 0;
    color: #2196f3;
}

.stat-card.total .stat-number {
    color: white;
}

.stat-folder {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}


/* Styles pour les statistiques de mots */
.word-stats {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 30px 0;
    text-align: center;
}

.word-stats h3 {
    color: #2196f3;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    display: block;
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 8px;
}

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

.export-section {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 30px 0;
    text-align: center;
}

.export-section h3 {
    color: #28a745;
    margin-bottom: 15px;
}

.export-btn {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.export-btn:hover {
    background: #218838;
}


/* Badges de genre */
.genre-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

/* Messages sans résultats */
.no-results {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 30px;
    margin: 30px 0;
    text-align: center;
}

.results-info {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    padding: 10px;
    margin: 15px 0;
    text-align: center;
}



/* Styles pour les pages À propos */
.about-nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.about-nav a {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s ease;
}

.about-nav a:hover {
    background: #5a6268;
}

.about-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
}

.about-section {
    background: white;
    padding: 25px;
    margin: 20px 0;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.about-section h2 {
    color: #2196f3;
    margin-bottom: 15px;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 10px;
}

.about-section ul, .about-section ol {
    margin: 15px 0;
    padding-left: 20px;
}

.about-section li {
    margin: 8px 0;
    line-height: 1.6;
}

.about-section strong {
    color: #1976d2;
}

/* Profile section */
.profile-section {
    text-align: center;
    margin-bottom: 30px;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.profile-avatar {
    font-size: 4em;
    width: 100px;
    height: 100px;
    background: #e3f2fd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-info h2 {
    color: #333;
    margin: 0;
    font-size: 2em;
}

.profile-title {
    color: #666;
    font-style: italic;
    margin: 5px 0 0 0;
}

/* Contact info */
.contact-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.contact-info p {
    margin: 8px 0;
    color: #495057;
}

/* Stats link */
.stats-link {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 10px;
    transition: background 0.3s ease;
}

.stats-link:hover {
    background: #218838;
}

/* Responsive design */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .about-nav {
        flex-direction: column;
        align-items: center;
    }

    .about-nav a {
        width: 200px;
        text-align: center;
    }

    .about-container {
        padding: 10px;
    }

    .about-section {
        padding: 15px;
    }
}

/* Navigation principale */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.nav-link {
    background: #6c757d;
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s ease;
    font-size: 14px;
}

.nav-link:hover {
    background: #5a6268;
}



/* Styles pour l'export */
.export-container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 20px;
}

.export-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin: 30px 0;
}

.export-option {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.export-option h3 {
    color: #2196f3;
    margin-bottom: 15px;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 10px;
}

.export-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.export-btn {
    display: block;
    background: #28a745;
    color: white;
    padding: 12px 15px;
    text-decoration: none;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 500;
}

.export-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.freq-btn {
    background: #17a2b8;
}

.freq-btn:hover {
    background: #138496;
}

.export-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.export-info h3 {
    color: #856404;
    margin-bottom: 15px;
}

.export-info ul {
    margin: 10px 0;
    padding-left: 20px;
}

.export-info li {
    margin: 8px 0;
    color: #856404;
}

/* Stats preview */
.stats-preview {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stat-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    display: block;
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    color: #2196f3;
}

.genre-stats {
    margin-top: 20px;
}

.genre-stats h4 {
    color: #495057;
    margin-bottom: 10px;
}

.genre-stats ul {
    list-style: none;
    padding: 0;
}

.genre-stats li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.genre-stats li:last-child {
    border-bottom: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .export-options {
        grid-template-columns: 1fr;
    }

    .export-buttons {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

.export-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 30px auto;
    max-width: 600px;
    text-align: center;
}


/* Styles pour la page À propos */
.example-box {
    background: #f8f9fa;
    border-left: 4px solid #17a2b8;
    padding: 15px;
    margin: 15px 0;
    border-radius: 5px;
}

.example-box p {
    margin: 8px 0;
    color: #495057;
}

/* Styles pour la page Statistiques */
.stat-subtitle {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
}

.stat-desc {
    font-size: 0.8em;
    color: #6c757d;
    margin-top: 5px;
}

.genre-comparison {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 30px 0;
}

.comparison-grid {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.comparison-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.comparison-label {
    min-width: 150px;
    font-weight: 500;
    color: #495057;
}

.comparison-bar {
    flex: 1;
    background: #e9ecef;
    height: 25px;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    background: linear-gradient(90deg, #2196f3, #1976d2);
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
}

.bar-text {
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.comparison-value {
    min-width: 80px;
    text-align: right;
    font-weight: 500;
    color: #495057;
}

.last-update {
    text-align: center;
    color: #6c757d;
    font-size: 0.9em;
    margin-top: 20px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.export-note {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 10px;
}

/* Responsive design */
@media (max-width: 768px) {
    .comparison-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .comparison-label {
        min-width: auto;
    }

    .comparison-bar {
        width: 100%;
    }

    .comparison-value {
        text-align: left;
        min-width: auto;
    }

    .stat-cards {
        grid-template-columns: 1fr;
    }
}


/* ===== STYLES D'IMPRESSION ===== */

/* Boutons d'impression */
.print-btn {
    background: #6c757d !important;
    color: white !important;
    border: none !important;
    padding: 10px 15px !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    margin-left: 10px !important;
    text-decoration: none !important;
    display: inline-block !important;
}

.print-btn:hover {
    background: #5a6268 !important;
    transform: translateY(-1px) !important;
}

/* Navigation principale */
.main-nav {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    margin: 20px 0 !important;
    flex-wrap: wrap !important;
}

.main-nav a, .main-nav button {
    background: #6c757d;
    color: white;
    padding: 10px 15px;
    text-decoration: none;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.main-nav a:hover, .main-nav button:hover {
    background: #5a6268;
}

/* Contrôles d'impression */
.print-controls {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.print-controls label {
    margin-right: 15px;
    cursor: pointer;
    font-weight: 500;
}

/* Éléments à cacher à l'impression */
.no-print {
    display: inline-block;
}

@media print {
    .no-print {
        display: none !important;
    }
}

/* Temps de recherche */
.search-time {
    color: #666;
    font-size: 0.9em;
    margin: 5px 0;
    text-align: center;
    font-style: italic;
}

/* Case à cocher */
input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
    transform: scale(1.2);
}

/* Pied de page impression */
.print-footer {
    display: none;
}

@media print {
    .print-footer {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 8pt;
        color: #666;
        border-top: 1px solid #ccc;
        padding: 5px;
        background: white;
    }
}



/* ======= PATCH Résultats KWIC (ajouter à la fin du fichier) ======= */

/* === Correctif affichage résultats === */

/* Conteneur large (reprend toute la largeur comme avant) */
.container {
  max-width: 100%;
  padding: 1rem;
}

/* Table KWIC: évite scroll horizontal mais garde largeur complète */
.kwic-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;  /* important pour éviter que la page déborde */
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Colonnes fixes (ajuste les % si besoin) */
.kwic-table thead th:nth-child(1) { width: 30%; }  /* gauche */
.kwic-table thead th:nth-child(2) { width: 10%; }  /* mot   */
.kwic-table thead th:nth-child(3) { width: 30%; }  /* droite */
.kwic-table thead th:nth-child(4) { width: 15%; }  /* source */
.kwic-table thead th:nth-child(5) { width: 7%;  }  /* ligne  */
.kwic-table thead th:nth-child(6) { width: 8%;  }  /* genre  */

/* Troncature propre */
.kwic-chunk {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Appliquer style rouge existant pour le mot */
.kwic-word,
.highlight {
  color: #e91e63;        /* rouge */
  font-weight: bold;
  background-color: #fff5f7;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

/* Empêche les URLs/mots longs de casser la mise en page */
.kwic-chunk,
.source-cell {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Responsive: réduire colonnes sur petits écrans */
@media (max-width: 900px) {
  .kwic-table thead th:nth-child(4),
  .kwic-table thead th:nth-child(5) { display: none; }
  .kwic-table tbody td:nth-child(4),
  .kwic-table tbody td:nth-child(5) { display: none; }
}

@media (max-width: 600px) {
  .kwic-table thead th:nth-child(6),
  .kwic-table tbody td:nth-child(6) { display: none; }
}


/* ===== Genre-specific badges ===== */
.genre-badge.poetry { background: #ffe0e0; color: #d32f2f; }
.genre-badge.novels { background: #e0f7fa; color: #00796b; }
.genre-badge.theatre { background: #fff9c4; color: #f57f17; }
.genre-badge.newspaper { background: #e8eaf6; color: #303f9f; }
.genre-badge.site-web { background: #f3e5f5; color: #6a1b9a; }
.genre-badge.specifique-corpus { background: #f1f8e9; color: #33691e; }
.genre-badge.traditional-songs { background: #fbe9e7; color: #bf360c; }
.genre-badge.dictionary { background: #e0f2f1; color: #004d40; }


.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  color: #fff;
}

/* Couleurs officielles */
.social-icons a.facebook {
  background-color: #1877F2;
}

.social-icons a.x {
  background-color: #000000;
}

.social-icons a.youtube {
  background-color: #FF0000;
}

.social-icons a:hover {
  transform: scale(1.05);
  transition: 0.2s;
}

.social-icons a.instagram {
  background: radial-gradient(circle at 30% 30%,
    #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
}
