/* /var/www/jravier.fr/css/style.css */

:root {
    --sidebar-bg: #0f172a;        /* Bleu nuit (Slate 900) */
    --sidebar-text: #94a3b8;      /* Gris bleu clair */
    --primary-accent: #10b981;    /* Vert Emerald */
    --hover-bg: #1e293b;          /* Survol menu */
    --body-bg: #f1f5f9;           /* Gris très très clair pour le fond global */
    --card-bg: #ffffff;           /* Blanc pur pour les articles */
    --text-main: #334155;         /* Gris foncé lisible */
    --heading-color: #0f172a;
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Inter, system-ui, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR (Barre Latérale) --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
    border-right: 1px solid #1e293b;
}

.logo { margin-bottom: 30px; text-align: center; }
.logo img { max-width: 140px; height: auto; }

.nav-links { list-style: none; }
.nav-links li { margin-bottom: 5px; }

/* Titres de sections (Systèmes, Réseaux...) */
.nav-section {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin: 25px 0 10px 10px;
    font-weight: 800;
}

.nav-links a {
    text-decoration: none;
    color: var(--sidebar-text);
    display: block;
    padding: 10px 15px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-links a:hover, .nav-links a.active {
    background-color: var(--hover-bg);
    color: var(--primary-accent);
    border-left: 3px solid var(--primary-accent);
}

/* --- MAIN CONTENT (Contenu Droite) --- */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 40px;
    max-width: 1200px; /* Limite la largeur pour la lecture */
}

/* Header Mobile (caché sur PC) */
.mobile-header {
    display: none;
    background: var(--sidebar-bg);
    color: white;
    padding: 15px 20px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 2000;
    width: 100%;
}

/* --- COMPOSANTS (Cartes, Alertes, Tags) --- */
h1 { font-size: 2.2rem; color: var(--heading-color); margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-top: 2rem; margin-bottom: 1rem; color: var(--heading-color); border-bottom: 2px solid #e2e8f0; padding-bottom: 5px; }

.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-color: var(--primary-accent);
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tag {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.btn-read {
    display: inline-block;
    margin-top: 15px;
    color: var(--primary-accent);
    font-weight: 700;
    text-decoration: none;
}

.btn-read:hover { text-decoration: underline; }

/* Bloc de code */
pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 15px;
    border-radius: 6px;
    /* Correction de l'overflow */
    white-space: pre-wrap;
    word-break: break-all;
    max-width: 100%;
    /* Fin de correction */
    font-family: 'Consolas', monospace;
    margin: 15px 0;
    border-left: 4px solid var(--primary-accent);
}

/* Footer */
footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #cbd5e1;
    font-size: 0.85rem;
    color: #64748b;
    text-align: center;
}

footer a { color: #64748b; }

/* RESPONSIVE MOBILE */
@media (max-width: 900px) {
    body { flex-direction: column; }
    .sidebar { transform: translateX(-100%); width: 85%; box-shadow: 5px 0 25px rgba(0,0,0,0.5); }
    .sidebar.active { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 20px; width: 100%; }
    .mobile-header { display: flex; }
    .menu-toggle { font-size: 1.5rem; cursor: pointer; }
}


/* --- AJOUTS POUR LES ARTICLES (TEMPLATE) --- */

/* Boîtes d'alerte / Commentaires */
.alert {
    padding: 15px 20px;
    border-left: 5px solid;
    border-radius: 4px;
    margin: 25px 0;
    font-size: 0.95rem;
}

.alert-info {
    background-color: #e0f2fe; /* Bleu très clair */
    border-color: #0284c7;     /* Bleu fort */
    color: #0c4a6e;
}

.alert-warning {
    background-color: #fff7ed; /* Orange très clair */
    border-color: #f97316;     /* Orange fort */
    color: #7c2d12;
}

.alert-success {
    background-color: #f0fdf4; /* Vert très clair */
    border-color: #16a34a;     /* Vert fort */
    color: #14532d;
}

/* Images et Légendes */
figure {
    margin: 30px 0;
    text-align: center;
}

figure img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

figcaption {
    margin-top: 10px;
    color: #64748b;
    font-size: 0.85rem;
    font-style: italic;
}

/* En-tête de code (facultatif, pour faire joli) */
.code-header {
    background: #334155;
    color: #cbd5e1;
    padding: 5px 15px;
    font-size: 0.8rem;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    margin-bottom: -15px; /* Colle au bloc pre */
    position: relative;
    z-index: 1;
    display: inline-block;
}

/* Styles pour la recherche */
.search-wrapper {
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 15px;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-icon {
    margin-right: 10px;
    font-size: 1.2rem;
}

#tagSearch {
    border: none;
    padding: 10px 0;
    width: 100%;
    outline: none;
    font-size: 1rem;
    color: var(--text-main);
    background: transparent;
}

.search-feedback {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #64748b;
    font-style: italic;
    min-height: 20px;
}

/* Animation de transition pour les articles */
.grid-container article {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Rend les tableaux scrollables sur petit écran au lieu de casser la page */
.card table {
    display: block;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    white-space: nowrap; /* Optionnel : empêche le texte des cellules de passer à la ligne */
}

/* --- SOMMAIRE AUTOMATIQUE --- */
.table-of-contents {
    background-color: #f8fafc; /* Gris très clair (Slate 50) */
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
    width: fit-content; /* S'adapte au contenu, ou mettre 100% */
    min-width: 250px;
}

.toc-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--heading-color);
    border-bottom: 2px solid var(--primary-accent);
    display: inline-block;
    padding-bottom: 5px;
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin-bottom: 8px;
}

.table-of-contents a {
    text-decoration: none;
    color: var(--text-main);
    transition: color 0.2s;
    font-size: 0.95rem;
}

.table-of-contents a:hover {
    color: var(--primary-accent);
    text-decoration: underline;
}

/* Indentation pour les sous-titres (h3) */
.toc-item-h3 {
    margin-left: 20px;
    font-size: 0.9em;
    border-left: 2px solid #e2e8f0;
    padding-left: 10px;
}