/* ============================================================
   PROFILE-X — style.css v4 (complet)
============================================================ */

/* Variables */
:root {
  --brand: #f97316;
  --brand-dark: #c2410c;
  --brand-light: #fff7ed;
  --cert-blue: #1d9bf0;
  --cert-blue-dark: #0d8bd9;
  --cert-blue-soft: #e8f5fd;
  --text: #0f1419;
  --text-2: #536471;
  --text-3: #8b98a5;
  --border: #eff3f4;
  --border-strong: #cfd9de;
  --hover: rgba(0,0,0,0.03);
  --bg: #ffffff;
  --bg-hover: #f7f9f9;
  --bg-soft: #f7f9f9;
  --shadow: rgba(0,0,0,0.08);
}
html[data-theme="dark"] {
  --text: #e7e9ea;
  --text-2: #71767b;
  --text-3: #71767b;
  --border: #2f3336;
  --border-strong: #3a3a44;
  --hover: rgba(255,255,255,0.03);
  --bg: #000000;
  --bg-hover: #080808;
  --bg-soft: #16181c;
  --brand-light: #2a1a08;
  --brand-dark: #fb923c;
  --cert-blue-soft: #0d1f2e;
  --shadow: rgba(0,0,0,0.5);
}
html[data-theme="dark"] body { background: #000; color: var(--text); }
html[data-theme="dark"] .px-topbar,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .modal-box,
html[data-theme="dark"] .sheet-box,
html[data-theme="dark"] .confirm-box,
html[data-theme="dark"] .post,
html[data-theme="dark"] .user-list-item,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .field select { background: #000; color: var(--text); }
html[data-theme="dark"] .dropdown-item:hover { background: #16181c; }
html[data-theme="dark"] .px-btn { background: #000; color: var(--text); border-color: #536471; }
html[data-theme="dark"] .px-btn.primary { background: #e7e9ea; color: #0f1419; border-color: #e7e9ea; }
html[data-theme="dark"] .action-btn.secondary { background: #16181c; color: var(--text); }
html[data-theme="dark"] .comment-input-row input { background: #000; color: var(--text); border-color: #2f3336; }

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 40px;
  overflow-x: hidden;
  transition: background .25s ease, color .25s ease;
}
img { max-width: 100%; }

/* Loading */
.px-loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.px-spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.px-error { text-align: center; padding: 80px 20px; color: var(--text-3); font-size: 14px; }
.px-error a { color: var(--brand); font-weight: 700; text-decoration: none; }

/* ============================================================
   POPUP PAGE (followers/following en nouvelle fenêtre)
============================================================ */
.px-popup-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg);
}
.px-popup-page[hidden] { display: none; }
.px-popup-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  z-index: 20;
}
html[data-theme="dark"] .px-popup-header { background: rgba(0,0,0,0.92); }
.px-popup-back {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 0; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: background .12s;
}
.px-popup-back:hover { background: var(--hover); }
.px-popup-title-wrap { min-width: 0; flex: 1; }
.px-popup-title { font-size: 18px; font-weight: 800; color: var(--text); }
.px-popup-subtitle { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.px-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 20px;
}

/* ============================================================
   PAGE NORMALE
============================================================ */
.px-page {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  position: relative;
}
@media (max-width: 620px) { .px-page { border-left: 0; border-right: 0; } }

.px-topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 0 12px;
  height: 53px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.px-back {
  width: 36px; height: 36px; border-radius: 50%;
  background: transparent; border: 0; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px;
  transition: background .12s;
  flex-shrink: 0;
}
.px-back:hover { background: var(--hover); }
.px-topbar-info { min-width: 0; flex: 1; }
.px-topbar-name {
  font-size: 17px; font-weight: 800;
  letter-spacing: -0.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.px-topbar-count { font-size: 12px; color: var(--text-2); font-weight: 500; }
.px-topbar-menu-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: transparent; border: 0; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px;
  transition: background .12s;
  flex-shrink: 0;
}
.px-topbar-menu-btn:hover { background: var(--hover); }

/* Dropdown */
.dropdown-wrap { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-width: calc(100vw - 24px);
  background: var(--bg);
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--border), 0 12px 32px var(--shadow);
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(.96);
  transform-origin: top right;
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
  z-index: 100;
  overflow: hidden;
  max-height: 80vh;
  overflow-y: auto;
}
.dropdown-menu.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.dropdown-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  background: transparent; border: 0;
  width: 100%; font-size: 14.5px; font-weight: 600;
  color: var(--text); text-align: left;
  cursor: pointer; font-family: inherit;
  transition: background .12s;
}
.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-item i { width: 20px; font-size: 16px; color: var(--text-2); flex-shrink: 0; text-align: center; }
.dropdown-item:hover i { color: var(--text); }
.dropdown-item .dropdown-item-body { flex: 1; min-width: 0; }
.dropdown-item .dropdown-item-title { font-size: 14.5px; font-weight: 600; }
.dropdown-item .dropdown-item-sub { font-size: 12.5px; color: var(--text-2); font-weight: 400; margin-top: 2px; }
.dropdown-item.danger { color: #dc2626; }
.dropdown-item.danger i { color: #dc2626; }
.dropdown-item.danger:hover { background: rgba(220,38,38,0.08); }
.dropdown-separator { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer;
  transition: background .12s; gap: 14px;
}
.dropdown-toggle:hover { background: var(--bg-hover); }
.dropdown-toggle-icon { width: 20px; font-size: 16px; color: var(--text-2); flex-shrink: 0; text-align: center; }
.dropdown-toggle-label { flex: 1; font-size: 14.5px; font-weight: 600; color: var(--text); }
.switch {
  position: relative; width: 44px; height: 24px;
  background: #71767b; border-radius: 100px;
  flex-shrink: 0; transition: background .2s;
}
.switch::after {
  content: ""; position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff; border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(20px); }

/* Cover */
.px-cover-wrap {
  position: relative; width: 100%;
  aspect-ratio: 3 / 1;
  background: linear-gradient(135deg, #f97316, #d4af37);
  overflow: hidden;
}
.px-cover { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.px-cover[data-empty="1"] { background: linear-gradient(135deg, #f97316, #d4af37); cursor: default; }
.px-cover-upload {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: 0; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px;
  backdrop-filter: blur(6px);
  transition: background .12s;
}
.px-cover-upload:hover { background: rgba(0,0,0,0.8); }

/* Header */
.px-header { padding: 0 16px; position: relative; min-height: 68px; }
.px-avatar-row {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-top: -15%; position: relative;
}
.px-avatar {
  width: 133px; height: 133px;
  border-radius: 50%;
  border: 4px solid var(--bg);
  background: linear-gradient(135deg, #f97316, #d4af37);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 800;
  overflow: hidden; cursor: pointer;
  flex-shrink: 0; position: relative;
  transition: border-color .25s;
}
@media (max-width: 500px) {
  .px-avatar { width: 84px; height: 84px; font-size: 28px; border-width: 3px; }
  .px-avatar-row { margin-top: -12%; }
}
.px-avatar img { width: 100%; height: 100%; object-fit: cover; }
.px-avatar-upload {
  position: absolute; bottom: 4px; right: 4px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 2px solid var(--bg); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px;
  z-index: 2; backdrop-filter: blur(6px);
}
@media (max-width: 500px) { .px-avatar-upload { width: 26px; height: 26px; font-size: 9px; } }

.px-actions { display: flex; gap: 8px; padding-bottom: 6px; }

/* Buttons */
.px-btn {
  border-radius: 100px; padding: 8px 18px;
  font-size: 14px; font-weight: 800;
  cursor: pointer;
  border: 1px solid #cfd9de;
  background: #fff; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.px-btn:hover { background: var(--bg-hover); }
.px-btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.px-btn.following { background: #fff; color: var(--text); border-color: #cfd9de; }
.px-btn.following:hover { color: #dc2626; border-color: #fecaca; background: #fef2f2; }
.px-btn.danger-outline { border-color: #cfd9de; color: var(--text); padding: 8px 12px; }

/* Info */
.px-info { padding: 12px 16px 14px; }
.px-name-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.px-name { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.2; }

/* Badge X */
.px-cert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  background: transparent;
  color: #1d9bf0;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: transform .15s ease, filter .15s ease;
  filter: drop-shadow(0 1px 2px rgba(29,155,240,0.15));
}
.px-cert-badge svg { width: 20px; height: 20px; display: block; }
.px-cert-badge:hover { transform: scale(1.18); filter: drop-shadow(0 2px 6px rgba(29,155,240,0.4)); }
.px-cert-badge:active { transform: scale(0.95); }

.px-username { font-size: 15px; color: var(--text-2); margin-bottom: 12px; }
.px-private-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700;
  background: var(--bg-soft); color: var(--text-2);
  padding: 3px 10px; border-radius: 100px;
  margin-left: 8px;
  border: 1px solid var(--border);
}
.px-bio { font-size: 15px; line-height: 1.4; margin-bottom: 12px; color: var(--text); word-wrap: break-word; }
.px-bio a { color: var(--brand); text-decoration: none; }
.px-bio a:hover { text-decoration: underline; }
.px-meta-row {
  display: flex; flex-wrap: wrap;
  gap: 12px;
  font-size: 14px; color: var(--text-2);
  margin-bottom: 12px;
}
.px-meta-row a { color: var(--brand); text-decoration: none; font-weight: 500; }
.px-meta-row a:hover { text-decoration: underline; }
.px-meta-row i { margin-right: 4px; font-size: 13px; }
.px-meta-row span { display: inline-flex; align-items: center; }

/* Follow counts */
.px-follow-counts { display: flex; gap: 20px; font-size: 14px; }
.px-follow-counts button {
  background: none; border: 0; padding: 0;
  font: inherit; cursor: pointer; color: inherit;
}
.px-follow-counts button:hover { text-decoration: underline; }
.px-follow-counts b { color: var(--text); font-weight: 700; }
.px-follow-counts span { color: var(--text-2); }

/* Tabs */
.px-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  position: sticky; top: 53px; z-index: 19;
}
.px-tab {
  flex: 1;
  padding: 16px 0;
  font-size: 15px; font-weight: 500;
  color: var(--text-2);
  background: transparent; border: 0;
  cursor: pointer; position: relative;
  font-family: inherit;
  transition: background .12s, color .12s;
}
.px-tab:hover { background: var(--hover); color: var(--text); }
.px-tab.active { color: var(--text); font-weight: 700; }
.px-tab.active::after {
  content: ""; position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 56px; height: 4px;
  background: var(--brand);
  border-radius: 4px 4px 0 0;
}

.px-feed { min-height: 200px; }
.px-empty { text-align: center; color: var(--text-3); font-size: 14px; padding: 50px 20px; }

/* Post */
.post {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: background .12s;
  animation: postIn .3s cubic-bezier(.22,1,.36,1);
}
@keyframes postIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.post:hover { background: var(--bg-hover); }
.post-pinned-tag {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  color: var(--text-3);
  padding: 4px 0 8px 52px;
}
.post-pinned-tag i { font-size: 11px; }
.post-row { display: flex; gap: 12px; align-items: flex-start; }
.post-avatar-col { flex-shrink: 0; }
.post-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #d4af37);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  overflow: hidden; flex-shrink: 0; cursor: pointer;
}
.post-avatar img { width: 100%; height: 100%; object-fit: cover; }
.post-content-col { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
.post-titre { order: 1; padding-right: 90px; }
.post-head { order: 2; padding-right: 90px; }
.post-corps { order: 4; }
.post-description { order: 5; }
.post-image-wrap { order: 6; }
.post-link-preview-loader, .post-yt-wrap, .post-embed-generic { order: 7; }
.post-actions { order: 8; }

.post-titre {
  font-size: 16.5px; font-weight: 800;
  line-height: 1.3; margin: 2px 0 6px;
  letter-spacing: -0.2px; color: var(--text);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.post-head {
  display: flex; align-items: center; gap: 4px;
  font-size: 13.5px; line-height: 1.35;
  margin-bottom: 6px; flex-wrap: wrap; min-width: 0;
}
.post-name {
  font-weight: 700; color: var(--text);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; font-size: 14px;
}

/* Badge X dans les posts */
.post-cert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  color: #1d9bf0;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.post-cert-badge svg { width: 16px; height: 16px; display: block; }
.post-cert-badge:hover { transform: scale(1.18); filter: drop-shadow(0 2px 6px rgba(29,155,240,0.4)); }

.post-handle { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; font-size: 13.5px; }
.post-dot { color: var(--text-2); }
.post-time { color: var(--text-2); white-space: nowrap; font-size: 13.5px; }
.post-category-tag {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase;
  color: var(--brand-dark);
  background: var(--brand-light);
  padding: 2px 8px; border-radius: 100px; flex-shrink: 0;
}
.post-menu-btn {
  position: absolute; top: 0; right: 0;
  background: transparent; border: 0;
  color: var(--text-2);
  padding: 6px; border-radius: 50%;
  cursor: pointer; z-index: 3;
  transition: background .12s, color .12s;
}
.post-menu-btn:hover { background: var(--brand-light); color: var(--brand); }
.post-corps {
  font-size: 14.5px; line-height: 1.5;
  color: var(--text); margin-bottom: 6px;
  word-wrap: break-word; overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.post-corps img { max-width: 100%; height: auto; border-radius: 12px; margin: 8px 0; }
.post-description { font-size: 13.5px; color: var(--text-2); line-height: 1.4; margin-bottom: 6px; }
.post-image-wrap {
  margin-top: 8px;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border);
  cursor: zoom-in; position: relative;
  background: var(--bg-soft);
}
.post-image-wrap img { width: 100%; height: auto; display: block; max-height: 500px; object-fit: cover; }
.post-yt-wrap { position: relative; border-radius: 14px; overflow: hidden; cursor: pointer; margin-top: 8px; background: #000; aspect-ratio: 16/9; }
.post-yt-wrap img { width: 100%; height: 100%; object-fit: cover; opacity: .85; display: block; }
.post-yt-wrap iframe { width: 100%; aspect-ratio: 16/9; border: none; display: block; }
.post-link-preview { display: block; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--bg); margin-top: 8px; text-decoration: none; color: inherit; }
.post-link-preview-img { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.post-link-preview-body { padding: 10px 12px; }
.post-link-preview-title { font-size: 13.5px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.post-link-preview-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.4; margin-bottom: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-link-preview-url { font-size: 11.5px; color: var(--text-3); }

.mention, .hashtag { color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: none; }
.mention:hover, .hashtag:hover { text-decoration: underline; }

/* Actions */
.post-actions {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-top: 8px; margin-left: -6px; max-width: 100%;
}
.post-action {
  display: flex; align-items: center; gap: 5px;
  background: transparent; border: 0;
  padding: 6px; cursor: pointer;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12.5px; font-weight: 500;
  font-family: inherit;
  transition: color .12s, background .12s;
}
.post-action i { font-size: 15px; }
.post-action:hover { color: var(--brand); background: var(--brand-light); }
.post-action.liked { color: #e11d48; }
.post-action.reposted { color: #16a34a; }
.post-action .count { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ============================================================
   CERT MODAL
============================================================ */
.cert-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,20,25,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  animation: certFadeIn 0.2s ease;
}
.cert-modal-overlay.open { display: flex; }
@keyframes certFadeIn { from { opacity: 0; } to { opacity: 1; } }

.cert-modal-box {
  background: var(--bg);
  border-radius: 22px;
  width: 100%; max-width: 420px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 72px rgba(0,0,0,0.35);
  animation: certPop 0.3s cubic-bezier(0.22,1,0.36,1);
}
@keyframes certPop {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.cert-modal-header { display: flex; justify-content: flex-end; padding: 14px 14px 0; }
.cert-modal-close {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 18px;
  background: transparent; border: 0; cursor: pointer;
  transition: background .12s;
}
.cert-modal-close:hover { background: var(--hover); }

.cert-modal-body { padding: 0 24px 24px; text-align: center; }

.cert-badge-large {
  width: 78px; height: 78px; border-radius: 50%;
  color: #1d9bf0;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  animation: certBadgeIn 0.5s cubic-bezier(0.22,1,0.36,1) 0.1s both;
  filter: drop-shadow(0 8px 20px rgba(29,155,240,0.35));
}
@keyframes certBadgeIn {
  from { transform: scale(0) rotate(-180deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.cert-user-info { margin-bottom: 22px; }
.cert-user-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #d4af37);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 24px;
  margin: 0 auto 10px;
  overflow: hidden;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px rgba(29,155,240,0.2);
}
.cert-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cert-user-name {
  font-size: 19px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 5px;
}
.cert-user-handle { font-size: 14.5px; color: var(--text-3); font-weight: 500; }

.cert-info-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; text-align: left; }
.cert-info-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border-radius: 14px;
  transition: background .15s;
}
.cert-info-row:hover { background: var(--hover); }
.cert-info-icon { font-size: 18px; color: var(--cert-blue); flex-shrink: 0; width: 26px; text-align: center; }
.cert-info-label {
  font-size: 11.5px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 3px;
}
.cert-info-value { font-size: 14.5px; font-weight: 700; color: var(--text); }

.cert-modal-text {
  font-size: 13.5px; line-height: 1.55;
  color: var(--text-2);
  text-align: left;
  padding: 16px;
  background: var(--cert-blue-soft);
  border-radius: 14px;
  margin-bottom: 20px;
}
.cert-modal-text b { color: var(--cert-blue); font-weight: 800; }

.cert-modal-btn {
  width: 100%;
  padding: 13px 20px;
  background: var(--text); color: var(--bg);
  border: 0; border-radius: 100px;
  font-size: 14.5px; font-weight: 800;
  cursor: pointer; font-family: inherit;
  transition: opacity .15s, transform .1s;
}
.cert-modal-btn:hover { opacity: 0.88; }
.cert-modal-btn:active { transform: scale(0.98); }

/* ============================================================
   SHEET
============================================================ */
.sheet-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,20,25,0.4);
  z-index: 250;
  align-items: flex-end; justify-content: center;
}
.sheet-overlay.open { display: flex; }
.sheet-box {
  background: var(--bg); width: 100%; max-width: 440px;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  animation: modalUp .25s cubic-bezier(.22,1,.36,1);
}
@keyframes modalUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; border: 0; background: var(--bg);
  padding: 15px 20px; font-size: 14.5px; font-weight: 600;
  text-align: left; color: var(--text);
  border-bottom: 1px solid var(--border);
  cursor: pointer; font-family: inherit;
}
.sheet-item:last-child { border-bottom: 0; }
.sheet-item.danger { color: #dc2626; }
.sheet-item.cancel { justify-content: center; color: var(--text-2); }
.sheet-item i { width: 18px; font-size: 15px; }

/* ============================================================
   CONFIRM
============================================================ */
.confirm-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,20,25,0.55);
  z-index: 280;
  align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--bg); border-radius: 20px;
  padding: 28px 22px 20px;
  max-width: 320px; width: 100%;
  text-align: center;
  animation: modalUp .25s cubic-bezier(.22,1,.36,1);
}
.confirm-icon { font-size: 32px; color: #dc2626; margin-bottom: 14px; }
.confirm-title { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.confirm-text { font-size: 14px; color: var(--text-2); margin-bottom: 22px; line-height: 1.45; }
.confirm-btn {
  display: block; width: 100%;
  padding: 12px; border-radius: 100px;
  font-size: 14px; font-weight: 700;
  border: 0; cursor: pointer;
  margin-bottom: 8px; font-family: inherit;
}
.confirm-btn.danger { background: #dc2626; color: #fff; }
.confirm-btn.cancel { background: var(--bg-soft); color: var(--text); }

/* ============================================================
   IMAGE VIEWER
============================================================ */
.image-viewer {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.94);
  z-index: 400;
  align-items: center; justify-content: center;
  padding: 16px;
}
.image-viewer.open { display: flex; }
.image-viewer img { max-width: 100%; max-height: 92vh; object-fit: contain; border-radius: 4px; }
.image-viewer-close {
  position: absolute; top: 16px; right: 16px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 0; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px;
}

/* ============================================================
   MODAL BASE
============================================================ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,20,25,0.55);
  z-index: 200;
  align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--bg); width: 100%; max-width: 520px;
  max-height: 92vh;
  border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalUp .25s cubic-bezier(.22,1,.36,1);
}
@media (min-width: 540px) {
  .modal-overlay { align-items: center; }
  .modal-box { border-radius: 20px; }
}
.modal-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 800; flex: 1; }
.modal-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: transparent;
  font-size: 22px; line-height: 1;
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s; flex-shrink: 0;
}
.modal-close:hover { background: var(--hover); }
.modal-action-btn {
  background: var(--brand); color: #fff;
  border: 0; padding: 8px 16px;
  border-radius: 100px;
  font-size: 13.5px; font-weight: 800;
  cursor: pointer; font-family: inherit;
  flex-shrink: 0;
}
.modal-body { padding: 16px; overflow-y: auto; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.modal-hint { font-size: 13px; color: var(--text-2); line-height: 1.5; margin-bottom: 14px; }
.modal-hint code { background: var(--bg-soft); padding: 2px 6px; border-radius: 6px; font-size: 12px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 14px; font-family: inherit;
  outline: none; color: var(--text); background: var(--bg);
  transition: border-color .12s;
}
.field input:focus, .field textarea:focus { border-color: var(--brand); }
.field textarea { resize: vertical; min-height: 80px; }

/* ============================================================
   UPLOAD PHOTO
============================================================ */
.edit-photo-row { display: flex; align-items: center; gap: 16px; }
.edit-photo-preview {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--border);
  color: var(--text-3); font-size: 28px;
}
.edit-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.edit-photo-actions { display: flex; gap: 8px; align-items: center; }
.edit-photo-btn {
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text);
  padding: 8px 14px; border-radius: 100px;
  font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, border-color .12s;
}
.edit-photo-btn:hover { background: var(--bg-hover); border-color: var(--brand); }
.edit-photo-btn.danger { color: #dc2626; border-color: #fecaca; padding: 8px 12px; }
.edit-photo-btn.danger:hover { background: #fef2f2; }
.edit-cover-preview {
  width: 100%; aspect-ratio: 3 / 1;
  border-radius: 12px;
  background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border: 1.5px solid var(--border);
  color: var(--text-3); font-size: 32px;
}
.edit-cover-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   CROP MODAL
============================================================ */
.crop-modal {
  display: none; position: fixed; inset: 0;
  background: #000; z-index: 500;
  flex-direction: column; color: #fff;
}
.crop-modal.open { display: flex; }
.crop-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0,0,0,0.85);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.crop-header h2 { font-size: 16px; font-weight: 800; color: #fff; flex: 1; text-align: center; }
.crop-btn {
  background: transparent; border: 0; color: #fff;
  font-size: 14px; font-weight: 700;
  padding: 8px 12px; border-radius: 100px;
  cursor: pointer; font-family: inherit;
}
.crop-btn.primary { background: var(--brand); color: #fff; }
.crop-btn:hover { background: rgba(255,255,255,0.1); }
.crop-btn.primary:hover { background: var(--brand-dark); }
.crop-stage {
  flex: 1; position: relative; overflow: hidden;
  background: #000; min-height: 200px;
  touch-action: none;
}
.crop-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.crop-stage canvas:active { cursor: grabbing; }
.crop-controls {
  background: rgba(0,0,0,0.85);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.crop-aspects { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.crop-aspect-btn {
  background: rgba(255,255,255,0.1);
  border: 0; color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 7px 14px; border-radius: 100px;
  cursor: pointer; font-family: inherit;
  transition: background .12s;
}
.crop-aspect-btn:hover { background: rgba(255,255,255,0.18); }
.crop-aspect-btn.active { background: var(--brand); color: #fff; }
.crop-zoom-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.crop-zoom-row i { color: #fff; font-size: 14px; flex-shrink: 0; }
.crop-zoom-row input[type="range"] { flex: 1; accent-color: var(--brand); height: 4px; cursor: pointer; }
.crop-reset {
  background: rgba(255,255,255,0.1); border: 0; color: #fff;
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.crop-reset:hover { background: rgba(255,255,255,0.18); }
.crop-hint { text-align: center; color: rgba(255,255,255,0.55); font-size: 11.5px; margin-top: 6px; }

/* ============================================================
   USERNAME
============================================================ */
.username-input-wrap { position: relative; display: flex; align-items: center; }
.username-input-wrap .at-sign {
  position: absolute; left: 14px;
  font-size: 15px; font-weight: 700;
  color: var(--text-2); pointer-events: none;
}
.username-input-wrap input { padding-left: 32px; }
.username-availability { font-size: 12.5px; margin-top: 6px; min-height: 16px; font-weight: 600; }
.username-availability.available { color: #16a34a; }
.username-availability.taken { color: #dc2626; }
.username-availability.checking { color: var(--text-3); }

.form-msg { font-size: 13px; font-weight: 600; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; display: none; }
.form-msg.error { display: block; background: #fef2f2; color: #b91c1c; }
.form-msg.success { display: block; background: #f0fdf4; color: #15803d; }
html[data-theme="dark"] .form-msg.error { background: rgba(220,38,38,0.15); }
html[data-theme="dark"] .form-msg.success { background: rgba(22,163,74,0.15); }

.action-btn { border: 0; border-radius: 100px; padding: 11px 20px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.action-btn.primary { background: var(--brand); color: #fff; }
.action-btn.secondary { background: var(--bg-soft); color: var(--text); }
.action-btn.full { width: 100%; margin-top: 8px; }
.action-btn.full:first-child { margin-top: 0; }

/* ============================================================
   USER LIST
============================================================ */
.user-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.user-list-item:hover { background: var(--hover); }
.user-list-item:last-child { border-bottom: 0; }
.user-list-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #d4af37);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; overflow: hidden; flex-shrink: 0;
}
.user-list-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-list-name { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.user-list-username { font-size: 13px; color: var(--text-2); }
.user-list-bio { font-size: 13px; color: var(--text-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.user-list-follow-btn {
  padding: 6px 14px;
  background: var(--text); color: var(--bg);
  border: 0; border-radius: 100px;
  font-size: 12.5px; font-weight: 800;
  cursor: pointer; font-family: inherit;
  flex-shrink: 0;
  transition: opacity .15s;
}
.user-list-follow-btn:hover { opacity: 0.9; }
.user-list-follow-btn.following { background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--border-strong); }

/* ============================================================
   COMMENTS
============================================================ */
.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: 0; }
.comment-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #d4af37);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
  flex-shrink: 0; overflow: hidden;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-name { font-size: 14px; font-weight: 700; }
.comment-text { font-size: 14px; color: var(--text); margin-top: 2px; line-height: 1.4; }
.comment-time { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.comment-input-row { display: flex; gap: 8px; align-items: center; }
.comment-input-row input {
  flex: 1; padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 14px; font-family: inherit;
  outline: none; min-width: 0;
  background: var(--bg); color: var(--text);
}
.comment-input-row input:focus { border-color: var(--brand); }

/* ============================================================
   TOASTS
============================================================ */
.toast-container {
  position: fixed; top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 32px); max-width: 380px;
  pointer-events: none;
}
.toast {
  padding: 13px 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  pointer-events: auto;
  animation: toastIn .25s cubic-bezier(.22,1,.36,1);
}
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.success { background: #15803d; }
.toast.error { background: #dc2626; }
.toast.info { background: var(--text); }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 480px) {
  .post { padding: 10px 12px; }
  .post-row { gap: 8px; }
  .post-avatar { width: 36px; height: 36px; font-size: 13px; }
  .post-titre { font-size: 15.5px; padding-right: 84px; margin-bottom: 4px; }
  .post-head { padding-right: 84px; font-size: 12.5px; margin-bottom: 4px; }
  .post-actions { margin-top: 6px; margin-left: -4px; }
  .post-action { padding: 5px; font-size: 11.5px; }
  .post-action i { font-size: 14px; }
  .px-header { padding: 0 12px; }
  .px-info { padding: 10px 12px 12px; }
  .px-name { font-size: 18px; }
  .px-username { font-size: 14px; margin-bottom: 10px; }
  .px-bio { font-size: 14px; }
  .px-meta-row { font-size: 13px; }
  .px-follow-counts { font-size: 13px; gap: 16px; }
  .px-btn { padding: 7px 14px; font-size: 13px; }
  .dropdown-menu { width: calc(100vw - 24px); }
  .cert-modal-body { padding: 0 18px 20px; }
  .cert-badge-large { width: 68px; height: 68px; }
  .cert-badge-large svg { width: 68px; height: 68px; }
  .px-popup-header { padding: 10px 12px; gap: 10px; }
  .px-popup-title { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
