/* ============================================
   Portail de l'E.I. — Dark Theme
   Reproduction du layout Portail de l'IE
   ============================================ */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --border: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #999999;
    --text-muted: #666666;
    --accent: #c0392b;
    --accent-hover: #e74c3c;
    --white: #ffffff;
    --max-width: 1140px;
    --header-height: 70px;
    --font-body: 'Open Sans', sans-serif;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

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

/* ============================================
   HEADER — sticky, 4-zone layout
   ============================================ */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 20px;
}

.header-logo a {
    display: flex;
    align-items: center;
}

.header-logo img {
    height: 50px;
    width: auto;
}

/* Navigation */

.header-nav {
    flex: 1;
    display: flex;
    align-items: center;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 0;
    flex-wrap: wrap;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    display: block;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
}

.nav-menu > li > a:hover,
.nav-menu > li.active > a {
    color: var(--accent);
}

/* Dropdown */

.sub-menu {
    list-style: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.25s ease;
    z-index: 1001;
}

.has-submenu:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.sub-menu li a {
    display: block;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s, color 0.2s;
}

.sub-menu li:last-child a {
    border-bottom: none;
}

.sub-menu li a:hover {
    background: var(--bg-card);
    color: var(--accent);
}

/* Burger toggle */

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: transform 0.3s, opacity 0.3s;
}

/* Header actions (search) */

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.search-toggle:hover {
    color: var(--accent);
}

.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 90%;
    max-width: 600px;
}

.search-overlay-inner input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--accent);
    color: var(--white);
    font-size: 24px;
    font-family: var(--font-body);
    padding: 12px 0;
    outline: none;
}

.search-overlay-inner input::placeholder {
    color: var(--text-muted);
}

.search-overlay-inner button {
    background: none;
    border: none;
    color: var(--white);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
}

.search-close {
    font-size: 28px !important;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.site-main {
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height) - 200px);
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   SECTION — Featured articles (3-column cards)
   ============================================ */

.section-featured {
    padding: 40px 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    align-items: start;
}

/* Keep featured card thumbnails shorter so title/date are visible immediately. */
.section-featured .card-thumbnail {
    aspect-ratio: 16/8;
}

.section-featured .card-body {
    padding: 12px 16px 14px;
}

.card {
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.card-thumbnail {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
    background: var(--bg-secondary);
    display: block;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.card:hover .card-thumbnail img {
    transform: scale(1.05);
}

.card-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    background: var(--accent);
    color: var(--white);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
}

.card-body {
    padding: 20px;
}

.card-body h3 {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
}

.card-body h3 a {
    color: var(--text-primary);
}

.card-body h3 a:hover {
    color: var(--accent);
}

.card-date {
    font-size: 12px;
    color: var(--text-muted);
}

.featured-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 16px 12px;
    color: var(--white);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.45) 60%, rgba(0,0,0,0) 100%);
}

.featured-title:hover {
    color: var(--white);
}

/* ============================================
   SECTION — Recent articles (list, thumb left)
   ============================================ */

.section-recent {
    padding: 50px 0;
    background: var(--bg-secondary);
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 30px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--accent);
    display: inline-block;
}

.article-list {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.article-list-item {
    display: flex;
    gap: 24px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.article-list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.article-list-thumb {
    flex-shrink: 0;
    width: 200px;
    aspect-ratio: 16/10;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-card);
}

.article-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.article-list-item:hover .article-list-thumb img {
    transform: scale(1.05);
}

.article-list-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.article-list-content h3 {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
}

.article-list-content h3 a {
    color: var(--text-primary);
}

.article-list-content h3 a:hover {
    color: var(--accent);
}

.article-list-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.article-list-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.read-more:hover {
    color: var(--accent-hover);
}

.btn-more {
    display: inline-block;
    margin-top: 30px;
    padding: 10px 28px;
    background: var(--accent);
    color: var(--white);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    transition: background 0.2s, transform 0.2s;
}

.btn-more:hover {
    background: var(--accent-hover);
    color: var(--white);
    transform: scale(0.97);
}

/* ============================================
   SECTION — Category tiles (CTA cover)
   ============================================ */

.section-categories {
    padding: 50px 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.category-tile {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 180px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-card);
    transition: transform 0.3s;
}

.category-tile:hover {
    transform: scale(1.02);
}

.category-tile-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s;
}

.category-tile:hover .category-tile-bg {
    transform: scale(1.08);
}

.category-tile::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 100%);
}

.category-tile-title {
    position: relative;
    z-index: 1;
    padding: 20px;
    font-size: 15px;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   ARTICLE PAGE
   ============================================ */

.article-hero {
    position: relative;
    width: 100%;
    min-height: 350px;
    display: flex;
    align-items: flex-end;
    background-color: var(--bg-secondary);
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.article-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.3) 60%, rgba(0,0,0,0.1) 100%);
}

.article-hero-content {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 60px 20px 40px;
    width: 100%;
}

.article-hero h1 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--white);
    max-width: 800px;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-meta a {
    color: var(--text-secondary);
}

.article-meta a:hover {
    color: var(--accent);
}

.article-content-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.article-share {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--white);
    font-size: 14px;
    transition: transform 0.2s;
}

.share-btn:hover {
    transform: scale(1.1);
    color: var(--white);
}

.share-btn.facebook { background: #3b5998; }
.share-btn.twitter { background: #1da1f2; }
.share-btn.linkedin { background: #0077b5; }
.share-btn.print { background: var(--text-muted); }

.article-body {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    text-align: justify;
}

.article-body p {
    margin-bottom: 1.2em;
}

.article-body h2 {
    font-size: 22px;
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 0.8em;
    color: var(--white);
}

.article-body h3 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.6em;
    color: var(--white);
}

.article-body img {
    border-radius: 4px;
    margin: 1.5em 0;
}

.article-body blockquote {
    border-left: 4px solid var(--accent);
    padding: 12px 20px;
    margin: 1.5em 0;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-style: italic;
}

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

.article-body li {
    margin-bottom: 0.4em;
}

.article-body a {
    color: var(--accent);
    text-decoration: underline;
}

.article-body strong {
    color: var(--white);
}

/* ============================================
   CATEGORY PAGE
   ============================================ */

.page-header {
    padding: 40px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
}

.page-header .subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    padding-bottom: 60px;
}

/* Archive cards (category pages) */
.card-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 6px 0 0 0;
}

/* ============================================
   SEARCH RESULTS
   ============================================ */

.search-results {
    padding: 40px 0 60px;
}

.search-results h1 {
    font-size: 22px;
    margin-bottom: 30px;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 40px 0;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.pagination a {
    background: var(--bg-card);
    color: var(--text-primary);
}

.pagination a:hover {
    background: var(--accent);
    color: var(--white);
}

.pagination .current {
    background: var(--accent);
    color: var(--white);
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 40px 0;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-tagline {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.footer-copy {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.footer-social {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 15px;
    transition: background 0.2s, transform 0.2s;
}

.footer-social a:hover {
    background: var(--accent);
    color: var(--white);
    transform: scale(1.1);
}

/* ============================================
   ADMIN
   ============================================ */

.admin-body {
    background: var(--bg-primary);
}

.admin-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.admin-header a {
    color: var(--text-secondary);
    font-size: 13px;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 24px;
}

.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--white);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: #7d1a1a;
    color: var(--white);
}

.btn-danger:hover {
    background: #a02020;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
    color: var(--text-muted);
}

.admin-table td a {
    color: var(--text-primary);
}

.admin-table td a:hover {
    color: var(--accent);
}

.admin-table .actions {
    display: flex;
    gap: 8px;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge.published {
    background: #1a3a1a;
    color: #4caf50;
}

.status-badge.draft {
    background: #3a3a1a;
    color: #ffc107;
}

/* Admin editor form */

.editor-form {
    background: var(--bg-card);
    border-radius: 4px;
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Login page */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 24px;
}

.login-box .form-group {
    margin-bottom: 16px;
}

.login-box .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 14px;
}

.flash-message {
    padding: 10px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 13px;
}

.flash-message.error {
    background: #3a1a1a;
    color: #ef5350;
    border: 1px solid #5a2020;
}

.flash-message.success {
    background: #1a3a1a;
    color: #4caf50;
    border: 1px solid #2a5a2a;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-secondary);
        flex-direction: column;
        padding: 20px;
        overflow-y: auto;
        z-index: 999;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu > li > a {
        padding: 12px 0;
        font-size: 14px;
        border-bottom: 1px solid var(--border);
    }

    .sub-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding-left: 16px;
        background: transparent;
    }

    .sub-menu li a {
        border-bottom: none;
        padding: 8px 0;
        font-size: 13px;
        color: var(--text-secondary);
    }

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

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

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

    .article-list-item {
        flex-direction: column;
    }

    .article-list-thumb {
        width: 100%;
    }

    .article-hero h1 {
        font-size: 24px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}
