/* ============================================================
   SocialNova Platform — main.css  (mobile-first)
   ============================================================ */

/* ── Variables ── */
:root {
  --rose:    #e39b9c;
  --rose-d:  #c47a7b;
  --rose-l:  rgba(227,155,156,.12);
  --cyan:    #00bdc5;
  --cyan-d:  #008f96;
  --cyan-l:  rgba(0,189,197,.10);
  --dark:    #0d0d0f;
  --dark2:   #141418;
  --dark3:   #1e1e24;
  --border:  rgba(255,255,255,.07);
  --text:    #f0ece8;
  --muted:   #7a7870;
  --soft:    #b8b4ae;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --radius:    6px;
  --radius-lg: 10px;
  --sidebar-w: 240px;
  --topbar-h:  60px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--dark2);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Typography ── */
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--rose); }

/* ── Forms ── */
input, textarea, select {
  background: var(--dark3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: .65rem .9rem;
  font-family: inherit;
  font-size: 15px;
  width: 100%;
  transition: border-color .2s;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--cyan);
}
select option { background: var(--dark3); }
label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1.2rem;
  border-radius: var(--radius);
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .25s;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary  { background: var(--cyan);  color: var(--dark); border-color: var(--cyan); }
.btn-primary:hover, .btn-primary:active { background: var(--cyan-d); border-color: var(--cyan-d); color: var(--dark); }
.btn-rose     { background: var(--rose);  color: var(--dark); border-color: var(--rose); }
.btn-rose:hover { background: var(--rose-d); color: var(--dark); }
.btn-ghost    { background: transparent; color: var(--soft); border-color: var(--border); }
.btn-ghost:hover, .btn-ghost:active { border-color: var(--rose); color: var(--rose); }
.btn-danger   { background: transparent; color: var(--danger); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.1); }
.btn-sm { padding: .35rem .8rem; font-size: 11px; }
.btn-block { width: 100%; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  white-space: nowrap;
}
.badge-pending   { background: rgba(245,158,11,.15); color: var(--warning); border: 1px solid rgba(245,158,11,.3); }
.badge-active    { background: rgba(34,197,94,.12);  color: var(--success); border: 1px solid rgba(34,197,94,.25); }
.badge-suspended { background: rgba(239,68,68,.12);  color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }
.badge-accepted  { background: rgba(34,197,94,.12);  color: var(--success); border: 1px solid rgba(34,197,94,.25); }
.badge-rejected  { background: rgba(239,68,68,.12);  color: var(--danger);  border: 1px solid rgba(239,68,68,.25); }
.badge-draft     { background: rgba(122,120,112,.12); color: var(--muted);  border: 1px solid var(--border); }
.badge-published { background: var(--cyan-l);         color: var(--cyan);   border: 1px solid rgba(0,189,197,.3); }
.badge-archived  { background: rgba(122,120,112,.10); color: var(--muted);  border: 1px solid var(--border); }

/* ── Cards ── */
.card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: .95rem;
  font-weight: 700;
}

/* ── Alerts ── */
.alert {
  padding: .8rem 1rem;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 1rem;
}
.alert-success { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.3);  color: var(--success); }
.alert-error   { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.3);  color: var(--danger); }
.alert-info    { background: var(--cyan-l);        border: 1px solid rgba(0,189,197,.3);  color: var(--cyan); }

/* ── Tables — responsive ── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.table th {
  text-align: left;
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.03);
  vertical-align: middle;
}
.table tbody tr:hover { background: rgba(255,255,255,.02); }

/* ── Mobile cards (alternative aux tables) ── */
.mobile-card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: .75rem;
}
.mobile-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .4rem;
}
.mobile-card-row:last-child { margin-bottom: 0; }

/* ── Forms layout ── */
.form-grid { display: grid; grid-template-columns: 1fr; gap: .85rem; }
.form-group { margin-bottom: .85rem; }

/* ── Utilities ── */
.text-muted  { color: var(--muted); font-size: 13px; }
.text-cyan   { color: var(--cyan); }
.text-rose   { color: var(--rose); }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm      { gap: .5rem; }
.gap-md      { gap: 1rem; }
.mt-1        { margin-top: .5rem; }
.mt-2        { margin-top: 1rem; }
.mb-1        { margin-bottom: .5rem; }
.mb-2        { margin-bottom: 1rem; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: .4; display: block; }
.empty-state h3 { font-family: 'Syne', sans-serif; font-size: 1rem; margin-bottom: .5rem; color: var(--soft); }

/* ══════════════════════════════════════════════
   LAYOUT — Sidebar + Main
══════════════════════════════════════════════ */

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

/* ── Overlay sombre (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 49;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.sidebar-logo {
  padding: 1.25rem 1.25rem .85rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: .2em;
  color: var(--text);
}
.logo-text span { color: var(--cyan); }
.logo-role {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: .15rem;
}
.sidebar-nav { padding: .75rem 0; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem 1.25rem;
  font-size: 14px;
  font-weight: 400;
  color: var(--soft);
  transition: all .2s;
  border-left: 2px solid transparent;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover, .nav-item:active { background: rgba(255,255,255,.03); color: var(--text); }
.nav-item.active { background: var(--cyan-l); color: var(--cyan); border-left-color: var(--cyan); }
.nav-item .icon  { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--rose);
  color: white;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  padding: .1rem .45rem;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: .7rem; margin-bottom: .65rem; min-width: 0; }
.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-weight: 800; font-size: 12px;
  color: var(--dark);
  flex-shrink: 0;
  overflow: hidden;
}
.user-email {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}

/* ── Topbar ── */
.main-content {
  flex: 1;
  min-height: 100vh;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--dark);
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}
.topbar-left  { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.topbar-title {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bouton hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.hamburger span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--soft);
  border-radius: 2px;
  transition: all .25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Page body ── */
.page-body { padding: 1.5rem; flex: 1; min-width: 0; }

/* ── Stat cards ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .85rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}
.stat-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
.stat-value { font-family: 'Cormorant Garamond', serif; font-size: 2rem; font-weight: 300; line-height: 1; color: var(--text); }
.stat-value .accent { color: var(--cyan); }

/* ── Collab cards ── */
.collab-card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: .85rem;
  transition: border-color .25s;
}
.collab-card:hover { border-color: rgba(0,189,197,.25); }
.collab-title { font-family: 'Syne', sans-serif; font-size: .95rem; font-weight: 700; margin-bottom: .25rem; }
.collab-meta { display: flex; gap: .75rem; font-size: 12px; color: var(--muted); margin: .4rem 0; flex-wrap: wrap; }
.collab-meta span { display: flex; align-items: center; gap: .3rem; }
.collab-desc { font-size: 13px; color: var(--soft); line-height: 1.6; margin-bottom: .85rem; }

/* ── Messages ── */
.msg-bubble {
  padding: .65rem .9rem;
  border-radius: var(--radius-lg);
  max-width: 82%;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: .65rem;
  word-break: break-word;
}
.msg-sent {
  background: var(--cyan-l);
  border: 1px solid rgba(0,189,197,.2);
  margin-left: auto;
  border-radius: var(--radius-lg) 4px var(--radius-lg) var(--radius-lg);
}
.msg-recv {
  background: var(--dark3);
  border: 1px solid var(--border);
  margin-right: auto;
  border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg);
}
.msg-time { font-size: 11px; color: var(--muted); margin-top: .2rem; }
.msg-list {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow-y: auto;
  gap: .2rem;
  flex: 1;
}

/* ── Threads ── */
.thread-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--border);
  transition: background .2s;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.thread-item:hover, .thread-item:active { background: rgba(255,255,255,.02); }
.thread-item.unread { background: var(--cyan-l); }
.thread-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-d), var(--cyan-d));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 13px;
  color: var(--dark);
  flex-shrink: 0;
  overflow: hidden;
}
.thread-info { flex: 1; min-width: 0; }
.thread-name { font-weight: 500; font-size: 14px; }
.thread-preview { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { text-align: right; font-size: 11px; color: var(--muted); flex-shrink: 0; }

/* ── Pagination ── */
.pagination { display: flex; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap; }
.page-btn {
  padding: .4rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--dark);
  color: var(--soft);
  text-decoration: none;
  transition: all .2s;
  min-width: 36px;
  text-align: center;
}
.page-btn:hover, .page-btn.active { border-color: var(--cyan); color: var(--cyan); }

/* ── Avatars ── */
.avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--rose), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 24px;
  color: var(--dark);
  flex-shrink: 0;
}

/* ── Audit log ── */
.log-action { font-family: 'Syne', sans-serif; font-size: 11px; font-weight: 700; padding: .2rem .45rem; border-radius: 4px; white-space: nowrap; }
.log-login  { background: rgba(34,197,94,.1);   color: var(--success); }
.log-update { background: var(--cyan-l);          color: var(--cyan); }
.log-create { background: rgba(245,158,11,.1);   color: var(--warning); }
.log-delete { background: rgba(239,68,68,.1);    color: var(--danger); }
.log-other  { background: rgba(122,120,112,.1);  color: var(--muted); }

/* ══════════════════════════════════════════════
   RESPONSIVE — Tablet  ≤ 1024px
══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }

  .page-body { padding: 1.25rem; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* Topbar actions : masquer les labels longs */
  .topbar .btn-sm { font-size: 11px; padding: .3rem .6rem; }
}

/* ══════════════════════════════════════════════
   RESPONSIVE — Mobile  ≤ 768px
══════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Sidebar en drawer ── */
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    box-shadow: 4px 0 24px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }

  /* ── Main sans marge ── */
  .main-content { margin-left: 0; }

  /* ── Hamburger visible ── */
  .hamburger { display: flex; }

  /* ── Topbar ── */
  .topbar { padding: 0 1rem; }
  .topbar-title { font-size: .9rem; }
  .topbar-right .btn-sm { display: none; } /* cacher les boutons d'action dans topbar */
  .topbar-right .btn-primary { display: none; }

  /* ── Page body ── */
  .page-body { padding: 1rem; }

  /* ── Stats : 2 colonnes ── */
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: .65rem; }
  .stat-value { font-size: 1.6rem; }

  /* ── Grids → 1 colonne ── */
  .form-grid { grid-template-columns: 1fr !important; }
  .form-grid .full { grid-column: 1; }
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] { display: block !important; }
  [style*="grid-template-columns: 1.5fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns: 1fr 320px"] { display: block !important; }

  /* ── Cards ── */
  .card { padding: 1rem; }
  .card-header { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .card-header .btn { width: 100%; }

  /* ── Tables → scroll horizontal ── */
  .table-wrap { margin: 0 -1rem; border-radius: 0; }
  .card > .table { display: none; } /* cacher tables dans cards sans wrap */

  /* ── Collab cards ── */
  .collab-card { padding: 1rem; }
  .collab-card > div[style] { flex-direction: column !important; align-items: flex-start !important; }
  .collab-card .btn { width: 100%; margin-top: .5rem; }

  /* ── Messages layout ── */
  .msg-list { max-height: 320px; }
  .msg-bubble { max-width: 92%; }

  /* ── Topbar actions : bouton flottant à la place ── */
  .fab {
    display: flex !important;
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--cyan);
    color: var(--dark);
    font-size: 1.4rem;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,189,197,.35);
    z-index: 39;
    text-decoration: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* ── Notification items ── */
  [style*="display:flex;align-items:flex-start"] { flex-wrap: wrap; }

  /* ── Auth pages ── */
  .page-body > [style*="grid-template-columns:300px"] { display: flex !important; flex-direction: column !important; }

  /* ── Messaging page ── */
  .msg-layout { flex-direction: column; }
  .msg-threads { width: 100% !important; height: 200px; overflow-y: auto; }
  .msg-conversation { flex: 1; }
}

/* ══════════════════════════════════════════════
   RESPONSIVE — Très petit  ≤ 380px
══════════════════════════════════════════════ */
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .stat-value { font-size: 1.4rem; }
  .stat-card { padding: .75rem; }
  .badge { font-size: 10px; padding: .15rem .45rem; }
  .page-body { padding: .75rem; }
  .topbar { padding: 0 .75rem; }
}

/* ══════════════════════════════════════════════
   FAB — caché par défaut sur desktop
══════════════════════════════════════════════ */
.fab { display: none; }

/* ══════════════════════════════════════════════
   Desktop  ≥ 769px — grilles multi-colonnes
══════════════════════════════════════════════ */
@media (min-width: 769px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .full { grid-column: 1 / -1; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .page-body { padding: 1.5rem 2rem; }
  .card { padding: 1.5rem; }
}

@media (min-width: 1025px) {
  .page-body { padding: 2rem; }
}
