/* DIVA Energie brand font (self-hosted Poppins, latin subset) */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/poppins/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/poppins/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/poppins/poppins-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/poppins/poppins-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #018749;       /* DIVA green */
  --primary-dark: #0f5a2e;  /* darker green for headers/hover */
  --primary-text: #ffffff;
  --success: #065f46;
  --success-bg: #d1fae5;
  --error: #991b1b;
  --error-bg: #fee2e2;
  --warn: #f59e0b;
  --warn-text: #b45309;
  --cta: #FFBC00;
  --cta-text: #1f2937;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --radius: 8px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Poppins', -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* App shell: sidebar + content */
.app { display: flex; min-height: 100vh; }
.app__content { flex: 1; min-width: 0; }

.sidebar {
  width: 230px; flex: none; background: var(--primary-dark); color: #fff;
  display: flex; flex-direction: column; min-height: 100vh;
  position: sticky; top: 0; align-self: flex-start; max-height: 100vh; overflow-y: auto;
}
/* Logo lettering is white in the PNG — needs a dark backdrop, not a white card */
.sidebar__brand { display: block; background: rgba(255,255,255,.07); border-radius: var(--radius); margin: 12px; padding: 10px 14px; }
.sidebar__brand img { width: 100%; height: auto; display: block; }
.sidebar__nav { flex: 1; padding-bottom: 12px; }
.sidebar__section {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.55); font-weight: 600; padding: 16px 16px 6px;
}
.sidebar__item {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px;
  color: rgba(255,255,255,.88); font-weight: 500; font-size: .9rem; cursor: pointer;
  border-left: 3px solid transparent; transition: background .15s ease, color .15s ease;
}
.sidebar__item i { width: 18px; text-align: center; color: rgba(255,255,255,.7); }
.sidebar__item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar__item:focus-visible { outline: 2px solid var(--cta); outline-offset: -2px; }
.sidebar__item--active { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; border-left-color: var(--cta); }
.sidebar__item--active i { color: var(--cta); }
.sidebar__footer {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.14);
}
.sidebar__avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--cta); color: var(--cta-text);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .75rem; flex: none;
}
.sidebar__who { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__logout {
  background: none; border: 0; color: rgba(255,255,255,.75); cursor: pointer;
  min-width: 44px; min-height: 44px; font-size: .9rem;
}
.sidebar__logout:hover { color: #fff; }
.sidebar__logout-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.mobilebar { display: none; }
@media (max-width: 1023px) {
  .mobilebar {
    display: flex; align-items: center; gap: 12px; background: var(--card);
    border-bottom: 1px solid var(--border); padding: 8px 12px;
    position: sticky; top: 0; z-index: 40;
  }
  .mobilebar img { height: 34px; width: auto; }
  .mobilebar button {
    background: none; border: 1px solid var(--border); border-radius: var(--radius);
    min-width: 44px; min-height: 44px; font-size: 1.1rem; color: var(--text); cursor: pointer;
  }
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: 0 0 24px rgba(0,0,0,.3);
  }
  .sidebar--open { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar__item { transition: none; }
}

.badge { display: inline-block; font-size: .7rem; font-weight: 600; border-radius: 10px; padding: 2px 8px; margin-top: 6px; }
.badge--warn { background: #fef3c7; color: var(--warn-text); }
.muted { color: var(--muted); }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 2rem; background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 1.1rem; flex-shrink: 0; }
.topbar h1 a { color: var(--primary); }
.topbar__right { margin-left: auto; display: flex; gap: 1rem; align-items: center; }
.link-button { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }

main { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }

.flash { padding: .8rem 1rem; margin-bottom: 1rem; border-radius: var(--radius); }
.flash--success { background: var(--success-bg); color: var(--success); }
.flash--error   { background: var(--error-bg);   color: var(--error); }

.page-cards { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.page-card a { display: block; padding: 1.5rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.page-card a:hover { border-color: var(--primary); text-decoration: none; }
.page-card strong { display: block; font-size: 1.1rem; }
.page-card small { color: var(--muted); }

.edit-form { background: var(--card); padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.edit-hint { color: var(--muted); margin: 0 0 1.25rem; font-size: .92rem; }

/* Collapsible sections (collapsed by default) */
details.section { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .85rem; overflow: hidden; }
details.section[open] { box-shadow: var(--shadow); }
details.section > summary {
  list-style: none; cursor: pointer; padding: .9rem 1.25rem;
  display: flex; align-items: center; gap: .7rem;
  font-weight: 700; color: var(--primary-dark); user-select: none;
}
details.section > summary:hover { background: #f0fbf5; }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: "\25B8"; color: var(--primary); font-size: .9em; transition: transform .15s ease; }
details.section[open] > summary::before { transform: rotate(90deg); }
.section__name { flex: 1; }
.section__count { font-weight: 500; font-size: .8rem; color: var(--muted); background: var(--bg); padding: .15rem .65rem; border-radius: 999px; white-space: nowrap; }
.section__body { padding: 0 1.25rem 1.1rem; }
.section__help { margin: .25rem 0 1rem; color: var(--muted); font-size: .88rem; border-left: 3px solid var(--cta); padding-left: .65rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 500; margin-bottom: .3rem; color: var(--muted); }
.field input[type=text], .field textarea { width: 100%; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.image-thumb { display: block; max-width: 200px; max-height: 150px; margin-bottom: .5rem; border: 1px solid var(--border); border-radius: var(--radius); }
.icon-field i { font-size: 2rem; margin-right: 1rem; vertical-align: middle; }
.hint { color: var(--muted); font-size: .85rem; }

/* Toggle field (afficher/masquer un bloc) */
.field--toggle .toggle-field { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; margin-bottom: .3rem; }
.field--toggle .toggle-field input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--primary); cursor: pointer; }
.field--toggle .toggle-field span { font-weight: 500; margin: 0; }

/* Video field */
.video-field .video-current { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .5rem; }
.video-field .video-current i { color: var(--primary); font-size: 1.3rem; }
.video-field .video-name { font-weight: 500; word-break: break-all; }
.video-replace { cursor: pointer; display: inline-block; }

.actions { display: flex; gap: 1rem; margin-top: 1.5rem; }
.btn-primary { background: var(--primary); color: var(--primary-text); border: none; padding: .7rem 1.5rem; border-radius: var(--radius); font: inherit; font-weight: 600; cursor: pointer; }
.btn-secondary { display: inline-block; padding: .7rem 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); }

/* Sticky save bar (edit page) */
.save-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--card); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
}
.save-bar__inner { max-width: 900px; margin: 0 auto; padding: .7rem 1rem; display: flex; align-items: center; gap: 1rem; }
.save-bar__status { display: flex; align-items: center; gap: .5rem; font-size: .9rem; font-weight: 600; color: var(--muted); }
.save-bar__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; transition: background .2s ease; }
.save-bar__status[data-state="unsaved"] { color: var(--warn-text); }
.save-bar__status[data-state="unsaved"] .save-bar__dot { background: var(--warn); }
.save-bar__status[data-state="saved"] { color: var(--success); }
.save-bar__status[data-state="saved"] .save-bar__dot { background: var(--success); }
.save-bar__actions { margin-left: auto; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.save-bar__actions .restore-form { margin: 0; }
.btn-cta { background: var(--cta); color: var(--cta-text); border: none; padding: .65rem 1.5rem; border-radius: var(--radius); font: inherit; font-weight: 700; cursor: pointer; }
.btn-cta:hover { filter: brightness(.95); }
.btn-restore { background: none; border: 1px solid var(--border); color: var(--text); padding: .6rem 1rem; border-radius: var(--radius); font: inherit; cursor: pointer; }
.btn-restore:hover { border-color: var(--warn); color: var(--warn-text); }
.save-bar__view { display: inline-flex; align-items: center; gap: .4rem; }
/* keep page content clear of the fixed bar */
main { padding-bottom: 96px; }

@media (max-width: 600px) {
  .save-bar__inner { flex-wrap: wrap; gap: .5rem .8rem; padding: .55rem .8rem; }
  .save-bar__status { order: 2; flex-basis: 100%; }
  .save-bar__actions { order: 1; width: 100%; }
  .save-bar__view { flex: 1; text-align: center; }
  .btn-cta { flex: 1; }
  main { padding-bottom: 132px; }
}

/* Icon picker modal */
.icon-picker-modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.icon-picker-modal__panel { background: var(--card); padding: 1.5rem; border-radius: var(--radius); width: min(720px, 90vw); max-height: 80vh; display: flex; flex-direction: column; }
.icon-picker-modal__search { width: 100%; padding: .5rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.icon-picker-modal__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: .5rem; overflow-y: auto; padding-right: .5rem; }
.icon-picker-modal__item { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; text-align: center; font-size: 1.5rem; }
.icon-picker-modal__item:hover { border-color: var(--primary); }

/* Auth card */
.auth-card { max-width: 400px; margin: 4rem auto; background: var(--card); padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-card h1 { margin-top: 0; }
.auth-card form label { display: block; margin-bottom: 1rem; font-weight: 500; }
.auth-card form label input { display: block; width: 100%; margin-top: .3rem; padding: .55rem; border: 1px solid var(--border); border-radius: var(--radius); }
.auth-card form button { width: 100%; padding: .7rem; background: var(--primary); color: var(--primary-text); border: none; border-radius: var(--radius); cursor: pointer; }
.error { color: var(--error); background: var(--error-bg); padding: .6rem; border-radius: var(--radius); margin-bottom: 1rem; }

/* SEO panel + counters */
.counter { color: var(--muted); font-size: .75rem; }
.counter--over { color: var(--warn-text); font-weight: 600; }
.hint { display: block; color: var(--muted); font-size: .75rem; }
.seo-panel summary .section__name::before { content: "\f002"; font-family: "Font Awesome 5 Free"; font-weight: 900; margin-right: 8px; color: var(--primary); }

/* Blog admin: list, editor, buttons */
.pill { display: inline-block; font-size: .75rem; font-weight: 600; border-radius: 12px; padding: 2px 10px; }
.pill--published { background: var(--success-bg); color: var(--success); }
.pill--draft { background: #e5e7eb; color: var(--muted); }
.data-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table th, .data-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.data-table .actions a { margin-right: 12px; }
.field-error { color: var(--error); font-size: .85rem; margin: 4px 0 0; }
.notice { padding: 10px 14px; border-radius: var(--radius); }
.notice--ok { background: var(--success-bg); color: var(--success); }
.notice--err { background: var(--error-bg); color: var(--error); }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }
.button { display: inline-block; padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font: inherit; }
.button:hover { text-decoration: none; border-color: var(--primary); }
.button--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.button--primary:hover { background: var(--primary-dark); }
.button--warn { background: #fef3c7; color: var(--warn-text); border-color: #fde68a; }
.button--danger { background: var(--error-bg); color: var(--error); border-color: #fecaca; }
.danger-zone { display: flex; gap: 12px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.blog-edit .edit-form { margin-top: 1rem; }

/* inline row actions (blog list delete) */
.inline-form { display: inline; }
.link-button--danger { color: var(--error); }

/* Social network field (réseau + icône) */
.social-field { display: flex; align-items: center; gap: .8rem; }
.social-field i { font-size: 1.6rem; width: 2rem; text-align: center; }
.social-field select { padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; min-width: 220px; }
