/* ========== BARRE DE TITRE PERSONNALISÉE ========== */
.custom-titlebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  overflow: visible;
  background: var(--titlebar-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10000;
  border-bottom: 1px solid var(--titlebar-border);
  user-select: none;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.titlebar-drag-region {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 15px;
  flex: 1;
  height: 100%;
  overflow: visible;
  -webkit-app-region: drag;
}

.titlebar-logo {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--titlebar-text);
}

.titlebar-title {
  font-family: 'Satoshi', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--titlebar-text);
  letter-spacing: 0.3px;
}

/* ========== NAVIGATION BUTTONS ========== */
.titlebar-navigation {
  display: flex;
  gap: 4px;
  margin-left: 12px;
  -webkit-app-region: no-drag;
}

.titlebar-nav-button {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border-color-dark);
  border-radius: 6px;
  color: var(--titlebar-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}

.titlebar-nav-button:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--border-color-dark);
}

.titlebar-nav-button:active:not(:disabled) {
  background: var(--border-color);
  transform: scale(0.95);
}

.titlebar-nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.titlebar-nav-button svg {
  pointer-events: none;
}

.titlebar-controls {
  display: flex;
  height: 100%;
  -webkit-app-region: no-drag;
}

.titlebar-button {
  width: 46px;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--titlebar-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
  padding: 0;
}

.titlebar-button:hover {
  background: var(--bg-secondary);
}

.titlebar-button:active {
  background: var(--border-color);
}

.titlebar-button.close-btn:hover {
  background: #e81123;
  color: #ffffff;
}

.titlebar-button.close-btn:active {
  background: #c50f1f;
}

.titlebar-button svg {
  pointer-events: none;
}

/* ========== CRÉDITS DANS LA BARRE DE TITRE ========== */
.titlebar-credits {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Satoshi', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--titlebar-text);
  margin-left: auto;
  margin-right: 20px;
  -webkit-app-region: no-drag;
  cursor: default;
}

.credits-pool {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 0;
  border: none;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.credits-pool__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.credits-pool__dot--free {
  background: #4caf50;
}

.credits-pool__dot--premium {
  background: #4b8ef1;
}

.credits-pool__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  opacity: 0.6;
}

.credits-pool__value {
  font-size: 12px;
  font-weight: 700;
}

/* Pool actif */
.credits-pool--active .credits-pool__label {
  opacity: 1;
}

/* Pool inactif (verrouillé) */
.credits-pool--locked {
  opacity: 0.35;
  cursor: pointer;
}

.credits-pool-sep {
  width: 1px;
  height: 14px;
  background: var(--titlebar-text, rgba(128,128,128,0.5));
  opacity: 0.35;
  margin: 0 2px;
}

/* Tooltip sous la zone crédits — spécificité > .lc-tooltip (shared.css après titlebar)
   sinon bottom:hérité de .lc-tooltip + top ici = boîte à hauteur effondrée */
.lc-tooltip.credits-titlebar-tooltip {
  top: calc(100% + 8px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: max-content;
  max-width: min(280px, calc(100vw - 48px));
  box-sizing: border-box;
  text-align: left;
  line-height: 1.6;
  white-space: normal;
  z-index: 10002;
}

.credits-pool:hover .lc-tooltip.credits-titlebar-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.lc-tooltip-trigger:hover .lc-tooltip.credits-titlebar-tooltip {
  transform: translateX(-50%) translateY(0);
}

/* ========== GUEST PREVIEW — BOUTONS LOGIN TITLEBAR ========== */
.titlebar-guest-login {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 16px;
  flex-shrink: 0;
  -webkit-app-region: no-drag;
}

.titlebar-guest-btn {
  height: 30px;
  padding: 0 18px;
  border-radius: 999px;          /* pill — identique au site web */
  font-family: 'Satoshi', 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: opacity 0.15s ease, background 0.15s ease;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.titlebar-guest-btn:hover { opacity: 0.8; }

/* "Log in" — contour pill discret */
.titlebar-guest-btn--login {
  background: transparent;
  border: 1.5px solid var(--border-color-dark, #3A3A3A);
  color: var(--titlebar-text, #fff);
}

/* "Create account" — pill plein blanc */
.titlebar-guest-btn--register {
  background: var(--text-primary, #fff);
  border: 1.5px solid transparent;
  color: var(--bg-primary, #282828);
}

/* ========== TRAFFIC LIGHTS macOS ========== */
.mac-titlebar-controls {
  display: none; /* caché par défaut, activé via .platform-mac */
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 100%;
  flex-shrink: 0;
  -webkit-app-region: no-drag;
}

.mac-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: filter 0.1s ease;
  position: relative;
}

.mac-btn--close   { background: #FF5F57; }
.mac-btn--minimize { background: #FEBC2E; }
.mac-btn--zoom    { background: #28C840; }

.mac-btn-icon {
  opacity: 0;
  transition: opacity 0.1s ease;
  pointer-events: none;
  color: rgba(0,0,0,0.5);
}

.mac-titlebar-controls:hover .mac-btn-icon {
  opacity: 1;
}

.mac-btn:hover {
  filter: brightness(0.85);
}

.mac-btn:active {
  filter: brightness(0.7);
}

/* Mode inactif (fenêtre sans focus) */
.custom-titlebar.window-inactive .mac-btn--close,
.custom-titlebar.window-inactive .mac-btn--minimize,
.custom-titlebar.window-inactive .mac-btn--zoom {
  background: #C0C0C0;
}

/* ── Activation par plateforme ── */
.custom-titlebar.platform-mac .mac-titlebar-controls {
  display: flex;
}

.custom-titlebar.platform-mac .titlebar-controls {
  display: none;
}

/* Sur macOS, décaler la drag region pour laisser la place aux traffic lights */
.custom-titlebar.platform-mac .titlebar-drag-region {
  padding-left: 8px;
}

/* ========== AJUSTEMENTS DE LAYOUT ========== */
/* NE PAS toucher au body ! Cibler uniquement les sections */
#login {
  position: fixed;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 0;
  padding-top: 0;
  box-sizing: border-box;
  overflow: visible;
}

#app {
  padding-top: 40px;
  height: calc(100vh - 40px);
}

/* Ajuster le contenu principal pour avoir de l'espace avec la barre de titre */
/* Le .content a déjà padding: 32px dans global.css, on l'augmente */
.content {
  padding-top: 60px !important; /* 40px barre + 20px espace = 60px total */
}

/* Ajuster le header de la sidebar pour éviter le chevauchement */
/* Réduire le padding pour rapprocher le logo des icônes */
.side-panel-header {
  margin-top: 40px;
  padding-top: 12px !important; /* Réduire de 24px à 12px */
  padding-bottom: 12px !important; /* Réduire aussi le bas pour cohérence */
}

/* S'assurer que rien ne passe sous la barre de titre */
.custom-titlebar ~ * {
  position: relative;
}

