/* ===========================
   RESET & BASE
=========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black: #0a0a0a;
  --grey-900: #111;
  --grey-800: #1a1a1a;
  --grey-600: #555;
  --grey-400: #999;
  --grey-200: #e8e8e8;
  --grey-100: #f5f5f5;
  --white: #fff;
  --accent: #0a0a0a;
  --radius: 2px;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-sans);
  color: var(--grey-900);
  background: var(--white);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ===========================
   LAYOUT
=========================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container--narrow {
  max-width: 720px;
}

/* ===========================
   HEADER
=========================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--grey-200);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 60px;
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }

.nav-link {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--grey-600);
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--black); background: var(--grey-100); }

.search-form input {
  width: 180px;
  padding: 7px 12px;
  border: 1px solid var(--grey-200);
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--grey-100);
  outline: none;
  transition: border-color 0.15s, width 0.2s;
}
.search-form input:focus { border-color: var(--grey-400); width: 220px; background: var(--white); }

/* ===========================
   MAIN
=========================== */
.main-content { min-height: calc(100vh - 60px - 80px); }

/* ===========================
   FEATURED
=========================== */
.featured-section {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--grey-200);
}

.featured-card {
  display: block;
  max-width: 800px;
}
.featured-card:hover .featured-title { opacity: 0.7; }

.featured-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.featured-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  transition: opacity 0.15s;
}

.featured-excerpt {
  font-size: 1.1rem;
  color: var(--grey-600);
  margin-bottom: 16px;
  max-width: 600px;
  line-height: 1.6;
}

.featured-date { font-size: 0.85rem; color: var(--grey-400); }

/* ===========================
   ARTICLES GRID
=========================== */
.articles-section { padding: 48px 0; }

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1px;
  background: var(--grey-200);
  border: 1px solid var(--grey-200);
}

.articles-grid--3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.article-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px;
  background: var(--white);
  transition: background 0.15s;
}
.article-card:hover { background: var(--grey-100); }

.article-card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.article-card-excerpt {
  font-size: 0.9rem;
  color: var(--grey-600);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card-meta {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--grey-400);
  margin-top: 4px;
}

/* ===========================
   CATEGORY BADGE
=========================== */
.category-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-600);
  border: 1px solid var(--grey-200);
  padding: 2px 8px;
  border-radius: 20px;
}

.reading-time { font-size: 0.78rem; color: var(--grey-400); }

/* ===========================
   PAGE HEADER
=========================== */
.page-header { padding: 48px 0 32px; border-bottom: 1px solid var(--grey-200); margin-bottom: 40px; }
.page-title { font-family: var(--font-serif); font-size: 2.5rem; letter-spacing: -0.02em; }
.page-subtitle { color: var(--grey-400); margin-top: 6px; font-size: 0.9rem; }

/* ===========================
   ARTICLE FULL
=========================== */
.article-full { padding: 60px 0 48px; }

.article-header { margin-bottom: 48px; }

.article-header .category-badge { margin-bottom: 16px; }

.article-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.article-lead {
  font-size: 1.15rem;
  color: var(--grey-600);
  line-height: 1.6;
  margin-bottom: 20px;
}

.article-meta {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--grey-400);
  padding-top: 20px;
  border-top: 1px solid var(--grey-200);
}

.article-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--grey-800);
}

.article-body h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  margin: 40px 0 16px;
  letter-spacing: -0.01em;
}

.article-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 32px 0 12px;
}

.article-body p { margin-bottom: 24px; }

.article-body blockquote {
  border-left: 3px solid var(--black);
  margin: 32px 0;
  padding: 4px 0 4px 24px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--grey-600);
}

.article-body ul, .article-body ol { margin: 0 0 24px 24px; }
.article-body li { margin-bottom: 6px; }

.article-body code {
  background: var(--grey-100);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: 'Fira Code', 'Courier New', monospace;
}

.article-body pre {
  background: var(--grey-900);
  color: var(--grey-100);
  padding: 20px 24px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 24px 0;
}

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

/* ===========================
   RELATED
=========================== */
.related-section {
  padding: 48px 0;
  border-top: 1px solid var(--grey-200);
}

.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-400);
  margin-bottom: 24px;
}

/* ===========================
   COMMENTS
=========================== */
.comments-section {
  padding: 48px 0 64px;
  border-top: 1px solid var(--grey-200);
}

.comments-list { margin: 24px 0 40px; display: flex; flex-direction: column; gap: 24px; }

.comment {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--grey-200);
}

.comment:last-child { border-bottom: none; }

.comment-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.comment-author { font-weight: 500; font-size: 0.95rem; }
.comment-date { font-size: 0.8rem; color: var(--grey-400); }
.comment-content { font-size: 0.95rem; line-height: 1.6; color: var(--grey-800); }

.comment-form-wrap { margin-top: 8px; }
.comment-form-title { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
}

.comment-form input:focus,
.comment-form textarea:focus { border-color: var(--grey-600); }

.comment-notice { font-size: 0.8rem; color: var(--grey-400); margin-top: 8px; }

/* ===========================
   BUTTONS
=========================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  background: var(--black);
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--black);
  border-radius: var(--radius);
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.8; }
.btn--full { width: 100%; }
.btn--ghost { background: transparent; color: var(--grey-600); border-color: var(--grey-200); }
.btn--ghost:hover { background: var(--grey-100); opacity: 1; }

/* ===========================
   FOOTER
=========================== */
.site-footer {
  border-top: 1px solid var(--grey-200);
  padding: 24px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-logo { font-size: 1.1rem; }

.footer-nav { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; }
.footer-nav a { font-size: 0.8rem; color: var(--grey-400); }
.footer-nav a:hover { color: var(--black); }

.footer-copy { font-size: 0.8rem; color: var(--grey-400); }

/* ===========================
   404
=========================== */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  gap: 16px;
}

.error-code { font-family: var(--font-serif); font-size: 8rem; line-height: 1; color: var(--grey-200); }
.error-message { font-size: 1.1rem; color: var(--grey-600); }

/* ===========================
   EMPTY STATE
=========================== */
.empty-state { color: var(--grey-400); text-align: center; padding: 60px 0; font-size: 0.95rem; }
.empty-state a { color: var(--black); text-decoration: underline; }

/* ===========================
   ADMIN — GENERAL
=========================== */
.admin-body { background: var(--grey-100); }

.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--grey-200);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-logo { font-size: 1.2rem; margin-bottom: 32px; display: block; }

.admin-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.admin-nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--grey-600);
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-nav-link:hover, .admin-nav-link.active { background: var(--grey-100); color: var(--black); }
.admin-nav-link--new { margin-top: 8px; color: var(--black); font-weight: 600; }

.badge {
  background: var(--black);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
}

.logout-form { margin-top: auto; padding-top: 16px; }
.logout-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  color: var(--grey-400);
  padding: 6px 12px;
  width: 100%;
  text-align: left;
  border-radius: var(--radius);
}
.logout-btn:hover { color: var(--black); background: var(--grey-100); }

.admin-main { flex: 1; padding: 32px 40px; max-width: 1000px; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.admin-title { font-family: var(--font-serif); font-size: 1.6rem; }

/* ===========================
   ADMIN — TABLE
=========================== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  overflow: hidden;
  font-size: 0.875rem;
}

.admin-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--grey-400);
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-200);
  background: var(--grey-100);
}

.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--grey-200); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--grey-100); }

.td-title a:hover { text-decoration: underline; }

.td-actions { display: flex; gap: 8px; align-items: center; }

.action-link {
  background: none;
  border: none;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--grey-600);
  text-decoration: underline;
  padding: 0;
  cursor: pointer;
}
.action-link:hover { color: var(--black); }
.action-link--danger:hover { color: #c00; }

.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.04em;
}
.status-badge--published { background: #e8f5e9; color: #2e7d32; }
.status-badge--draft { background: var(--grey-200); color: var(--grey-600); }

/* ===========================
   ADMIN — EDITOR
=========================== */
.editor-form {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 24px;
  align-items: start;
}

.input-title {
  width: 100%;
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  border: none;
  border-bottom: 2px solid var(--grey-200);
  padding: 8px 0;
  outline: none;
  background: transparent;
  transition: border-color 0.15s;
}
.input-title:focus { border-color: var(--black); }

.input-excerpt {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--grey-200);
  padding: 10px 14px;
  border-radius: var(--radius);
  resize: vertical;
  outline: none;
  min-height: 72px;
  transition: border-color 0.15s;
}
.input-excerpt:focus { border-color: var(--grey-600); }

.editor-wrap { margin-top: 16px; }

.ql-container { font-family: var(--font-sans) !important; font-size: 1rem !important; min-height: 400px; }
.ql-editor { min-height: 400px; line-height: 1.7; }

.editor-panel {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  padding: 20px;
}

.panel-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-400);
  margin-bottom: 16px;
}

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 500; margin-bottom: 6px; color: var(--grey-600); }
.form-group--checkbox label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.input-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--white);
  outline: none;
  cursor: pointer;
}
.input-select:focus { border-color: var(--grey-600); }

/* ===========================
   ADMIN — COMMENTS
=========================== */
.comments-admin-list { display: flex; flex-direction: column; gap: 16px; }

.comment-admin-card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  padding: 16px 20px;
}

.comment-admin-card--pending { border-left: 3px solid var(--black); }

.comment-admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.comment-on { font-size: 0.8rem; color: var(--grey-400); margin-left: 8px; }
.comment-on a:hover { text-decoration: underline; }

.comment-admin-content { font-size: 0.9rem; color: var(--grey-800); line-height: 1.5; margin-bottom: 12px; }

.comment-admin-actions { display: flex; gap: 12px; }

/* ===========================
   ADMIN — LOGIN
=========================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  padding: 40px;
}

.login-logo { display: block; margin-bottom: 32px; }
.login-title { font-family: var(--font-serif); font-size: 1.5rem; margin-bottom: 24px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-form input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
.login-form input:focus { border-color: var(--grey-600); }

/* ===========================
   ALERTS
=========================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 20px;
}
.alert--error { background: #ffeaea; color: #c00; border: 1px solid #fcc; }

/* ===========================
   CATEGORY GRADIENTS (fallback images)
=========================== */
.cat-bg--technologie    { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }
.cat-bg--développement  { background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #1f6feb 100%); }
.cat-bg--science        { background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #533483 100%); }
.cat-bg--sport          { background: linear-gradient(135deg, #1a0a00 0%, #3d1a00 50%, #8b4513 100%); }
.cat-bg--nourriture     { background: linear-gradient(135deg, #0a1a0a 0%, #1a3a1a 50%, #2d6a2d 100%); }
.cat-bg--politique      { background: linear-gradient(135deg, #1a0a0a 0%, #3a0a0a 50%, #8b1a1a 100%); }

/* ===========================
   FEATURED WITH IMAGE
=========================== */
.featured-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.featured-image {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 4px;
  overflow: hidden;
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.featured-card:hover .featured-image img { transform: scale(1.03); }

.featured-image--placeholder {
  min-height: 260px;
}

.featured-body { display: flex; flex-direction: column; gap: 12px; }

/* ===========================
   ARTICLE CARD THUMBNAIL
=========================== */
.article-card {
  display: flex;
  flex-direction: column;
}

.article-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  flex-shrink: 0;
}

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

.article-card:hover .article-card-thumb img { transform: scale(1.04); }

.article-card-thumb--placeholder {
  min-height: 160px;
}

.article-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  flex: 1;
}

/* Override anciens styles de padding direct sur .article-card */
.article-card { padding: 0; gap: 0; }

/* ===========================
   ARTICLE HERO IMAGE
=========================== */
.article-hero {
  width: 100%;
  max-height: 480px;
  overflow: hidden;
  margin-bottom: 0;
}

.article-hero img {
  width: 100%;
  height: 100%;
  max-height: 480px;
  object-fit: cover;
  display: block;
}

.article-hero--placeholder {
  height: 200px;
}

/* ===========================
   IMAGE UPLOAD ADMIN
=========================== */
.image-preview {
  margin-bottom: 12px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--grey-200);
}

.image-preview img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.image-remove-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #c00;
  cursor: pointer;
  background: var(--grey-100);
}

.image-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--grey-400);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--grey-600);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.image-upload-label:hover { border-color: var(--black); color: var(--black); }

.image-hint { font-size: 0.75rem; color: var(--grey-400); margin-top: 6px; text-align: center; }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .editor-form { grid-template-columns: 1fr; }
  .editor-sidebar { position: static; }
  .admin-sidebar { width: 180px; }
  .admin-main { padding: 24px 20px; }
  .featured-card { grid-template-columns: 1fr; gap: 24px; }
  .featured-image { aspect-ratio: 16/9; min-height: unset; }
}

@media (max-width: 640px) {
  .header-inner { gap: 16px; }
  .search-form input { width: 120px; }
  .featured-title { font-size: 1.8rem; }
  .articles-grid { grid-template-columns: 1fr; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; padding: 16px; }
  .admin-nav { flex-direction: row; }
}
