@media (max-width: 768px) {

    /* Styles mobiles pour article_detail.html */
  /* Styles mobiles améliorés pour article_detail.html */
  .article-detail-mobile-share {
    margin-top: 2rem;
    border-top: 1px solid rgba(230, 230, 230, 1);
    padding-top: 1.5rem;
  }
  /* Style des boutons de partage mobile */
  .article-detail-mobile-share {
    margin-top: 2rem;
    border-top: 1px solid rgba(230, 230, 230, 1);
    padding-top: 1.5rem;
  }
  
  .article-detail-mobile-share-title {
    font-family: var(--ui-font-family);
    font-size: 1rem;
    color: rgba(41, 41, 41, 0.8);
    margin-bottom: 1rem;
    font-weight: 400;
  }
  
  .article-detail-mobile-share-buttons {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
  }
  
  .article-detail-mobile-share-button {
    text-decoration: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s ease;
  }
  
  /* Couleurs natives des réseaux sociaux */
  .article-detail-mobile-share-button.twitter {
    background-color: #000000; /* Couleur X/Twitter */
  }
  
  .article-detail-mobile-share-button.facebook {
    background-color: #4267B2; /* Couleur Facebook */
  }
  
  .article-detail-mobile-share-button.linkedin {
    background-color: #0077B5; /* Couleur LinkedIn */
  }
  
  .article-detail-mobile-share-button:hover {
    transform: scale(1.1);
  }
  
  .article-detail-mobile-share-button i {
    font-size: 1.1rem;
  }
  
  /* Version desktop */
  .article-share {
    background-color: transparent;
    padding: 1rem 0;
    margin-bottom: 2rem;
  }
  
  .article-share h3 {
    font-family: var(--ui-font-family);
    font-size: 0.9rem;
    color: rgba(41, 41, 41, 0.8);
    margin-bottom: 1rem;
    font-weight: 400;
  }
  
  .share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #fff;
    background-color: transparent;
    border-radius: 50%;
    transition: transform 0.2s ease;
    margin-right: 1rem;
  }
  
  .share-btn.twitter {
    background-color: #000000;
  }
  
  .share-btn.facebook {
    background-color: #4267B2;
  }
  
  .share-btn.linkedin {
    background-color: #0077B5;
  }
  
  .share-btn:hover {
    transform: scale(1.1);
  }
  
  .share-btn i {
    font-size: 1.1rem;
  }
    .article-detail-mobile-container {
      padding: 24px 24px;
      background-color: #fff;
      font-family: var(--body-font-family);
    }
  
    .article-detail-mobile-title {
      font-family: var(--title-font-family);
      font-size: 32px;
      line-height: 1.2;
      color: var(--text-color);
      letter-spacing: -0.016em;
      margin-bottom: 32px;
      font-weight: 400;
    }
  
    .article-detail-mobile-content {
      font-size: 18px;
      line-height: 1.58;
      color: var(--text-color);
      font-weight: 400;
      font-family: var(--body-font-family);
      letter-spacing: -0.003em;
    }
  
    .article-detail-mobile-meta {
      font-family: var(--ui-font-family);
      font-size: 14px;
      color: var(--secondary-color);
      margin-bottom: 32px;
    }
  
    .article-detail-mobile-content p {
      margin-top: 1em;
      margin-bottom: 1em;
    }
  
    .article-detail-mobile-content h2 {
      font-family: var(--title-font-family);
      font-size: 24px;
      line-height: 1.3;
      margin-top: 1.5em;
      margin-bottom: 0.8em;
      font-weight: 700;
      color: var(--text-color);
      letter-spacing: -0.012em;
    }
  
    .article-detail-mobile-content h3 {
      font-family: var(--title-font-family);
      font-size: 20px;
      line-height: 1.4;
      margin-top: 1em;
      margin-bottom: 0.7em;
      font-weight: 600;
      color: var(--text-color);
      letter-spacing: -0.012em;
    }
  
    .article-detail-mobile-summary {
      font-family: var(--body-font-family);
      font-size: 20px;
      line-height: 1.5;
      color: var(--secondary-color);
      margin: 1em 0;
      padding-left: 20px;
      border-left: 3px solid rgba(41, 41, 41, 0.15);
      font-style: italic;
      letter-spacing: -0.003em;
    }
  
    /* Style des liens */
    .article-detail-mobile-content a {
      color: var(--text-color);
      text-decoration: underline;
      text-decoration-thickness: 1px;
      text-underline-offset: 2px;
    }
  
    /* Style des éléments en gras */
    .article-detail-mobile-content strong,
    .article-detail-mobile-content b {
      font-weight: 700;
      color: var(--text-color);
    }
  
    /* Style des listes */
    .article-detail-mobile-content ul,
    .article-detail-mobile-content ol {
      margin-top: 2em;
      margin-bottom: 2em;
      padding-left: 30px;
    }
  
    .article-detail-mobile-content li {
      margin-bottom: 1em;
    }
  }
  
  /* Styles généraux */
  body {
    background-color: #f8f9fa;
  }
  
  /* Styles de la carte d'article */
  .vefa-article-card {
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    border: none;
  }
  
  .vefa-article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
  }
  
  .vefa-article-image {
    height: 100%;
    object-fit: cover;
  }
  
  .vefa-article-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    transition: color 0.3s ease-in-out;
  }
  
  .vefa-article-title:hover {
    color: #007bff;
  }
  
  .vefa-article-summary {
    color: #666;
    font-size: 0.9rem;
  }

  /* Frame and fit modes for main article image (desktop) */
  .article-main-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    display: block;
    background: var(--image-letterbox-bg, #f6f7f9);
  }
  .article-main-image picture,
  .article-main-image img {
    width: 100%;
    height: 100%;
    display: block;
  }
  .article-main-image.fit-cover img { object-fit: cover; }
  .article-main-image.fit-contain img { object-fit: contain; }
  /* Style amélioré pour les liens dans le contenu de l'article */
.article-content a {
    color: #3498db; /* Couleur primaire de l'article, cohérente avec l'existant */
    text-decoration: none;
    border-bottom: 1px solid rgba(52, 152, 219, 0.3); /* Soulignement léger pour indiquer un lien */
    padding-bottom: 1px;
    transition: all 0.2s ease;
    font-weight: 500; /* Légèrement plus gras pour se démarquer */
}

.article-content a:hover {
    color: #2980b9; /* Version plus foncée pour l'état hover */
    border-bottom: 1px solid rgba(41, 128, 185, 0.8); /* Soulignement plus visible au survol */
    background-color: rgba(52, 152, 219, 0.05); /* Légère couleur de fond au survol */
}

.article-content a:focus {
    outline: 2px solid rgba(52, 152, 219, 0.4);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Style pour les liens externes avec indicateur visuel */
.article-content a[href^="http"]:not([href*="vefaconnect.com"]):after {
    content: " \f08e"; /* Code Unicode pour l'icône de lien externe de Font Awesome */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.75em;
    display: inline-block;
    margin-left: 3px;
    vertical-align: middle;
}

/* Style pour les liens dans la version mobile */
.article-detail-mobile-content a {
    color: #3498db;
    text-decoration: none;
    border-bottom: 1px solid rgba(52, 152, 219, 0.3);
    padding-bottom: 1px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.article-detail-mobile-content a:hover,
.article-detail-mobile-content a:active {
    color: #2980b9;
    border-bottom: 1px solid rgba(41, 128, 185, 0.8);
    background-color: rgba(52, 152, 219, 0.05);
}

  /* Frame and fit modes for main article image (mobile) */
  .article-detail-mobile-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--image-letterbox-bg, #f6f7f9);
  }
  .article-detail-mobile-image img {
    width: 100%;
    height: 100%;
    display: block;
  }
  .article-detail-mobile-image.fit-cover img { object-fit: cover; }
  .article-detail-mobile-image.fit-contain img { object-fit: contain; }

/* Styles for VefaConnect footer - Version alignée avec style.css */
.vefa-footer {
  padding: 1rem 0; /* Padding uniforme sur tout le footer */
  background-color: var(--footer-bg-color);
  color: var(--footer-text-color);
  width: 100%;
  min-height: 60px; /* Hauteur minimum au lieu de fixe */
  position: relative;
  border-top: 1px solid rgba(0, 0, 0, 0.08); /* Bordure plus subtile et visible */
  margin-top: 2rem; /* Espacement avec le contenu précédent */
}


/* Table Styles within Article Content */
.table-responsive-wrapper {
    overflow-x: auto;
    width: 100%; /* Default width */
    margin: 1.5rem 0; /* Apply margin to wrapper */
    -webkit-overflow-scrolling: touch; /* Smoother scrolling on iOS */
    box-sizing: border-box; /* Include padding/border in width */
}

.table-responsive-wrapper table,
.article-content table,
.article-detail-mobile-content table {
  width: 100%; /* Or consider width: auto; if you want table to shrink */
  border-collapse: collapse;
  /* margin: 1.5rem 0; <-- Removed margin from table */
  font-size: 0.95rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border: 1px solid #e0e0e0; /* Added border around the table */
  /* overflow-x: auto; <-- Removed from table */
  /* display: block; <-- Removed from table */
}

.article-content th,
.article-detail-mobile-content th,
.article-content td,
.article-detail-mobile-content td {
  border: 1px solid #e0e0e0; /* Borders for all cells, including vertical lines */
  padding: 0.75rem 1rem;
  text-align: left;
  vertical-align: top;
}

.article-content th,
.article-detail-mobile-content th {
  background-color: #f8f9fa; /* Light background for headers */
  font-weight: 600;
  color: var(--article-secondary-color, #2c3e50);
}

.article-content tr:nth-child(even),
.article-detail-mobile-content tr:nth-child(even) {
  background-color: #fdfdfd; /* Subtle striping for rows */
}

/* Style table header (th) */
.table-responsive-wrapper th {
  background-color: #f8f9fa; /* Light background for headers */
  font-weight: 600;
  color: var(--article-secondary-color, #2c3e50);
  vertical-align: bottom; /* Align text to bottom for header feel */
  text-align: left; /* Ensure consistent alignment */
}

/* Style first row cells as header if td is used instead of th */
.table-responsive-wrapper table > tbody > tr:first-child > td {
  background-color: #f8f9fa;
  font-weight: 600;
  color: var(--article-secondary-color, #2c3e50);
  vertical-align: bottom;
  text-align: left; /* Match TH alignment */
}

/* Responsive table adjustments (though overflow-x handles most) */
@media (max-width: 768px) {
  .article-content table,
  .article-detail-mobile-content table {
    font-size: 0.85rem; /* Slightly smaller font on mobile */
  }
  .article-content th,
  .article-detail-mobile-content th,
  .article-content td,
  .article-detail-mobile-content td {
    padding: 0.5rem 0.75rem; /* Adjust padding for smaller screens */
  }
}



/* Responsive table adjustments (though overflow-x handles most) */
@media (max-width: 768px) {
  /* General adjustments for tables inside the wrapper */
  .table-responsive-wrapper table {
    font-size: 0.85rem; /* Slightly smaller font on mobile */
     /* Let table size naturally, wrapper handles scroll */
     width: auto; 
     min-width: 100%; /* Ensure it fills container if content is narrow */
  }

  .table-responsive-wrapper th,
  .table-responsive-wrapper td {
    padding: 0.5rem 0.75rem; /* Adjust padding for smaller screens */
  }

  /* Specific rules for mobile content area if needed, though wrapper should handle it */
  .article-detail-mobile-content .table-responsive-wrapper {
      /* Ensure wrapper behaves correctly within padded container */
      width: auto; /* Let it fit the container's content box */
      max-width: 100%; /* Prevent exceeding container if needed */
      overflow-x: auto;
      box-sizing: border-box;
  }
}


/* ==========================================
   ARTICLE COMMENTS SECTION STYLES
   ========================================== */

/* Section principale des commentaires */
.article-comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.article-comments-title {
    font-family: var(--title-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color, #333);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-comments-title i {
    color: #3498db;
}

.article-comments-count {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.article-comments-login-prompt {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.article-comments-login-prompt a {
    color: #3498db;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.article-comments-login-prompt a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.article-comments-empty {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* Formulaire de commentaire principal */
.article-comment-form-container {
    margin-bottom: 2rem;
}

.article-comment-form {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.article-comment-input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.article-comment-avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.article-comment-textarea {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.article-comment-textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.article-comment-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.article-comment-submit-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-comment-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.article-comment-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Bouton "Voir plus de commentaires" (pagination HTMX) */
.article-comments-load-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    margin: 1.5rem auto 0;
    background: #fff;
    border: 1px solid rgba(52, 152, 219, 0.3);
    color: #3498db;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.article-comments-load-more:hover {
    background: #3498db;
    color: #fff;
}

.article-comments-load-more:active {
    transform: translateY(1px);
}

.article-comments-load-more .htmx-indicator {
    display: none;
    margin-left: 0.5rem;
}

.article-comments-load-more.htmx-request .htmx-indicator,
.htmx-request .article-comments-load-more-spinner,
.htmx-request .article-comments-load-more-spinner-mobile {
    display: inline-block;
}

#article-comments-list,
#article-comments-list-mobile {
    display: flex;
    flex-direction: column;
}

/* Item de commentaire */
.article-comment-item {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s ease;
}

.article-comment-item:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* Indentation pour les réponses imbriquées */
.article-comment-item[data-level="2"] {
    margin-left: 2rem;
    background: #fafbfc;
}

.article-comment-item[data-level="3"],
.article-comment-item[data-level="4"] {
    margin-left: 4rem;
    background: #f8f9fa;
}

.article-comment-max-depth {
    border-left: 3px solid #e0e0e0;
}

.article-comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.article-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.article-comment-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.article-comment-username {
    font-weight: 600;
    color: var(--text-color, #333);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.article-comment-username:hover {
    color: #3498db;
}

.article-comment-date {
    font-size: 0.8rem;
    color: #888;
}

.article-comment-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color, #444);
    margin-bottom: 0.75rem;
}

/* Actions du commentaire */
.article-comment-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.article-comment-upvote {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    transition: all 0.2s ease;
    background: transparent;
}

.article-comment-upvote:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.article-comment-upvote.active-vote {
    color: #3498db;
    background: rgba(52, 152, 219, 0.12);
}

.article-comment-upvote.active-vote i {
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.article-comment-reply-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #666;
    background: transparent;
    border: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.article-comment-reply-btn:hover {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

/* Formulaire de réponse */
.article-comment-reply-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.article-comment-reply-form.hidden {
    display: none;
}

.article-comment-reply-form-inner {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1rem;
}

.article-comment-reply-input-wrapper {
    margin-bottom: 0.75rem;
}

.article-comment-reply-textarea {
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 60px;
    transition: border-color 0.2s ease;
}

.article-comment-reply-textarea:focus {
    outline: none;
    border-color: #3498db;
}

.article-comment-reply-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.article-comment-reply-cancel {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.article-comment-reply-cancel:hover {
    background: #f0f0f0;
}

.article-comment-reply-submit {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.article-comment-reply-submit:hover {
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.article-comments-no-replies {
    color: #999;
    font-size: 0.9rem;
    padding: 0.5rem 0;
    font-style: italic;
}

/* Responsive mobile */
@media (max-width: 768px) {
    .article-comments-section {
        margin-top: 2rem;
        padding: 1rem;
    }
    
    .article-comments-title {
        font-size: 1.25rem;
    }
    
    .article-comment-item[data-level="2"],
    .article-comment-item[data-level="3"],
    .article-comment-item[data-level="4"] {
        margin-left: 1rem;
    }
    
    .article-comment-input-wrapper {
        flex-direction: column;
    }
    
    .article-comment-avatar-small {
        display: none;
    }
    
    .article-comment-reply-actions {
        flex-direction: column;
    }
    
    .article-comment-reply-cancel,
    .article-comment-reply-submit {
        width: 100%;
        justify-content: center;
    }
}
