/* ===========================
   Variables CSS
   =========================== */
:root {
    --accent-color: #4a90e2;
    --accent-hover: #357abd;
    --text-light: #495057;
    --text-dark: #2c3e50;
    --card-bg: #ffffff;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --shadow: rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

/* ===========================
   Reset & Base
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #e3f2fd 0%, #f5f7fa 100%);
    min-height: 100vh;
    padding: 40px 20px;
    color: var(--text-dark);
    line-height: 1.6;
}

/* ===========================
   Layout Container
   =========================== */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Sidebar
   =========================== */
.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 25px;
    overflow-y: hidden;
    height: 100%;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section:first-child {
    margin-top: 0;
}

.sidebar-heading {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--accent-color);
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
}

.sidebar-heading::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
}

.categories-nav,
.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-link,
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.category-link:hover,
.nav-link:hover {
    background: rgba(74, 144, 226, 0.15);
    border-left-color: var(--accent-color);
    transform: translateX(5px);
}

.category-link.active {
    background: rgba(74, 144, 226, 0.2);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    font-size: 11px;
    color: #95b3d7;
}

.sidebar-footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.sidebar-footer a:hover {
    color: #64b5f6;
}

/* Header de la sidebar avec logo */
.sidebar-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: white;
    transition: opacity 0.3s ease;
}

.sidebar-logo:hover {
    opacity: 0.9;
}

.logo-image {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 15px;
    object-fit: contain;
    background: white;
}

.logo-text {
    width: 100%;
    text-align: center;
}

.logo-text h1,
.logo-title {
    font-size: 26px;
    font-weight: 700;
    color: white;
    margin: 0 0 8px 0;
    line-height: 1;
}

.logo-text .site-subtitle {
    font-size: 13px;
    color: #95b3d7;
    margin: 0;
    line-height: 1;
}

/* ===========================
   Site Header (Sticky)
   =========================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    padding: 20px 40px;
    border-bottom: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Cacher le header sur desktop */
.site-header.mobile-only {
    display: none;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
    margin-bottom: 5px;
}

.site-logo:hover {
    color: var(--accent-color);
}

.site-logo h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
}

.site-header .site-subtitle {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
    padding-left: 40px;
}

.logo-text .site-subtitle {
    padding-left: 0;
}

/* ===========================
   Main Content
   =========================== */
.main-content {
    padding: 0;
    position: relative;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.content-wrapper {
    padding: 35px 40px;
    min-height: 100%;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ===========================
   Breadcrumb
   =========================== */
.breadcrumb {
    padding: 15px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 13px;
    color: #6c757d;
}

.breadcrumb a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* ===========================
   Section Headers
   =========================== */
.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
}

.section-icon {
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid var(--text-dark);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    color: var(--text-dark);
    font-size: 24px;
    transition: all 0.3s ease;
}

.section-icon svg {
    width: 24px;
    height: 24px;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.page-subtitle {
    font-size: 16px;
    color: #6c757d;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* ===========================
   Cards
   =========================== */
.card {
    background: var(--card-bg);
    border-left: 4px solid var(--text-dark);
    padding: 20px;
    margin-bottom: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: block;
    text-decoration: none;
    color: inherit;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--text-dark);
    transition: width 0.3s ease;
}

.card:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 25px var(--shadow);
}

/* Blog Cards */
.blog-card {
    cursor: pointer;
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: flex-start;
}

.blog-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(74, 144, 226, 0.2);
}

.blog-card-image {
    width: 250px;
    min-width: 250px;
    height: 180px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 0;
    background: #f8f9fa;
}

.blog-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.card-title svg {
    flex-shrink: 0;
}

.card-meta {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 400;
}

.card-description {
    font-size: 14px;
    line-height: 1.7;
    color: #555;
    margin-bottom: 15px;
}

/* ===========================
   Tags
   =========================== */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(52, 152, 219, 0.1);
    color: var(--accent-color);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tag:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
}

/* ===========================
   Article Content
   =========================== */
.article-header {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e9ecef;
}

.article-title {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 15px;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    color: #6c757d;
    font-size: 14px;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-featured-image {
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--border-radius);
    display: block;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Desktop - image à gauche avec 35% de largeur */
@media (min-width: 769px) {
    .article-featured-image {
        max-width: 35%;
        width: auto;
        float: left;
        margin: 0 30px 20px 0;
    }
}

/* Mobile - image pleine largeur avec vw */
@media (max-width: 768px) {
    .article-featured-image {
        max-width: 100% !important;
        width: 100% !important;
        float: none !important;
        margin: 0 0 20px 0 !important;
    }
}

/* Force pour les très petits écrans */
@media (max-width: 600px) {
    .article-featured-image {
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        float: none !important;
        margin: 0 0 20px 0 !important;
    }
}

/* Empêcher tout débordement sur article et images */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: clip;
    max-width: 100vw;
}

article {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

img {
    max-width: 100%;
    height: auto;
}

.article-content {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.article-content h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 40px;
    margin-bottom: 20px;
}

.article-content h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
    margin-top: 30px;
    margin-bottom: 15px;
}

.article-content p {
    margin-bottom: 20px;
}

.article-content ul,
.article-content ol {
    margin-bottom: 20px;
    padding-left: 30px;
}

.article-content li {
    margin-bottom: 10px;
}

.article-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    color: #e74c3c;
}

.article-content pre {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 25px 0;
    line-height: 1.6;
    max-width: 100%;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
}

.article-content pre code {
    background: none;
    color: #ecf0f1;
    padding: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
}

/* Warning and Tip Boxes */
.warning-box,
.article-content .warning-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 20px;
    margin: 25px 0;
    border-radius: 4px;
}

.tip-box,
.article-content .tip-box {
    background: #d4edda;
    border-left: 4px solid #28a745;
    padding: 20px;
    margin: 25px 0;
    border-radius: 4px;
}

.info-box,
.article-content .info-box {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    padding: 20px;
    margin: 25px 0;
    border-radius: 4px;
}

.danger-box,
.article-content .danger-box {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 20px;
    margin: 25px 0;
    border-radius: 4px;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 20px 0;
}

.article-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: #6c757d;
}

/* ===========================
   Category Introduction
   =========================== */
.category-intro {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.1) 0%, rgba(52, 152, 219, 0.05) 100%);
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 40px;
    border-left: 4px solid var(--accent-color);
}

.category-intro h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 15px;
}

.category-intro p {
    font-size: 15px;
    line-height: 1.7;
    color: #555;
}

/* Details/Summary pour intro SEO */
.category-details {
    margin-top: 20px;
}

.category-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(74, 144, 226, 0.08);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--accent-color);
    font-size: 14px;
    transition: all 0.3s ease;
    list-style: none;
    user-select: none;
}

.category-summary::-webkit-details-marker {
    display: none;
}

.category-summary:hover {
    background: rgba(74, 144, 226, 0.15);
    transform: translateX(4px);
}

.category-summary .chevron {
    transition: transform 0.3s ease;
}

.category-details[open] .category-summary .chevron {
    transform: rotate(180deg);
}

.category-details-content {
    margin-top: 15px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    color: #555;
    border: 1px solid rgba(74, 144, 226, 0.2);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   Mobile Menu Toggle Button
   =========================== */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    width: 50px;
    height: 50px;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: var(--accent-color);
    transform: scale(1.1);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.overlay-active {
    opacity: 1;
}

/* ===========================
   Pagination
   =========================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 40px 0;
    padding: 20px;
    flex-wrap: wrap;
}

.pagination-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: white;
    color: var(--accent-color);
    text-decoration: none;
    border-radius: 8px;
    border: 2px solid var(--accent-color);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

.pagination-link:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.pagination-link svg {
    width: 16px;
    height: 16px;
}

.pagination-info {
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
}

/* ===========================
   Responsive
   =========================== */

/* Tablette et mobile - Images d'articles */
@media (max-width: 1024px) {
    .content-wrapper {
        padding: 35px 20px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    .article-featured-image {
        float: none !important;
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 0 20px 0 !important;
        display: block !important;
    }

    .article-content .featured-image {
        float: none !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 0 20px 0 !important;
    }

    .article-content .featured-image img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
    }
}

/* Mobile strict */
@media (max-width: 968px) {
    body {
        padding: 0;
    }

    /* Afficher le header en mobile */
    .site-header.mobile-only {
        display: block;
    }

    /* Adapter le logo de la sidebar en mobile */
    .sidebar-header {
        display: block;
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .logo-image {
        width: 80px;
        height: 80px;
    }

    .logo-text h1,
    .logo-title {
        font-size: 20px;
    }

    .logo-text .site-subtitle {
        font-size: 11px;
    }

    .page-container {
        grid-template-columns: 1fr;
        min-height: auto;
        max-width: 100%;
    }

    .article-content {
        max-width: 100%;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-overlay {
        display: block;
        pointer-events: none;
    }

    .mobile-menu-overlay.overlay-active {
        pointer-events: auto;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        z-index: 999;
        padding: 20px;
        transition: left 0.3s ease;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    }

    .sidebar.sidebar-open {
        left: 0;
    }

    .site-header {
        padding: 15px 20px;
    }

    .site-logo h1 {
        font-size: 22px;
    }

    .site-header .site-subtitle {
        font-size: 12px;
        padding-left: 34px;
    }

    .logo-text .site-subtitle {
        padding-left: 0;
    }

    .content-wrapper {
        padding: 20px 10px;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    .breadcrumb {
        padding: 12px 10px;
    }

    .article-title {
        font-size: 28px;
    }

    .article-featured-image {
        float: none !important;
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 0 0 20px 0 !important;
        display: block !important;
    }

    .article-content {
        font-size: 15px;
    }

    .article-content h2 {
        font-size: 22px;
        margin-top: 30px;
    }

    .article-content h3 {
        font-size: 18px;
        margin-top: 25px;
    }

    .article-content pre {
        font-size: 13px;
        padding: 15px;
        overflow-x: auto;
        max-width: calc(100vw - 40px);
        width: 100%;
        box-sizing: border-box;
    }

    .article-content img,
    .article-content .featured-image img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 15px 0;
        float: none !important;
    }

    .article-content .featured-image {
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 20px 0 !important;
    }

    .article-content table {
        font-size: 13px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .warning-box,
    .tip-box,
    .info-box,
    .danger-box,
    .article-content .warning-box,
    .article-content .tip-box,
    .article-content .info-box,
    .article-content .danger-box {
        padding: 15px;
        font-size: 14px;
        margin: 20px 0;
    }

    .blog-card {
        flex-direction: column;
    }

    .blog-card-image {
        width: 100%;
        min-width: 100%;
        height: 180px;
    }
}
