/* ===== VARIABLES ===== */
:root {
    --primary: #6c63ff;
    --primary-dark: #4f46e5;
    --accent: #ff6584;
    --accent2: #43b89c;
    --dark: #0f0e17;
    --dark2: #1a1a2e;
    --surface: #16213e;
    --surface2: #1e2a45;
    --text: #fffffe;
    --text-muted: #a7a9be;
    --border: rgba(255,255,255,0.08);
    --radius: 12px;
    --radius-lg: 20px;
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--dark);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}
h1 { font-size: clamp(1.7rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.3rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.05rem, 2vw, 1.5rem); }

/* ===== LAYOUT ===== */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.container--narrow { max-width: 760px; }

@media (min-width: 768px) {
    .container { padding: 0 1.5rem; }
}

/* ===== HEADER & NAV ===== */
.site-header {
    position: relative;
    z-index: 100;
    background: rgba(15,14,23,0.95);
    border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
    .site-header {
        position: sticky;
        top: 0;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        background: rgba(15,14,23,0.85);
    }
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

@media (min-width: 768px) {
    .nav-inner { height: 68px; }
}

.nav-logo {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mobile : liens cachés par défaut */
.nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0; right: 0;
    background: var(--dark);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1rem 1.5rem;
    gap: 0;
    list-style: none;
}
.nav-links.open { display: flex; }
.nav-links li a { display: block; padding: 0.75rem 0; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }
.nav-links li:last-child a { border-bottom: none; }

/* Mobile : hamburger visible */
.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-toggle span {
    width: 24px; height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* Desktop : liens visibles, hamburger caché */
@media (min-width: 768px) {
    .nav-links {
        display: flex;
        position: static;
        flex-direction: row;
        gap: 2rem;
        padding: 0;
        background: transparent;
        border: none;
    }
    .nav-links li a {
        display: inline;
        padding: 0;
        padding-bottom: 2px;
        border: none;
        position: relative;
    }
    .nav-links a::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0; right: 0;
        height: 2px;
        background: var(--primary);
        transform: scaleX(0);
        transition: transform var(--transition);
        border-radius: 2px;
    }
    .nav-links a:hover,
    .nav-links a.active { color: var(--text); }
    .nav-links a:hover::after,
    .nav-links a.active::after { transform: scaleX(1); }
    .nav-toggle { display: none; }
    .nav-links { top: 68px; }
}

/* Séparateur flex dans la nav — pousse les liens auth à droite sur desktop */
.nav-spacer { display: none; }

@media (min-width: 768px) {
    .nav-spacer { display: block; flex-grow: 1; }
}

/* Lien "Connexion" dans la nav */
.nav-user-link { color: var(--text-muted) !important; }
.nav-user-link:hover { color: var(--text) !important; }

/* Bouton S'inscrire dans la nav */
.nav-register {
    padding: 0.4rem 0.9rem !important;
    font-size: 0.82rem !important;
}

/* Sur mobile, les boutons auth s'affichent comme les autres liens */
@media (max-width: 767px) {
    .nav-register {
        display: inline-flex !important;
        margin-top: 0.5rem;
        align-self: flex-start;
    }
}

/* ===== HERO ===== */
.hero {
    padding: 2.5rem 0 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(108,99,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

@media (min-width: 768px) {
    .hero { padding: 5rem 0 4rem; }
}

.hero-badge {
    display: inline-block;
    background: rgba(108,99,255,0.15);
    color: var(--primary);
    border: 1px solid rgba(108,99,255,0.3);
    border-radius: 50px;
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.hero-title { margin-bottom: 1rem; }
.hero-title span {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 520px;
    margin: 0 auto 2rem;
}

@media (min-width: 768px) {
    .hero-subtitle { font-size: 1.15rem; margin-bottom: 2.5rem; }
}

/* ===== CARDS ===== */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 2rem 0;
}

@media (min-width: 480px) {
    .cards-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(108,99,255,0.2);
    border-color: rgba(108,99,255,0.3);
}
.card-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--surface2);
}
.card-img-placeholder {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, var(--surface2), var(--dark2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

@media (min-width: 768px) {
    .card-img, .card-img-placeholder { height: 200px; }
}

.card-body { padding: 1.25rem; }

@media (min-width: 768px) {
    .card-body { padding: 1.5rem; }
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.card-category {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(108,99,255,0.15);
    color: var(--primary);
    border: 1px solid rgba(108,99,255,0.25);
}
.card h3 { margin-bottom: 0.5rem; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--primary); }
.card-excerpt { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.25rem; }
.card-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: gap var(--transition);
}
.card-link:hover { gap: 0.7rem; color: var(--primary); }

/* ===== FEATURED ARTICLE ===== */
.featured {
    background: linear-gradient(135deg, var(--surface), var(--surface2));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
    margin: 2rem 0;
}
.featured-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}
.featured-img-placeholder {
    background: linear-gradient(135deg, rgba(108,99,255,0.2), rgba(255,101,132,0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    height: 220px;
}
.featured-body {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (min-width: 900px) {
    .featured {
        grid-template-columns: 1fr 1fr;
        min-height: 340px;
    }
    .featured-img { height: 100%; min-height: 280px; }
    .featured-img-placeholder { height: 100%; min-height: 280px; font-size: 5rem; }
    .featured-body { padding: 2.5rem; }
}

.featured-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 1rem;
}
.featured-body h2 { margin-bottom: 1rem; }
.featured-body h2 a { color: var(--text); }
.featured-body h2 a:hover { color: var(--primary); }
.featured-excerpt { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 20px rgba(108,99,255,0.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(108,99,255,0.5);
    color: #fff;
}
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 0.4rem 1rem; font-size: 0.82rem; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }

/* ===== SECTION TITLES ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    position: relative;
    padding-left: 1rem;
}
.section-title::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 1.2em;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
    border-radius: 4px;
}

/* ===== ARTICLE PAGE ===== */
.article-header {
    padding: 2rem 0 1.5rem;
    text-align: center;
}
.article-header h1 { margin: 1rem 0; }

@media (min-width: 768px) {
    .article-header { padding: 3rem 0 2rem; }
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-wrap: wrap;
}
.article-cover {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .article-cover { height: 340px; }
}

@media (min-width: 1024px) {
    .article-cover { height: 420px; }
}

.article-content {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.85;
}

@media (min-width: 768px) {
    .article-content { font-size: 1.05rem; }
}

.article-content h2, .article-content h3 { color: var(--text); margin: 2rem 0 1rem; }
.article-content p { margin-bottom: 1.5rem; }
.article-content img { border-radius: var(--radius); margin: 1.5rem 0; }
.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 2rem 0;
    color: var(--text);
    font-style: italic;
}

/* ===== GALERIE ===== */
.galerie-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 2rem 0;
}

@media (min-width: 480px) {
    .galerie-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
}

@media (min-width: 768px) {
    .galerie-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

.galerie-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    background: var(--surface);
}
.galerie-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.galerie-item:hover img { transform: scale(1.05); }
.galerie-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}
.galerie-item:hover .galerie-overlay { opacity: 1; }
.galerie-overlay span { color: #fff; font-size: 0.9rem; font-weight: 600; }

/* ===== LIGHTBOX ===== */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.92);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}
.lightbox.active { display: flex; }
.lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: var(--radius);
    object-fit: contain;
}
.lightbox-close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 44px; height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

@media (min-width: 768px) {
    .lightbox-close { top: 1.5rem; right: 1.5rem; }
}

/* ===== CATEGORIES ===== */
.categories-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1.25rem 0;
}

@media (min-width: 768px) {
    .categories-bar { gap: 0.75rem; margin: 1.5rem 0; }
}

.cat-pill {
    padding: 0.4rem 0.9rem;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all var(--transition);
}

@media (min-width: 768px) {
    .cat-pill { padding: 0.45rem 1.1rem; font-size: 0.85rem; }
}

.cat-pill:hover, .cat-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== FOOTER ===== */
.site-footer {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

@media (min-width: 768px) {
    .site-footer { margin-top: 5rem; padding: 2.5rem 0; }
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--primary); }

/* ===== ADMIN ===== */
.admin-layout { display: flex; flex-direction: column; min-height: 100vh; }
.admin-sidebar {
    width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
}

@media (min-width: 768px) {
    .admin-layout { flex-direction: row; }
    .admin-sidebar {
        width: 240px;
        border-bottom: none;
        border-right: 1px solid var(--border);
        padding: 2rem 1rem;
        flex-shrink: 0;
    }
}

.admin-sidebar .logo {
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
    padding: 0 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

@media (min-width: 768px) {
    .admin-sidebar .logo { margin-bottom: 2rem; }
}

.admin-nav { list-style: none; display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }

@media (min-width: 768px) {
    .admin-nav { flex-direction: column; gap: 0.25rem; }
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition);
}

@media (min-width: 768px) {
    .admin-nav a { padding: 0.7rem 0.75rem; font-size: 0.92rem; }
}

.admin-nav a:hover, .admin-nav a.active {
    background: rgba(108,99,255,0.12);
    color: var(--text);
}
.admin-nav a.active { color: var(--primary); }
.admin-main { flex: 1; padding: 1.25rem 1rem; overflow: auto; }

@media (min-width: 768px) {
    .admin-main { padding: 2.5rem; }
}

.admin-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .admin-header { align-items: center; margin-bottom: 2rem; gap: 0; }
}

.admin-header h1 { font-size: 1.4rem; }

@media (min-width: 768px) {
    .admin-header h1 { font-size: 1.6rem; }
}

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 0.75rem 0.75rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    vertical-align: middle;
}

@media (min-width: 768px) {
    th { padding: 0.85rem 1rem; font-size: 0.82rem; }
    td { padding: 1rem; font-size: 0.9rem; }
}

tr:hover td { background: rgba(255,255,255,0.02); }

/* Forms */
.form-group { margin-bottom: 1.25rem; }

@media (min-width: 768px) {
    .form-group { margin-bottom: 1.5rem; }
}

label { display: block; margin-bottom: 0.4rem; font-size: 0.88rem; font-weight: 600; color: var(--text-muted); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
textarea,
select {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition);
    outline: none;
}
/* Champ date */
input[type="date"] {
    color-scheme: dark;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem 0.85rem 2.6rem;
    min-height: 52px;
    -webkit-appearance: none;
    appearance: none;
}
input[type="date"]::-webkit-datetime-edit { color: var(--text); }
input[type="date"]::-webkit-datetime-edit-fields-wrapper { color: var(--text); }
input[type="date"]::-webkit-datetime-edit-text { color: var(--text-muted); }
input[type="date"]::-webkit-inner-spin-button { display: none; }
input[type="date"]::-webkit-calendar-picker-indicator {
    background: transparent;
    color: transparent;
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}
textarea { resize: vertical; min-height: 160px; }

@media (min-width: 768px) {
    textarea { min-height: 180px; }
}

select option { background: var(--dark2); }

/* Alerts */
.alert {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.alert-success { background: rgba(67,184,156,0.15); color: var(--accent2); border: 1px solid rgba(67,184,156,0.3); }
.alert-error { background: rgba(231,76,60,0.15); color: #e74c3c; border: 1px solid rgba(231,76,60,0.3); }

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 480px) {
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (min-width: 768px) {
    .stats-grid { gap: 1.25rem; margin-bottom: 2.5rem; }
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

@media (min-width: 768px) {
    .stat-card { padding: 1.5rem; }
}

.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 0.4rem; }

@media (min-width: 768px) {
    .stat-value { font-size: 2.5rem; }
}

.stat-label { color: var(--text-muted); font-size: 0.85rem; }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark);
    padding: 1.5rem;
}
.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

@media (min-width: 480px) {
    .login-box { padding: 2.5rem; }
}

.login-box h1 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.6rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Badge statut */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-green { background: rgba(67,184,156,0.15); color: var(--accent2); }
.badge-red { background: rgba(231,76,60,0.15); color: #e74c3c; }
