/* =============================================================
   topbar.css — Phase 4 refonte architecture
   -------------------------------------------------------------
   Styles du composant topbar partagé (ui/topbar/topbar.js).
   Appliqué sur les pages qui exposent <div id="smyle-topbar"></div>.
   Aussi chargé sur index.html + dashboard.html pour les icônes
   messagerie/notifs via page-services.js.
   ============================================================= */

/* ── Icônes services (page-services.js — index + dashboard) ── */

.page-icon-services {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-icon-wrap {
  position: relative;
}

.page-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.page-icon-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}

.page-icon-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.stb-root {
  position: sticky;
  top: 0;
  z-index: 90;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 10px 18px;
  background: rgba(10, 6, 22, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 56px;
}

@media (max-width: 720px) {
  .stb-root {
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 8px 12px;
  }
  /* Sur mobile on replie la nav dans le dropdown — on la masque ici
     parce que les 2 liens restants sont accessibles via le menu user. */
  .stb-nav { display: none; }
}


/* ── Logo ───────────────────────────────────────────────────────── */

.stb-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  letter-spacing: 0.08em;
  font-weight: 800;
  font-size: 14px;
  transition: opacity 0.15s;
}

.stb-logo:hover { opacity: 0.85; }

.stb-logo svg {
  width: 22px;
  height: 30px;
  transform: rotate(-11deg);
  flex-shrink: 0;
}

.stb-logo-text {
  text-transform: uppercase;
}


/* ── Nav (centre) ───────────────────────────────────────────────── */

.stb-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-self: center;
}

.stb-nav-link {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.stb-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}


/* ── Côté droit ─────────────────────────────────────────────────── */

.stb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.stb-balance-slot {
  /* smyle-balance.js injecte son widget ici. Si rien n'est injecté
     (ex. user anonyme), la slot reste vide, pas de place réservée. */
  display: contents;
}


/* ── Bouton MY MIX ──────────────────────────────────────────────── */

.stb-mymix {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.stb-mymix:hover {
  background: rgba(255, 215, 0, 0.10);
  border-color: rgba(255, 215, 0, 0.35);
  color: #fff;
}

.stb-mymix-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(255, 215, 0, 0.85);
  color: #1a0030;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}


/* ── Chip utilisateur ───────────────────────────────────────────── */

.stb-user-wrap {
  position: relative;
}

.stb-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.stb-user-chip:hover,
.stb-user-wrap-open .stb-user-chip {
  background: rgba(255, 255, 255, 0.08);
}

.stb-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--stb-user-color, #7C3AED);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.stb-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stb-user-name {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stb-user-caret {
  opacity: 0.6;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.stb-user-wrap-open .stb-user-caret {
  transform: rotate(180deg);
}

@media (max-width: 540px) {
  .stb-user-name { display: none; }
}


/* ── Dropdown ───────────────────────────────────────────────────── */

.stb-user-drop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  padding: 6px;
  background: rgba(20, 10, 40, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
}

/* P1-B11 (2026-05-11) — Force le masquage quand l'attribut HTML `hidden`
   est présent. Sans cette règle, `display: flex` ci-dessus override le
   comportement natif de [hidden], et le dropdown reste affiché en
   permanence sur toutes les pages (bug visible sur /u/<slug>, /library,
   /, etc.). Le toggle JS dans topbar.js set/unset l'attribut hidden au
   clic — cette règle CSS rend l'attribut effectif. */
.stb-user-drop[hidden] {
  display: none;
}

.stb-drop-item {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  transition: background 0.12s, color 0.12s;
}

.stb-drop-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.stb-drop-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

.stb-drop-logout {
  color: rgba(255, 120, 120, 0.9);
}

.stb-drop-logout:hover {
  background: rgba(255, 80, 80, 0.12);
  color: #ff9a9a;
}


/* ── Enveloppe messagerie ───────────────────────────────────────── */

.stb-msg-wrap {
  position: relative;
}

.stb-msg-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.70);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.stb-msg-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.stb-msg-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #7C3AED;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

.stb-msg-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-height: 400px;
  background: rgba(16, 8, 36, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.stb-msg-panel[hidden] { display: none; }

.stb-msg-header {
  display: flex;
  align-items: center;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.stb-msg-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
}

.stb-msg-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.stb-msg-thread {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  width: 100%;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s;
}

.stb-msg-thread:hover {
  background: rgba(255, 255, 255, 0.04);
}

.stb-msg-unread {
  background: rgba(124, 58, 237, 0.08);
}

.stb-msg-unread:hover {
  background: rgba(124, 58, 237, 0.14);
}

.stb-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.35);
  border: 1px solid rgba(124, 58, 237, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.stb-msg-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.stb-msg-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stb-msg-preview {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stb-msg-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.stb-msg-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.58);
}

.stb-msg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7C3AED;
}

.stb-msg-empty {
  padding: 28px 14px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.58);
}

@media (max-width: 480px) {
  .stb-msg-panel {
    width: calc(100vw - 24px);
    right: -12px;
  }
}


/* ── Cloche notifications ───────────────────────────────────────── */

.stb-notif-wrap {
  position: relative;
}

.stb-notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.70);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.stb-notif-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.stb-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

.stb-notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  max-height: 440px;
  background: rgba(16, 8, 36, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.stb-notif-panel[hidden] { display: none; }

.stb-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.stb-notif-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
}

.stb-notif-readall {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.72);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  font-family: inherit;
  transition: color 0.15s;
}

.stb-notif-readall:hover { color: #fff; }

.stb-notif-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.stb-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.90);
  transition: background 0.12s;
  cursor: pointer;
}

.stb-notif-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.stb-notif-unread {
  background: rgba(59, 130, 246, 0.12);
  border-left: 2px solid #3b82f6;
}

.stb-notif-unread:hover {
  background: rgba(59, 130, 246, 0.18);
}

.stb-notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--ni-color, #6b7280) 30%, transparent);
}

.stb-notif-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.stb-notif-text {
  font-size: 12px;
  line-height: 1.45;
  color: #fff;
}

.stb-notif-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.60);
  letter-spacing: 0.02em;
}

.stb-notif-followback {
  flex-shrink: 0;
  align-self: center;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.stb-notif-followback:hover {
  background: rgba(59, 130, 246, 0.3);
}

.stb-notif-followback-done {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
  cursor: default;
}

.stb-notif-empty {
  padding: 28px 14px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.60);
}

@media (max-width: 480px) {
  .stb-notif-panel {
    width: calc(100vw - 24px);
    right: -12px;
  }
}


/* ── CTA anonyme ────────────────────────────────────────────────── */

.stb-auth-cta {
  padding: 8px 16px;
  background: rgba(255, 215, 0, 0.14);
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 8px;
  color: #ffd700;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.stb-auth-cta:hover {
  background: rgba(255, 215, 0, 0.22);
  transform: translateY(-1px);
}
