/* ==========================================================================
   AMJ74 Informatique — Socle CSS commun aux articles (/actualites/)
   --------------------------------------------------------------------------
   Ce fichier remplace le bloc <style> qui etait recopie dans chaque article.
   Pour modifier l'apparence de TOUS les articles : editer ce fichier
   uniquement, puis l'uploader. Aucun article a retoucher.

   Les variables (--primary, --text, --border, --radius, --shadow...) sont
   definies dans header.php. Le CSS de la lightbox et des boutons .btn est
   deja global (footer.php / header.php) : ne pas le redupliquer ici.

   SOMMAIRE
     1.  Hero + fil d'ariane
     2.  Corps de l'article (typographie)
     3.  Images et legendes
     4.  Sommaire (table of contents)
     5.  Encart d'appel a l'action (CTA)
     6.  FAQ (accordeon)
     7.  Tableaux
     8.  Encarts (info / mise en avant / alerte)
     9.  Code
     10. Video
     11. Mises en page (showcase, duo d'images, 2 colonnes, etapes)
     12. Divers
     13. Responsive

   Tout ce qui suit est optionnel : une regle inutilisee ne coute rien.
   Pour un nouvel article, il suffit d'utiliser les classes ci-dessous,
   il n'y a plus rien a copier-coller.
   ========================================================================== */


/* ==========================================================================
   1. HERO + FIL D'ARIANE
   ========================================================================== */

.article-hero {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    overflow: hidden;
    padding: 60px 0;
}

.article-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(27, 133, 211, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(34, 197, 94, 0.1) 0%, transparent 50%);
}

.article-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    justify-content: center;
}

.breadcrumb-nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb-nav a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--text);
    margin: 0 0.5rem;
    font-weight: 600;
}

.article-title {
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.25;
    display: inline-block;
    padding-bottom: .15em;
    margin: 1rem 0;
    background: linear-gradient(135deg, var(--text), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


/* ==========================================================================
   2. CORPS DE L'ARTICLE (typographie)
   ========================================================================== */

.article-content {
    padding: 100px 0;
    background: white;
}

/* Largeur : le .container parent (header.php, --max-width: 1200px) fixe deja
   la largeur. On occupe 100% pour rester coherent avec l'accueil. */
.article-body {
    max-width: 100%;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.article-body h2 {
    font-size: 2rem;
    color: var(--primary);
    margin: 3rem 0 1.5rem 0;
    line-height: 1.3;
}

.article-body h3 {
    font-size: 1.5rem;
    color: var(--text);
    margin: 2.5rem 0 1rem 0;
    line-height: 1.3;
}

.article-body p {
    margin-bottom: 1.5rem;
}

.article-body ul,
.article-body ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.article-body li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

.article-body strong {
    color: var(--text);
    font-weight: 600;
}

/* Liens de texte uniquement : les boutons (.btn, .download-btn) sont exclus,
   sinon cette regle (specificite 0,1,1) ecraserait la couleur de .btn-primary
   (0,1,0) et le texte du bouton passerait en bleu sur fond bleu. */
.article-body a:not(.btn):not(.download-btn) {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

.article-body a:not(.btn):not(.download-btn):hover {
    border-bottom-color: var(--primary);
}


/* ==========================================================================
   3. IMAGES ET LEGENDES
   Les images sont cliquables : la lightbox est geree globalement (footer.php)
   sur le selecteur .article-body .article-image img
   ========================================================================== */

.article-image {
    text-align: center;
    margin: 3rem 0;
}

.article-image img {
    width: 100%;
    max-width: 600px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.article-image img:hover {
    transform: scale(1.02);
}

.article-image figcaption {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}


/* ==========================================================================
   4. SOMMAIRE
   ========================================================================== */

.table-of-contents {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 2rem 0 3rem 0;
}

.table-of-contents h2 {
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    margin-top: 0;
}

.table-of-contents ol {
    margin: 0;
    padding-left: 1.5rem;
}

.table-of-contents li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.table-of-contents a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.table-of-contents a:hover {
    color: var(--primary);
    text-decoration: underline;
}


/* ==========================================================================
   5. ENCART D'APPEL A L'ACTION
   ========================================================================== */

.cta-section {
    background: var(--background);
    padding: 3rem;
    border-radius: var(--radius);
    text-align: center;
    margin: 3rem 0;
    border: 1px solid var(--border);
}

.cta-section h3 {
    color: var(--primary);
    margin-bottom: 1rem;
}

.cta-section p {
    margin-bottom: 2rem;
}


/* ==========================================================================
   6. FAQ (accordeon)
   Le comportement est dans /assets/js/article.js (fonction toggleFaq)
   Markup attendu :
     <div class="faq-item">
       <div class="faq-question" onclick="toggleFaq(this)">Question ?</div>
       <div class="faq-answer"><p>Reponse</p></div>
     </div>
   ========================================================================== */

.faq-section {
    margin: 4rem 0;
    padding: 3rem;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.faq-item {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.faq-question {
    background: white;
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 600;
    color: var(--text);
    transition: background-color 0.3s ease;
}

.faq-question:hover {
    background: var(--background);
}

.faq-question::before {
    content: '\25B6';
    color: var(--primary);
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.faq-item.active .faq-question::before {
    transform: rotate(90deg);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: white;
}

.faq-item.active .faq-answer {
    padding: 1.5rem;
    max-height: 1200px;
}


/* ==========================================================================
   7. TABLEAUX
   Habillage identique partout (en-tete bleu #144363, lignes alternees,
   survol) ; seul l'alignement des cellules change selon le contenu :

     .comparison-table  valeurs COURTES a comparer   -> centre
     .raccourci-table   idem (alias historique)      -> centre
     .use-cases-table   phrases                      -> gauche
     .features-table    phrases, variante "carte"    -> gauche
     <table> sans classe dans .article-body          -> gauche

   Choisir .comparison-table pour des prix / oui-non / chiffres,
   .use-cases-table pour des colonnes de texte redige.
   ========================================================================== */

.comparison-table,
.raccourci-table,
.use-cases-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.comparison-table th,
.raccourci-table th,
.use-cases-table th {
    background-color: #144363;
    color: white;
    text-align: center;
    padding: 1rem;
    font-weight: 600;
}

.comparison-table td,
.raccourci-table td,
.use-cases-table td {
    padding: 0.8rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

/* Colonnes de texte redige : lecture a gauche */
.use-cases-table th,
.use-cases-table td {
    text-align: left;
    vertical-align: top;
}

.comparison-table tr:nth-child(even),
.raccourci-table tr:nth-child(even),
.use-cases-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.comparison-table tr:hover,
.raccourci-table tr:hover,
.use-cases-table tr:hover {
    background-color: #e2e8f0;
}

/* Tableau sans classe (<table> ou <table border="1">) : meme habillage,
   texte aligne a gauche. Le :not([class]) est indispensable : sans lui ces
   regles, ecrites apres et de specificite egale, ecraseraient l'alignement
   centre de .comparison-table. */
.article-body table:not([class]) {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
}

.article-body table:not([class]) th,
.article-body table:not([class]) td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border);
    vertical-align: top;
}

.article-body table:not([class]) th {
    background: #144363;
    color: white;
    font-weight: 600;
}

.article-body table:not([class]) tr:hover {
    background: #f1f5f9;
}

/* Variante "carte" avec ombre portee (colonnes de texte) */
.features-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    margin: 2rem 0;
}

.features-table th {
    background-color: #144363;
    color: white;
    text-align: left;
    padding: 1rem;
    font-weight: 600;
}

.features-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.features-table tr:nth-child(odd) {
    background-color: white;
}

.features-table tr:nth-child(even) {
    background-color: #f8fafc;
}

.features-table tr:hover {
    background-color: #e2e8f0;
}


/* ==========================================================================
   8. ENCARTS
   Markup attendu pour .info-box / .security-alert :
     <div class="info-box">
       <div class="info-box-icon">i</div>
       <div class="info-box-content"><p>Texte</p></div>
     </div>
   ========================================================================== */

/* Bleu — information */
.info-box {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #2196f3;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.info-box-icon {
    background: #2196f3;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: bold;
}

.info-box-content {
    flex: 1;
}

.info-box-content p {
    margin: 0;
    color: var(--text);
}

/* Jaune — avertissement */
.security-alert {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #d39e00;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.security-alert-icon {
    background: #d39e00;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: bold;
}

.security-alert-content {
    flex: 1;
}

.security-alert-content p {
    margin: 0;
    color: #856404;
    font-weight: 500;
}

/* Bleu clair — mise en avant, barre laterale */
.highlight-box {
    background: linear-gradient(135deg, rgba(27, 133, 211, 0.05), rgba(27, 133, 211, 0.1));
    border-left: 4px solid var(--primary);
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 8px;
    border: 1px solid rgba(27, 133, 211, 0.2);
}

/* Rouge — alerte */
.alert-box {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(239, 68, 68, 0.1));
    border-left: 4px solid #ef4444;
    padding: 2rem;
    margin: 2rem 0;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-box strong {
    color: #dc2626;
}


/* ==========================================================================
   9. CODE
   ========================================================================== */

.article-body pre {
    background: var(--secondary);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 2rem 0;
    font-family: 'Monaco', 'Menlo', monospace;
}

.article-body code {
    background: var(--background);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    border: 1px solid var(--border);
}

.article-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}


/* ==========================================================================
   10. VIDEO (ratio 16:9 responsive)
   Markup attendu :
     <div class="article-video">
       <div class="video-wrapper"><iframe ...></iframe></div>
     </div>
   ========================================================================== */

.article-video {
    text-align: center;
    margin: 3rem 0;
}

.video-wrapper,
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.video-container {
    margin: 3rem 0;
}

.video-wrapper iframe,
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}


/* ==========================================================================
   11. MISES EN PAGE
   ========================================================================== */

/* Texte + image cote a cote, fond gris. Les 3 noms sont equivalents. */
.media-showcase,
.security-showcase,
.camera-showcase,
.component-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    margin: 3rem 0;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* Une ligne sur deux : colonnes inversees (image a gauche) */
.media-showcase:nth-child(even),
.security-showcase:nth-child(even),
.camera-showcase:nth-child(even),
.component-showcase:nth-child(even) {
    direction: rtl;
}

.media-showcase:nth-child(even) > *,
.security-showcase:nth-child(even) > *,
.camera-showcase:nth-child(even) > *,
.component-showcase:nth-child(even) > * {
    direction: ltr;
}

.media-showcase-image,
.security-image,
.camera-image,
.component-image {
    text-align: center;
}

.media-showcase-image img,
.camera-image img,
.component-image img {
    width: 100%;
    max-width: 300px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.security-image img {
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Deux images cote a cote */
.image-duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 3rem 0;
    align-items: center;
}

.image-duo img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-duo img:hover {
    transform: scale(1.02);
}

/* Colonne etroite + colonne large */
.two-columns {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin: 2rem 0;
    align-items: start;
}

/* Etapes numerotees
   <div class="step-container">
     <div class="step-number">1</div>
     <div class="step-content"><h3>Titre</h3><p>...</p></div>
   </div> */
.step-container {
    position: relative;
    margin: 2rem 0;
    padding-left: 4rem;
}

.step-number {
    position: absolute;
    left: 0;
    top: 0;
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--primary), #1976d2);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.step-content h3 {
    margin-top: 0;
    color: var(--primary);
}


/* ==========================================================================
   12. DIVERS
   ========================================================================== */

.download-btn {
    background: linear-gradient(135deg, var(--primary), #1976d2);
    color: white;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s ease;
    margin: 2rem 0;
}

.download-btn:hover {
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}


/* ==========================================================================
   13. RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {

    .article-hero {
        padding: 40px 0;
    }

    .article-content {
        padding: 60px 0;
    }

    .article-body {
        padding: 0 1rem;
    }

    .article-meta {
        flex-direction: column;
        gap: 1rem;
    }

    .breadcrumb-nav {
        margin-bottom: 1.5rem;
        font-size: 0.85rem;
    }

    .table-of-contents,
    .faq-section,
    .cta-section {
        padding: 1.5rem;
    }

    /* Tableaux : defilement horizontal plutot que debordement de page */
    .comparison-table,
    .raccourci-table,
    .use-cases-table,
    .features-table,
    .article-body table:not([class]) {
        font-size: 0.9rem;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .comparison-table th,
    .comparison-table td,
    .raccourci-table th,
    .raccourci-table td,
    .use-cases-table th,
    .use-cases-table td,
    .features-table th,
    .features-table td {
        padding: 0.6rem 0.5rem;
    }

    /* Toutes les mises en page en grille repassent sur une colonne */
    .media-showcase,
    .security-showcase,
    .camera-showcase,
    .component-showcase,
    .image-duo,
    .two-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* Seuls les showcases sont des blocs encadres : eux seuls ont un padding */
    .media-showcase,
    .security-showcase,
    .camera-showcase,
    .component-showcase {
        padding: 1.5rem;
    }

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

    .media-showcase:nth-child(even),
    .security-showcase:nth-child(even),
    .camera-showcase:nth-child(even),
    .component-showcase:nth-child(even) {
        direction: ltr;
    }

    .step-container {
        padding-left: 3.25rem;
    }

    .step-number {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }

    .info-box,
    .security-alert,
    .highlight-box,
    .alert-box {
        padding: 1.25rem;
    }

    /* Icone au-dessus du texte plutot qu'a cote */
    .info-box,
    .security-alert {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
}
