/* =========================================================
   SGET.CD — Espace « Mon Compte »
   Feuille de style de l'application (PHP + MySQL)
   Reprend l'identité visuelle du portail public (drapeau RDC)
   ========================================================= */

:root {
  --sget-navy: #06356e;
  --sget-navy-deep: #042a56;
  --sget-blue: #0a5ea8;
  --sget-cyan: #14b8e0;
  --sget-red: #c8102e;
  --sget-yellow: #f7d417;

  --ink: #0b1f33;
  --text: #1b2b3a;
  --muted: #5b6b7c;
  --line: #dbe3ec;
  --paper: #ffffff;
  --mist: #f4f7fb;
  --mist-2: #eaf1f9;

  --font-display: "Figtree", "Segoe UI", Arial, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", Arial, sans-serif;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 2px 10px rgba(6, 53, 110, .08);
  --shadow-card-hover: 0 14px 28px rgba(6, 53, 110, .14);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur: 200ms;

  --sidebar-w: 264px;
  --topbar-h: 68px;
}

* , *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--sget-navy); line-height: 1.25; margin: 0 0 .4rem; }
p { margin: 0 0 .9rem; }
a { color: var(--sget-blue); text-decoration: none; }
a:hover { color: var(--sget-cyan); }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .65rem 1.3rem; border: 2px solid transparent;
  border-radius: var(--radius-sm); font-family: var(--font-display); font-weight: 700;
  font-size: .92rem; text-decoration: none; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--sget-navy); color: #fff; }
.btn-primary:hover { background: var(--sget-blue); color: #fff; }
.btn-red { background: var(--sget-red); color: #fff; }
.btn-red:hover { background: #9c0c24; color: #fff; }
.btn-outline { background: transparent; color: var(--sget-navy); border-color: var(--sget-navy); }
.btn-outline:hover { background: var(--sget-navy); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { background: var(--mist); color: var(--text); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: .45rem 1rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Pages d'authentification (login / inscription) ---------- */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem 1.2rem;
  background: linear-gradient(135deg, var(--sget-navy-deep) 0%, var(--sget-navy) 48%, var(--sget-blue) 100%);
}
.auth-card {
  width: 100%; max-width: 440px;
  background: #fff; border-radius: 18px; box-shadow: 0 30px 60px rgba(4, 22, 45, .35);
  padding: 2.2rem 2rem 2rem;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 1.4rem; }
.auth-brand img { height: 58px; width: auto; margin-bottom: .7rem; }
.auth-brand strong { font-family: var(--font-display); color: var(--sget-navy); font-size: 1.15rem; }
.auth-brand span { color: var(--muted); font-size: .82rem; }
.auth-card h1 { font-size: 1.35rem; text-align: center; margin-bottom: .3rem; }
.auth-sub { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 1.4rem; }
.auth-links { text-align: center; margin-top: 1.1rem; font-size: .9rem; color: var(--muted); }
.auth-links a { font-weight: 700; }
.auth-back { position: absolute; top: 1.4rem; left: 1.4rem; color: #fff; opacity: .85; font-size: .88rem; }
.auth-back:hover { color: #fff; opacity: 1; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; gap: 1rem; }
.form-grid.cols-2 { grid-template-columns: 1fr; }
@media (min-width: 560px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-weight: 700; font-size: .86rem; color: var(--sget-navy); }
.field .req { color: var(--sget-red); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .9rem;
  font-size: .95rem; font-family: inherit; color: var(--text); background: #fff;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--sget-blue); box-shadow: 0 0 0 3px rgba(10, 94, 168, .15);
}
.field textarea { resize: vertical; min-height: 110px; }
.field-hint { font-size: .8rem; color: var(--muted); }
.field-file { border: 1.5px dashed var(--line); border-radius: var(--radius-sm); padding: 1rem; text-align: center; background: var(--mist); }
.field-file input { border: none; background: transparent; padding: 0; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; padding: .2rem; }

/* ---------- Alertes / flash ---------- */
.alert { display: flex; align-items: flex-start; gap: .6rem; padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 1.1rem; }
.alert i { margin-top: .15rem; }
.alert-success { background: #eafaf0; color: #146c3e; border: 1px solid #bfe8cf; }
.alert-error   { background: #fdf1f1; color: #9c1c1c; border: 1px solid #f3c2c2; }
.alert-info    { background: #eef6fd; color: #0a5ea8; border: 1px solid #cfe6f7; }
.alert-warn    { background: #fff9e8; color: #8a6d00; border: 1px solid #f3e3a0; }

/* ---------- Layout application (topbar + sidebar) ---------- */
.app-shell { min-height: 100vh; }
.app-topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  background: var(--sget-navy); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.2rem; box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.app-topbar .brand { display: flex; align-items: center; gap: .6rem; color: #fff; }
.app-topbar .brand img { height: 34px; width: auto; }
.app-topbar .brand strong { font-family: var(--font-display); font-size: 1rem; letter-spacing: .01em; }
.app-topbar .brand span { display: none; font-size: .72rem; opacity: .8; }
@media (min-width: 640px) { .app-topbar .brand span { display: block; } }
.topbar-actions { display: flex; align-items: center; gap: .8rem; }
.sidebar-toggle { display: inline-flex; background: none; border: none; color: #fff; font-size: 1.25rem; cursor: pointer; padding: .3rem; }
@media (min-width: 960px) { .sidebar-toggle { display: none; } }
.bell-btn { position: relative; background: none; border: none; color: #fff; font-size: 1.15rem; cursor: pointer; padding: .3rem; }
.bell-dot { position: absolute; top: -2px; right: -2px; background: var(--sget-red); color: #fff; font-size: .62rem; font-weight: 800; border-radius: 999px; min-width: 17px; height: 17px; display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--sget-navy); }
.topbar-user { display: flex; align-items: center; gap: .5rem; color: #fff; font-size: .86rem; text-decoration: none; }
.topbar-user .avatar { width: 32px; height: 32px; border-radius: 999px; background: var(--sget-cyan); color: var(--sget-navy-deep); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: .82rem; }
.topbar-user span { display: none; }
@media (min-width: 640px) { .topbar-user span { display: block; } }

.app-body { display: flex; }
.app-sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  min-height: calc(100vh - var(--topbar-h)); padding: 1.2rem .9rem;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.app-sidebar nav { display: flex; flex-direction: column; gap: .2rem; }
.app-sidebar .side-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 1rem .6rem .4rem; }
.app-sidebar .side-section:first-child { margin-top: .2rem; }
.side-link {
  display: flex; align-items: center; gap: .7rem; padding: .68rem .8rem; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 600; font-size: .92rem; transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.side-link i { width: 20px; text-align: center; color: var(--muted); }
.side-link:hover { background: var(--mist); color: var(--sget-navy); }
.side-link.active { background: var(--mist-2); color: var(--sget-navy); }
.side-link.active i { color: var(--sget-blue); }
.side-link .count { margin-left: auto; background: var(--sget-red); color: #fff; font-size: .7rem; font-weight: 800; border-radius: 999px; padding: .1rem .45rem; }
.side-logout { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }

@media (max-width: 959px) {
  .app-sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%); transition: transform var(--dur) var(--ease);
    box-shadow: 8px 0 24px rgba(0,0,0,.12); width: min(84vw, 300px);
  }
  .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(6,20,40,.45); z-index: 45;
  }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
}

.app-main { flex: 1; min-width: 0; padding: 1.6rem 1.2rem 3rem; }
@media (min-width: 640px) { .app-main { padding: 2rem 2rem 3.5rem; } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.page-head h1 { font-size: 1.5rem; }
.page-head p { color: var(--muted); margin: 0; font-size: .92rem; }
.breadcrumb-mini { font-size: .82rem; color: var(--muted); margin-bottom: .4rem; }
.breadcrumb-mini a { color: var(--muted); }
.breadcrumb-mini a:hover { color: var(--sget-blue); }

/* ---------- Cartes / grilles ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow-card); }
.card + .card { margin-top: 1.1rem; }
.dash-stats { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); margin-bottom: 1.4rem; }
@media (min-width: 720px) { .dash-stats { grid-template-columns: repeat(4, 1fr); } }
.dash-stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-card); display: flex; align-items: center; gap: .9rem; }
.dash-stat .ic { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; color: #fff; flex-shrink: 0; }
.dash-stat .num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--sget-navy); line-height: 1; }
.dash-stat .lbl { font-size: .78rem; color: var(--muted); margin-top: .15rem; }

.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.section-title-row h2 { font-size: 1.1rem; margin: 0; }

.news-item { display: flex; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: none; }
.news-item .thumb { width: 68px; height: 68px; border-radius: 10px; background: var(--mist-2); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--sget-blue); font-size: 1.4rem; overflow: hidden; }
.news-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-item h3 { font-size: .98rem; margin-bottom: .2rem; }
.news-item p { font-size: .86rem; color: var(--muted); margin: 0 0 .3rem; }
.news-item time { font-size: .76rem; color: var(--muted); }

.empty-state { text-align: center; padding: 2.4rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.1rem; color: var(--line); margin-bottom: .6rem; display: block; }

/* ---------- Tableaux (liste de dossiers / messages) ---------- */
.data-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data-table th { text-align: left; background: var(--mist); color: var(--sget-navy); font-family: var(--font-display); font-weight: 700; padding: .75rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data-table td { padding: .75rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--mist); }

.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 800; padding: .28rem .65rem; border-radius: 999px; white-space: nowrap; }
.badge-gray   { background: #eef1f4; color: #4a5a68; }
.badge-blue   { background: #e5f1fb; color: #0a5ea8; }
.badge-yellow { background: #fff6d8; color: #8a6d00; }
.badge-green  { background: #e4f7ea; color: #146c3e; }
.badge-red    { background: #fdeaea; color: #9c1c1c; }

.filters-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.filters-bar select, .filters-bar input[type=search] { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .8rem; font-size: .87rem; }

/* ---------- Détail / fil de conversation ---------- */
.detail-meta { display: grid; gap: .7rem; grid-template-columns: 1fr; margin-bottom: 1.2rem; }
@media (min-width: 640px) { .detail-meta { grid-template-columns: repeat(3, 1fr); } }
.detail-meta .mi { background: var(--mist); border-radius: var(--radius-sm); padding: .7rem .9rem; }
.detail-meta .mi span { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.detail-meta .mi strong { font-family: var(--font-display); color: var(--sget-navy); font-size: .92rem; }

.thread { display: flex; flex-direction: column; gap: 1rem; }
.thread-msg { border-radius: var(--radius); padding: 1rem 1.1rem; max-width: 90%; }
.thread-msg.from-user { background: var(--mist-2); align-self: flex-start; border: 1px solid var(--sget-line); }
.thread-msg.from-admin { background: var(--sget-navy); color: #fff; align-self: flex-end; }
.thread-msg .who { font-size: .74rem; opacity: .75; margin-bottom: .3rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.thread-msg p:last-child { margin-bottom: 0; }

/* ---------- Notifications ---------- */
.notif-list { display: flex; flex-direction: column; }
.notif-item { display: flex; gap: .9rem; padding: 1rem .3rem; border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f6faff; }
.notif-item .ic { width: 40px; height: 40px; border-radius: 999px; background: var(--mist-2); color: var(--sget-blue); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notif-item h4 { font-size: .92rem; margin: 0 0 .2rem; }
.notif-item p { font-size: .85rem; color: var(--muted); margin: 0 0 .2rem; }
.notif-item time { font-size: .74rem; color: var(--muted); }

/* ---------- Page de connexion : lien retour vers le site public ---------- */
.back-to-site { display: inline-flex; align-items: center; gap: .4rem; }

/* ---------- Footer léger de l'app ---------- */
.app-footer { text-align: center; padding: 1.4rem 1rem; color: var(--muted); font-size: .8rem; }

/* ---------- Utilitaires ---------- */
.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.gap-1 { gap: .6rem; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* =========================================================
   Ajouts — Commentaires/Avis, CMS Pages, Visites, Paramètres
   ========================================================= */

/* ---------- Commentaires / Avis ---------- */
.comment-form textarea { width: 100%; }
.comment-form { margin-bottom: 1.2rem; }
.comment-list { display: flex; flex-direction: column; gap: 1rem; }
.comment-item { display: flex; gap: .8rem; padding: 1rem; background: var(--mist); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.comment-avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--sget-navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.comment-meta time { font-size: .78rem; color: var(--muted); }
.comment-body p { margin: .3rem 0 0; white-space: pre-wrap; word-break: break-word; }
.comment-context { font-size: .82rem; color: var(--muted); margin: .2rem 0 .4rem !important; }
.comment-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.comment-item-admin { align-items: flex-start; }

/* ---------- Filtres à onglets (modération) ---------- */
.tab-filters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tab-filter { padding: .5rem 1rem; border-radius: 999px; background: var(--mist); color: var(--text); text-decoration: none; font-size: .85rem; font-weight: 600; border: 1px solid var(--line); }
.tab-filter.active { background: var(--sget-navy); color: #fff; border-color: var(--sget-navy); }
.tab-filter .count { margin-left: .3rem; opacity: .8; }

/* ---------- CMS Pages : mise en page du formulaire ---------- */
.form-grid.cols-2 .field-full { grid-column: 1 / -1; }

/* ---------- Statistiques de visites ---------- */
.visit-chart { display: flex; flex-direction: column; gap: .55rem; }
.visit-bar-row { display: grid; grid-template-columns: 44px 1fr 40px; align-items: center; gap: .6rem; }
.visit-bar-label { font-size: .78rem; color: var(--muted); }
.visit-bar-track { height: 10px; border-radius: 999px; background: var(--mist-2); overflow: hidden; }
.visit-bar-fill { height: 100%; background: linear-gradient(90deg, var(--sget-blue), var(--sget-cyan)); border-radius: 999px; }
.visit-bar-value { font-size: .82rem; font-weight: 700; text-align: right; }

/* ---------- Paramètres : aperçu logo ---------- */
.logo-preview-box { display: flex; align-items: center; justify-content: center; padding: 1.2rem; background: var(--mist); border-radius: var(--radius-sm); border: 1px dashed var(--line); margin-bottom: 1rem; min-height: 100px; }
.logo-preview-box img { max-height: 90px; max-width: 100%; object-fit: contain; }

/* ---------- Contenu de page CMS publique (page.php) ---------- */
.cms-page-content { line-height: 1.7; }
.cms-page-content img { max-width: 100%; border-radius: var(--radius-sm); }
.quick-links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; }
