/* =========================================================
   LUMALIA — actualites.css
   ========================================================= */

.news-page {
  padding: 3rem 0 6rem;
}

.news-page__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.news-page__header h1 {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}
.news-page__header p {
  font-size: 1rem;
  color: var(--text-soft);
}

.news-page__create-btn {
  display: none;
  align-items: center;
  gap: 0.5rem;
}
.news-page__create-btn.visible {
  display: inline-flex;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.news-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  overflow: hidden;
  transition: transform var(--t-base), border-color var(--t-base), box-shadow var(--t-base);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
.news-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.news-card__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--accent-soft), transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.news-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.news-card__cover-placeholder {
  font-family: var(--font-title);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.4;
}

.news-card__badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
.news-card__badge--draft {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border-color: transparent;
}

.news-card__body {
  padding: 1.25rem 1.5rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-card__meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-label);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.news-card h3 {
  font-family: var(--font-subtitle);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.news-card__excerpt {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  margin-bottom: 1rem;
  flex: 1;
}

.news-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.news-card__author {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.news-card__author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #b39bff);
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.7rem;
}

.news-article {
  max-width: 820px;
  margin: 0 auto;
}
.news-article__back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 2rem;
  transition: color var(--t-fast);
}
.news-article__back:hover {
  color: var(--accent);
}
.news-article__header {
  margin-bottom: 2.5rem;
}
.news-article__header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: 1rem;
  line-height: 1.2;
}
.news-article__meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.news-article__cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2.5rem;
  border: 1px solid var(--border);
}
.news-article__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.news-article__iframe {
  width: 100%;
  border: none;
  display: block;
  min-height: 200px;
  background: transparent;
}
.news-article__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.news-article__actions .btn {
  display: none;
}
.news-article__actions.can-edit .btn {
  display: inline-flex;
}

/* ---------- MODAL ÉDITEUR (caché par défaut) ---------- */
.news-editor-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(11, 13, 18, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
}
.news-editor-modal.open {
  display: flex !important;
}

.news-editor-modal .modal__dialog {
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  margin: auto;
  position: relative;
}

.news-editor__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.news-editor__field label {
  font-family: var(--font-label);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}
.news-editor__field input,
.news-editor__field textarea {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
}
.news-editor__field textarea {
  resize: vertical;
}
.news-editor__field input:focus,
.news-editor__field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.news-editor__field small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Contenu : au moins 15 lignes */
.news-editor__content {
  min-height: 380px !important;
  font-family: "Geist Mono", ui-monospace, monospace !important;
  font-size: 0.85rem !important;
  line-height: 1.6 !important;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

.news-editor__preview {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.news-editor__preview-label {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.news-editor__preview-body {
  padding: 1rem;
  background: var(--bg);
  max-height: 300px;
  overflow-y: auto;
}

.news-editor__switch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-soft);
  user-select: none;
  margin-bottom: 1rem;
}
.news-editor__switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background var(--t-fast);
  flex-shrink: 0;
}
.news-editor__switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--t-fast);
}
.news-editor__switch input:checked {
  background: var(--accent);
}
.news-editor__switch input:checked::after {
  transform: translateX(16px);
}

.news-empty {
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}
.news-empty svg {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  opacity: 0.4;
}
.news-empty p {
  font-size: 1rem;
}

.news-loading {
  padding: 4rem;
  text-align: center;
  color: var(--text-muted);
}

/* Sécurité : texte dans contenu */
.news-editor__field small {
  line-height: 1.5;
}

@media (max-width: 640px) {
  .news-page { padding: 2rem 0 4rem; }
  .news-page__header { flex-direction: column; align-items: flex-start; }
  .news-grid { grid-template-columns: 1fr; }
}
