/* =============================================================================
   DASHBOARD CSS — Layout et composants
   Adapté depuis RUST_SOS_2026v0.1/src/styles/dashboard.css
   ============================================================================= */

/* ===================== Bande d'information jaune ===================== */
.bande-info {
  height: 28px;
  background: #facc15;
  overflow: hidden;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: calc(var(--z-index-topbar, 1000) + 1);
}
.bande-info-defilement {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  animation: bande-info-defilement 28s linear infinite;
  padding-left: 100%;
}
.bande-info-texte {
  color: #000;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.bande-info-texte a {
  color: #000;
  text-decoration: underline;
  font-weight: 700;
}
.bande-info-texte a:hover {
  text-decoration: none;
  opacity: 0.7;
}
@keyframes bande-info-defilement {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ===================== Topbar ===================== */
.topbar {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--gradient-topbar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 38px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-shrink: 0;
  position: relative;
  z-index: var(--z-index-topbar);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Bouton retour à l'accueil (à côté du logo) — vert fluo */
.topbar-btn.topbar-btn-accueil {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid rgba(163, 230, 53, 0.6);
  background: rgba(163, 230, 53, 0.1);
  color: #a3e635;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-rapide);
  flex-shrink: 0;
}
.topbar-btn.topbar-btn-accueil:hover {
  background: rgba(163, 230, 53, 0.2);
  border-color: rgba(163, 230, 53, 1);
  color: #bef264;
  box-shadow: 0 0 12px rgba(163, 230, 53, 0.4);
}

.logo-img {
  height: clamp(115.2px, 14.4vh, 207px);
  width: auto;
  display: block;
  user-select: none;
  pointer-events: none;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-separateur {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Sélecteur de langue FR / EN (style version Rust) --- */
.langue-selecteur {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  flex-shrink: 0;
}

.langue-bouton {
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  background: none;
  border: none;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.55);
  font-size: var(--dashboard-ui-font-size-small, 10px);
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--transition-rapide, 0.15s ease);
}

.langue-bouton:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
}

.langue-bouton.actif {
  background: rgba(103, 232, 249, 0.16);
  color: #67e8f9;
  box-shadow: inset 0 0 0 1px rgba(103, 232, 249, 0.32);
}

.clock {
  font-size: var(--dashboard-ui-font-size);
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.date {
  font-size: var(--dashboard-ui-font-size-small);
  color: rgba(255, 255, 255, 0.7);
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

/* Raccourcis topbar */
.topbar-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all var(--transition-rapide);
  flex-shrink: 0;
}
.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}
.topbar-btn.active {
  border-color: currentColor;
  background: color-mix(in srgb, currentColor 12%, transparent);
  color: currentColor;
}

/* ===================== Infobulles topbar =====================
   Tooltip custom sur les boutons de la topbar (home, créer widget, etc.)
   Utilise data-tooltip + ::after (texte) + ::before (flèche).
   Apparaît en dessous du bouton au survol. */
.topbar-btn, .topbar-btn-accueil {
  position: relative;
}
.topbar-btn[data-tooltip]::after,
.topbar-btn-accueil[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  white-space: nowrap;
  padding: 5px 10px;
  background: rgba(10, 10, 15, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: var(--z-index-topbar, 1000);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.topbar-btn[data-tooltip]::before,
.topbar-btn-accueil[data-tooltip]::before {
  content: '';
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid rgba(255, 255, 255, 0.15);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: var(--z-index-topbar, 1000);
}
.topbar-btn:hover[data-tooltip]::after,
.topbar-btn-accueil:hover[data-tooltip]::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.topbar-btn:hover[data-tooltip]::before,
.topbar-btn-accueil:hover[data-tooltip]::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Indicateur de connexion OBS */
.connexion-indicateur {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: var(--dashboard-ui-font-size-small);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.connexion-indicateur.connecte {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}
.connexion-indicateur.deconnecte {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}
.connexion-indicateur.en-cours {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.point-connexion {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}
.connexion-indicateur.connecte .point-connexion {
  animation: pulse-vert 2s ease-in-out infinite;
}
@keyframes pulse-vert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===================== Main Content ===================== */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ===================== Sidebar ===================== */
.sidebar {
  width: 220px;
  padding: 12px 10px;
  background: rgba(10, 10, 15, 0.5);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(103, 232, 249, 0.3) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(103, 232, 249, 0.25); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(103, 232, 249, 0.45); }

/* Labels de groupe */
.sidebar-groupe-label {
  margin: 14px 4px 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}
.sidebar-groupe-label:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 10px;
}

/* Dashboard Button */
.dashboard-btn {
  position: relative;
  overflow: hidden;
  border-radius: var(--global-border-radius);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
  color: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 26px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  min-height: 36px;
  flex: 0 0 36px;
  padding: 0 12px;
  box-sizing: border-box;
  font-size: var(--dashboard-ui-font-size);
  font-weight: 600;
  text-align: center;
  transition: border-color var(--transition-normale), background var(--transition-normale), color var(--transition-normale), box-shadow var(--transition-normale);
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}
.dashboard-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(103, 232, 249, 0.25), transparent);
  transition: left 0.5s ease;
  pointer-events: none;
}
.dashboard-btn:hover::before { left: 100%; }
.dashboard-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.35), rgba(167, 139, 250, 0.28), rgba(255, 255, 255, 0.06));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  transition: opacity var(--transition-normale);
}
.dashboard-btn:hover::after { opacity: 0.85; }
.dashboard-btn:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--gradient-interface);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 16px 34px rgba(0, 0, 0, 0.3);
}
.dashboard-btn:active { transform: scale(0.99); }
.dashboard-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-text { flex: 1; }
.btn-arrow {
  font-size: 8px;
  opacity: 0.5;
  transition: transform var(--transition-normale);
}
.dashboard-btn.active .btn-arrow {
  transform: rotate(180deg);
  opacity: 1;
}
.dashboard-btn.active {
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--gradient-interface);
  color: var(--text-primary);
}

/* Section toggle — flèche */
.section-toggle .btn-arrow {
  font-size: 10px;
  opacity: 0.9;
  transition: transform var(--transition-rapide), color var(--transition-rapide);
  color: #a78bfa;
}
.section-toggle.active .btn-arrow {
  color: #22ff88;
  opacity: 1;
}

/* Sous-section */
.section-contenu {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 6px;
  padding: 6px 0 6px 12px;
  border-left: 2px solid rgba(103, 232, 249, 0.15);
  margin-left: 10px;
}
.sous-bouton {
  padding: 0 10px;
  font-size: var(--dashboard-ui-font-size-small);
  opacity: 0.9;
  justify-content: flex-start;
  text-align: left;
}
.sous-bouton:hover {
  opacity: 1;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.22), rgba(255, 255, 255, 0.08));
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.25), inset 0 0 8px rgba(255, 255, 255, 0.06);
  color: #ffffff;
}
.sous-bouton.active {
  opacity: 1;
  border-color: rgba(103, 232, 249, 0.3);
}

/* Alternance vert / bleu pour sections */
.section-verte {
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.04);
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.06);
}
.section-verte:hover {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2);
}
.section-verte.active {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.12);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}
.section-bleue {
  border-color: rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.04);
  box-shadow: 0 0 4px rgba(59, 130, 246, 0.06);
}
.section-bleue:hover {
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}
.section-bleue.active {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}
.section-teal {
  border-color: rgba(20, 184, 166, 0.25);
  background: rgba(20, 184, 166, 0.04);
  box-shadow: 0 0 4px rgba(20, 184, 166, 0.06);
}
.section-teal:hover {
  border-color: rgba(20, 184, 166, 0.5);
  background: rgba(20, 184, 166, 0.1);
  box-shadow: 0 0 10px rgba(20, 184, 166, 0.2);
}
.section-teal.active {
  border-color: rgba(20, 184, 166, 0.6);
  background: rgba(20, 184, 166, 0.12);
  box-shadow: 0 0 12px rgba(20, 184, 166, 0.25);
}

/* Boutons spéciaux sidebar */
.btn-reinitialiser {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.08);
  color: rgba(252, 165, 165, 0.85);
  font-size: 11px;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}
.btn-reinitialiser:hover {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(239, 68, 68, 0.15);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
  color: rgba(252, 165, 165, 1);
}
.btn-icone-danger { font-size: 14px; line-height: 1; opacity: 0.8; }

/* Lien Mentions légales en bas de la sidebar */
.sidebar-lien-legal {
  display: block;
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  padding: 4px 0 2px;
  transition: color 0.15s ease;
}
.sidebar-lien-legal:hover {
  color: rgba(103, 232, 249, 0.85);
  text-decoration: underline;
}

.btn-bienvenue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(103, 232, 249, 0.35);
  background: rgba(103, 232, 249, 0.06);
  box-shadow: 0 0 4px rgba(103, 232, 249, 0.08);
  color: rgba(103, 232, 249, 0.85);
  font-size: 11px;
  transition: all 0.2s ease;
  margin-bottom: 8px;
}
.btn-bienvenue:hover {
  border-color: rgba(103, 232, 249, 0.7);
  background: rgba(103, 232, 249, 0.15);
  box-shadow: 0 0 12px rgba(103, 232, 249, 0.25);
  color: rgba(103, 232, 249, 1);
}
.btn-icone-bienvenue { font-size: 14px; line-height: 1; opacity: 0.8; }

/* ===================== Canvas Area ===================== */
.canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.3);
  position: relative;
  overflow: hidden;
}

.canvas-wrapper {
  position: relative;
  /* Le canvas 1920x1080 est mis à l'échelle par JS pour rentrer dans la zone */
}

.canvas-1920 {
  width: 1920px;
  height: 1080px;
  position: relative;
  background: #000;
  overflow: hidden;
  transform-origin: top left;
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.1), 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ===================== Fond de scène (média) =====================
   Conteneur du fond + élément média (img/vidéo) — port de CompositionCanvas.svelte.
   Permet de supporter object-fit (mode rempli), transform (rotation/tilt) et
   filter (luminosité/contraste) sur le fond, contrairement à background-image CSS. */
.canvas-fond-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.fond-media {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  transform-origin: center center;
  pointer-events: none;
}

/* ===================== Guides d'alignement (dashboard uniquement) ===================== */
/* Canvas overlay 1920×1080 (coordonnées logiques) — portage de AlignmentGuides.svelte.
   pointer-events: none pour ne pas bloquer le drag. z-index élevé pour être
   au-dessus des widgets mais sous les modales. */
.alignment-guides-canvas {
  position: absolute;
  inset: 0;
  width: 1920px;
  height: 1080px;
  pointer-events: none;
  z-index: 9999;
}

.placeholder-text {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.3);
}
.placeholder-title {
  font-size: 24px;
  font-weight: bold;
  background: var(--gradient-texte);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.placeholder-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

/* ===================== Widgets ===================== */
.widget {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color var(--transition-rapide), box-shadow var(--transition-rapide);
  user-select: none;
  cursor: grab;
}
.widget:hover {
  border-color: rgba(103, 232, 249, 0.3);
}
.widget.selected {
  border-color: rgba(103, 232, 249, 0.6);
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.3), 0 0 20px rgba(103, 232, 249, 0.15);
}
.widget.locked { opacity: 0.7; cursor: default; }
.widget:active { cursor: grabbing; }
.widget.locked:active { cursor: default; }
.widget.mode-flottant {
  border: none;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.widget-header {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.08), rgba(167, 139, 250, 0.06));
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: grab;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  flex-shrink: 0;
}
.widget-header:active { cursor: grabbing; }
.widget.mode-flottant .widget-header { display: none; }

/* Éléments interactifs : pas de curseur grab */
.widget video,
.widget iframe,
.widget .widget-chat-messages,
.widget input,
.widget select,
.widget textarea,
.widget a,
.widget button {
  cursor: default;
}

.widget-titre {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-actions {
  display: flex;
  gap: 4px;
}
.widget-action {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
  transition: all var(--transition-rapide);
}
.widget-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}
.widget-action.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.widget-body {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* ===================== TROU OBS =====================
   Un widget marqué trouObs devient un trou transparent en diffusion,
   permettant de voir une source OBS (ex: capture de jeu) placée en
   dessous de la source SOS à travers le widget.
   Dashboard : bordure pointillée cyan + label "OBS".
   Diffusion (.readonly) : totalement transparent. */

/* Dashboard : prévisualisation du trou — bordure pointillée cyan */
.widget.trou-obs:not(.readonly) {
  outline: 2px dashed rgba(103, 232, 249, 0.6);
  outline-offset: -2px;
}
/* Label "OBS" centré dans le widget trou (dashboard uniquement) */
.trou-obs-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 900;
  color: rgba(103, 232, 249, 0.4);
  letter-spacing: 4px;
  pointer-events: none;
  text-shadow: 0 0 12px rgba(103, 232, 249, 0.6);
  z-index: 100;
  user-select: none;
}

/* Diffusion (readonly) : le widget devient totalement transparent */
.widget.trou-obs.readonly {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}
.widget.trou-obs.readonly .widget-body {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}
/* Tout le contenu du body est masqué en diffusion — seul le trou reste */
.widget.trou-obs.readonly .widget-body > * {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Resize handle — poignée bas-droite + zones de grab sur les bords.
   Taille en px canvas (1920x1080) : 28x28px pour la poignée coin,
   ~24px pour les bords. Au scale 0.5 → ~14px / 12px à l'écran, largement
   suffisant pour attraper. */
.widget-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 55%, rgba(103, 232, 249, 0.5) 55%);
  border-bottom-right-radius: 8px;
  z-index: 10;
}
.widget.mode-flottant .widget-resize {
  background: linear-gradient(135deg, transparent 55%, rgba(103, 232, 249, 0.25) 55%);
}
/* Zone de grab verticale (bord bas) — permet de resize la hauteur
   sans devoir viser exactement le coin. Largeur = tout le bord bas
   moins la poignée coin, hauteur = 14px.
   Active uniquement sur les widgets sélectionnés pour ne pas bloquer
   les interactions (chat, vidéo) quand le widget n'est pas sélectionné. */
.widget-resize-edge-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 28px;
  height: 14px;
  cursor: ns-resize;
  z-index: 9;
  pointer-events: none;
}
.widget.selected .widget-resize-edge-bottom {
  pointer-events: auto;
}
/* Zone de grab horizontale (bord droit) */
.widget-resize-edge-right {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 28px;
  width: 14px;
  cursor: ew-resize;
  z-index: 9;
  pointer-events: none;
}
.widget.selected .widget-resize-edge-right {
  pointer-events: auto;
}

/* Contenu widget */
.widget-vide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255, 255, 255, 0.2);
  font-size: 13px;
}
.widget-media img,
.widget-media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.widget-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px;
  gap: 4px;
  overflow-y: auto;
  font-size: 12px;
}
.chat-message {
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.chat-pseudo {
  font-weight: 700;
  flex-shrink: 0;
}
.chat-texte {
  color: rgba(255, 255, 255, 0.85);
  word-break: break-word;
}
.widget-input-viewer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  height: 100%;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
}
.widget-camera {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #111;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
}
.widget-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===================== Modal Overlay ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-index-modales);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normale);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background: linear-gradient(180deg, rgba(9, 14, 28, 0.98), rgba(5, 9, 18, 0.99));
  border: 1px solid rgba(103, 232, 249, 0.22);
  border-radius: var(--global-border-radius);
  box-shadow: 0 0 0 1px rgba(103, 232, 249, 0.08), 0 32px 80px rgba(0, 0, 0, 0.72);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform var(--transition-normale);
  display: flex;
  flex-direction: column;
}
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.14), rgba(167, 139, 250, 0.10));
  flex: 0 0 auto;
}
.modal-title {
  font-size: var(--dashboard-ui-font-size);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-title::before {
  content: '◈';
  font-size: 14px;
  filter: drop-shadow(0 0 6px rgba(103, 232, 249, 0.6));
}
.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all var(--transition-rapide);
  font-size: 14px;
}
.modal-close:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.3);
  color: rgba(251, 113, 133, 0.92);
}
.modal-body {
  padding: 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
  flex: 0 0 auto;
}

/* Champs de formulaire */
.form-groupe {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-label {
  font-size: var(--dashboard-ui-font-size);
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.form-input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: var(--dashboard-ui-font-size);
  font-family: var(--police-monospace);
  transition: all var(--transition-rapide);
}
.form-input:focus {
  outline: none;
  border-color: rgba(103, 232, 249, 0.5);
  background: rgba(103, 232, 249, 0.04);
  box-shadow: 0 0 0 3px rgba(103, 232, 249, 0.1);
}
.form-input::placeholder { color: rgba(255, 255, 255, 0.3); }
.form-aide {
  font-size: var(--dashboard-ui-font-size-small);
  color: rgba(255, 255, 255, 0.4);
}

/* Boutons modale */
.btn-principal {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid rgba(103, 232, 249, 0.3);
  background: var(--gradient-interface);
  color: var(--text-primary);
  font-size: var(--dashboard-ui-font-size);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-rapide);
  font-family: inherit;
}
.btn-principal:hover {
  border-color: rgba(103, 232, 249, 0.6);
  box-shadow: 0 0 16px rgba(103, 232, 249, 0.2);
  transform: translateY(-1px);
}
.btn-principal:active { transform: scale(0.98); }
.btn-secondaire {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--dashboard-ui-font-size);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-rapide);
  font-family: inherit;
}
.btn-secondaire:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.message-erreur {
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #f87171;
  font-size: var(--dashboard-ui-font-size);
  margin-bottom: 16px;
}

/* Grille de cartes (création de widget) */
.widget-type-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.widget-type-carte {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: all var(--transition-rapide);
  text-align: center;
  font-family: inherit;
  color: var(--text-primary);
}
.widget-type-carte:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(103, 232, 249, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(103, 232, 249, 0.1);
}
.widget-type-icone { font-size: 28px; }
.widget-type-nom { font-size: 12px; font-weight: 700; }
.widget-type-info {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 1.4;
}

/* Notifications (toasts) */
.notifications-overlay {
  position: fixed;
  top: 60px;
  right: 16px;
  z-index: var(--z-index-notifications);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.3s ease;
  pointer-events: auto;
  max-width: 320px;
}
.toast.succes {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
}
.toast.erreur {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}
.toast.info {
  background: rgba(103, 232, 249, 0.15);
  border: 1px solid rgba(103, 232, 249, 0.4);
  color: #67e8f9;
}
.toast.attention {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* =============================================================================
   WIDGET OPTIONS PANEL — Panneau contextuel en haut de la sidebar
   -----------------------------------------------------------------------------
   Section rouge quand un widget est sélectionné, verte pour le fond.
   Adapté depuis RUST_SOS_2026v0.1/src/lib/composants/WidgetOptionsPanel.svelte
   ============================================================================= */
.widget-options-panel {
  width: 100%;
  flex-shrink: 0;
}

.options-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Section widget sélectionné — rouge (section-streaming) */
.widget-section {
  background: var(--section-streaming-bg);
  border-color: var(--section-streaming-glow);
}

/* Section fond de l'application — vert (section-medias) */
.fond-section {
  background: var(--section-medias-bg);
  border-color: var(--section-medias-glow);
}

.options-entete {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
.options-entete-toggle {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.options-entete-toggle:hover { filter: brightness(1.15); }
.options-titre { flex: 1; }
.options-fleche { font-size: 10px; opacity: 0.7; }

.widget-section .options-entete { color: var(--section-streaming); }
.fond-section .options-entete { color: var(--section-medias); }

.options-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
.info-ligne {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
}
.info-ligne-editable { align-items: center; }
.info-label {
  color: rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}
.info-valeur {
  color: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

/* Input éditable (titre) */
.info-input {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  font-size: 10px;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  outline: none;
  transition: border-color 0.15s ease;
}
.info-input:focus { border-color: rgba(103, 232, 249, 0.5); }
/* Champ URL long (GamePadViewer) : reste contenu dans la sidebar, police
   monospace plus petite pour voir un maximum d'URL sans débordement. */
.info-ligne-url { overflow: hidden; }
.info-input-url {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-family: var(--police-monospace, ui-monospace, monospace);
  font-size: 9px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Slider de volume */
.info-ligne-volume { gap: 8px; padding: 4px 0; }
.info-slider {
  flex: 1;
  min-width: 0;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.info-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #dc2626;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}
.info-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.info-valeur-volume {
  min-width: 32px;
  font-family: var(--police-monospace);
  font-size: 10px;
}

.options-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Bouton option (compact) */
.btn-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
  font-family: inherit;
}
.btn-option > span:first-child { flex: 1; }
.btn-fleche { flex: 0 0 auto; font-size: 9px; opacity: 0.6; }

/* --- Sous-carte de mise en forme (transformations, filtres, bordure, ombre) --- */
.options-sous-carte {
  padding: 8px 10px;
  margin: 4px 0 8px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.options-sous-carte .info-ligne {
  margin: 0;
}
.info-ligne-checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.info-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}
.info-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: #67e8f9;
  cursor: pointer;
}
.info-color {
  width: 28px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.btn-mini {
  font-size: 10px !important;
  padding: 5px 8px !important;
  opacity: 0.7;
}
.btn-mini:hover { opacity: 1; }

/* État actif (carte ouverte) */
.widget-section .btn-option.active {
  background: var(--section-streaming-bg);
  border-color: var(--section-streaming-glow);
  color: #fff;
}
.fond-section .btn-option.active {
  background: var(--section-medias-bg);
  border-color: var(--section-medias-glow);
  color: #fff;
}

/* Hover */
.btn-option:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}
.widget-section .btn-option:hover {
  background: var(--section-streaming-bg);
  border-color: var(--section-streaming-glow);
  color: #fff;
}
.fond-section .btn-option:hover {
  background: var(--section-medias-bg);
  border-color: var(--section-medias-glow);
  color: #fff;
}

/* Bouton danger (supprimer) */
.btn-danger {
  color: var(--section-streaming);
  border-color: var(--section-streaming-glow);
}
.btn-danger:hover {
  background: var(--section-streaming-bg);
  border-color: var(--section-streaming);
}

/* Bouton trou OBS — accent cyan */
.btn-trou-obs {
  color: #a5f3fc;
  border-color: rgba(103, 232, 249, 0.25);
}
.btn-trou-obs:hover {
  background: rgba(103, 232, 249, 0.1);
  border-color: rgba(103, 232, 249, 0.45);
}
.btn-trou-obs-actif {
  color: #050713;
  background: rgba(103, 232, 249, 0.85);
  border-color: rgba(103, 232, 249, 0.9);
  font-weight: 600;
}

/* Bouton flottant actif (vert) */
.btn-flottant-actif {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.1);
}

/* Séparateur */
.options-separateur {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

/* Sous-label */
.options-sous-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}

/* =============================================================================
   CARTES FLOTTANTES — Portage de CarteFlottante.svelte (version Rust)
   -----------------------------------------------------------------------------
   Cartes modales draggable + resizable au-dessus de l'aperçu dashboard.
   Header = zone de drag avec titre centré + 3 boutons (mode, scanlines, fermer).
   Handle de resize en bas à droite. Couleur d'accent par section.
   ============================================================================= */
.calque-cartes-flottantes {
  position: absolute;
  inset: 0;
  z-index: var(--z-index-cartes-flottantes);
  pointer-events: none; /* le calque ne bloque pas le canvas ; chaque carte réactive ses propres events */
}

.carte-flottante {
  position: absolute;
  display: flex;
  flex-direction: column;
  border: 2px dashed var(--accent-carte);
  border-radius: 8px;
  background: var(--accent-carte-bg);
  box-shadow: 0 0 32px var(--accent-carte-glow), 0 16px 48px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  overflow: hidden;
  user-select: none;
  transition: box-shadow 0.2s ease;
  pointer-events: auto;
  /* Polices légèrement plus grandes dans les cartes (contenu détaillé) */
  --dashboard-ui-font-size: calc(var(--dashboard-ui-font-size, 12px) + 2px);
  --dashboard-ui-font-size-small: calc(var(--dashboard-ui-font-size-small, 10px) + 2px);
}

/* --- Effet CRT / scanlines (pseudo-élément ::before) ---
   Activé uniquement quand le calque a la classe .scanlines-actives.
   Deux repeating-linear-gradient empilés (lignes horizontales + bombé). */
.calque-cartes-flottantes.scanlines-actives .carte-flottante::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--scanlines-opacite, 0.18);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 2px,
      rgba(0, 0, 0, 0.55) 2px,
      rgba(0, 0, 0, 0.55) 3px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      rgba(0, 0, 0, 0.25) 3px,
      transparent 6px
    );
  background-blend-mode: multiply;
}

.carte-flottante.dragging {
  box-shadow: 0 0 48px var(--accent-carte-glow), 0 24px 64px rgba(0, 0, 0, 0.5);
  cursor: grabbing;
}
.carte-flottante.resizing { transition: none; }

/* Mode transparent (défaut) : fond givré léger, bordure discrète */
.carte-flottante.mode-transparent {
  background: rgba(10, 14, 28, 0.32);
  border-style: solid;
  border-width: 1px;
  border-color: color-mix(in srgb, var(--accent-carte) 55%, transparent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent-carte-glow) 50%, transparent), 0 8px 24px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
}
.carte-flottante.mode-transparent .carte-flottante-header {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-carte-bg) 30%, transparent), transparent);
  border-bottom-color: color-mix(in srgb, var(--accent-carte) 45%, transparent);
}

/* --- Sections : couleur d'accent via variables --accent-carte --- */
.carte-flottante.section-obs { --accent-carte: var(--section-obs); --accent-carte-bg: var(--section-obs-bg); --accent-carte-glow: var(--section-obs-glow); }
.carte-flottante.section-widgets { --accent-carte: var(--section-widgets); --accent-carte-bg: var(--section-widgets-bg); --accent-carte-glow: var(--section-widgets-glow); }
.carte-flottante.section-medias { --accent-carte: var(--section-medias); --accent-carte-bg: var(--section-medias-bg); --accent-carte-glow: var(--section-medias-glow); }
.carte-flottante.section-cadres { --accent-carte: var(--section-cadres); --accent-carte-bg: var(--section-cadres-bg); --accent-carte-glow: var(--section-cadres-glow); }
.carte-flottante.section-transitions { --accent-carte: var(--section-transitions); --accent-carte-bg: var(--section-transitions-bg); --accent-carte-glow: var(--section-transitions-glow); }
.carte-flottante.section-streaming { --accent-carte: var(--section-streaming); --accent-carte-bg: var(--section-streaming-bg); --accent-carte-glow: var(--section-streaming-glow); }
.carte-flottante.section-chat { --accent-carte: var(--section-chat); --accent-carte-bg: var(--section-chat-bg); --accent-carte-glow: var(--section-chat-glow); }
.carte-flottante.section-attente { --accent-carte: var(--section-attente); --accent-carte-bg: var(--section-attente-bg); --accent-carte-glow: var(--section-attente-glow); }
.carte-flottante.section-musique { --accent-carte: var(--section-musique); --accent-carte-bg: var(--section-musique-bg); --accent-carte-glow: var(--section-musique-glow); }
.carte-flottante.section-communaute { --accent-carte: var(--section-communaute); --accent-carte-bg: var(--section-communaute-bg); --accent-carte-glow: var(--section-communaute-glow); }
.carte-flottante.section-pad { --accent-carte: var(--section-pad); --accent-carte-bg: var(--section-pad-bg); --accent-carte-glow: var(--section-pad-glow); }
.carte-flottante.section-planning { --accent-carte: var(--section-planning); --accent-carte-bg: var(--section-planning-bg); --accent-carte-glow: var(--section-planning-glow); }
.carte-flottante.section-presentation { --accent-carte: var(--section-presentation); --accent-carte-bg: var(--section-presentation-bg); --accent-carte-glow: var(--section-presentation-glow); }
.carte-flottante.section-camera { --accent-carte: var(--section-camera); --accent-carte-bg: var(--section-camera-bg); --accent-carte-glow: var(--section-camera-glow); }
.carte-flottante.section-just-chatting { --accent-carte: var(--section-just-chatting); --accent-carte-bg: var(--section-just-chatting-bg); --accent-carte-glow: var(--section-just-chatting-glow); }
.carte-flottante.section-objectifs { --accent-carte: var(--section-objectifs); --accent-carte-bg: var(--section-objectifs-bg); --accent-carte-glow: var(--section-objectifs-glow); }
.carte-flottante.section-raccourcis { --accent-carte: var(--section-raccourcis); --accent-carte-bg: var(--section-raccourcis-bg); --accent-carte-glow: var(--section-raccourcis-glow); }
.carte-flottante.section-stats { --accent-carte: var(--section-stats); --accent-carte-bg: var(--section-stats-bg); --accent-carte-glow: var(--section-stats-glow); }

/* --- Header (zone de drag) --- */
.carte-flottante-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
  padding: 10px 12px;
  cursor: grab;
  border-bottom: 1px solid var(--accent-carte);
  background: linear-gradient(135deg, var(--accent-carte-bg), transparent);
  flex-shrink: 0;
}
.carte-flottante-header:active { cursor: grabbing; }

.carte-flottante-titre {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: var(--texte-contour-noir);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 80px);
  pointer-events: none;
}

.carte-flottante-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Boutons du header (mode, scanlines, fermer) — style uniforme */
.carte-flottante-mode,
.carte-flottante-scanlines,
.carte-flottante-fermer {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-carte);
  background: transparent;
  border-radius: 4px;
  color: var(--accent-carte);
  cursor: pointer;
  font-size: 12px;
  transition: all var(--transition-rapide);
  flex-shrink: 0;
  opacity: 0.7;
}
.carte-flottante-fermer { font-size: 12px; opacity: 1; }
.carte-flottante-mode:hover,
.carte-flottante-scanlines:hover {
  background: var(--accent-carte-bg);
  opacity: 1;
}
.carte-flottante-fermer:hover {
  background: var(--accent-carte);
  color: #000;
}

/* État actif (mode thème ou scanlines ON) */
.carte-flottante-mode.bouton-actif,
.carte-flottante-scanlines.bouton-actif {
  opacity: 1;
  background: var(--accent-carte-bg);
  border-color: var(--accent-carte);
  box-shadow: 0 0 6px var(--accent-carte-glow);
}

/* --- Corps (contenu) --- */
.carte-flottante-corps {
  flex: 1;
  position: relative;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-carte-glow) transparent;
  user-select: text;
  padding: 16px;
}
.carte-flottante-corps::-webkit-scrollbar { width: 6px; }
.carte-flottante-corps::-webkit-scrollbar-thumb {
  background: var(--accent-carte-glow);
  border-radius: 3px;
}

/* Le footer d'une modale reste stylé à l'intérieur du corps */
.carte-flottante-corps .modal-footer {
  margin: 16px -16px -16px;
  border-radius: 0 0 6px 6px;
}

/* --- Handle de resize (bas à droite) --- */
.carte-flottante-resize {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 2;
}
.carte-flottante-resize::after {
  content: '';
  position: absolute;
  bottom: 3px;
  right: 3px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent-carte);
  border-bottom: 2px solid var(--accent-carte);
  opacity: 0.6;
}
.carte-flottante-resize:hover::after { opacity: 1; }

/* =============================================================================
   Galerie de cadres — port de GalerieCadres.svelte
   Rendu à l'intérieur d'une carte flottante (section cadres, violette).
   ============================================================================= */

/* La galerie remplit tout le corps de la carte (pas de padding du corps) */
#carte-galerie-cadres .carte-flottante-corps {
  padding: 0;
  overflow: hidden;
}

.galerie-cadres {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* --- Onglets (Fond de l'app | Cadre des widgets) --- */
.galerie-onglets {
  display: flex;
  gap: 4px;
  padding: 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.galerie-onglet {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.galerie-onglet:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.8);
}
.galerie-onglet.actif {
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.4);
  color: #c4b5fd;
}

/* --- Corps : sidebar + grille + panneau config --- */
.galerie-corps {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Sidebar catégories */
.galerie-sidebar {
  width: 160px;
  flex-shrink: 0;
  padding: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
}
.galerie-recherche {
  width: 100%;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  margin-bottom: 10px;
  box-sizing: border-box;
  outline: none;
}
.galerie-recherche:focus {
  border-color: rgba(167, 139, 250, 0.45);
}
.galerie-categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.galerie-categorie {
  padding: 5px 8px;
  background: none;
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: capitalize;
}
.galerie-categorie:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.8);
}
.galerie-categorie.actif {
  background: rgba(167, 139, 250, 0.12);
  color: #c4b5fd;
}

/* Grille de miniatures */
.galerie-grille {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  align-content: start;
}
.galerie-cadre-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.galerie-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: all 0.15s;
  box-sizing: border-box;
}
.galerie-thumb:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}
.galerie-thumb.selectionne {
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.25);
}
.galerie-thumb-vignette {
  width: 120px;
  height: 68px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background-image: repeating-conic-gradient(rgba(255, 255, 255, 0.03) 0% 25%, transparent 0% 50%);
  background-size: 16px 16px;
}
.galerie-thumb-vignette svg {
  display: block;
}
.galerie-thumb-nom {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Variantes (pastilles de couleur) */
.galerie-variantes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  max-width: 140px;
}
.galerie-variante {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.galerie-variante:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}
.galerie-variante.actif {
  border-color: #c4b5fd;
  box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.45);
  transform: scale(1.15);
}

/* Panneau config (droite) */
.galerie-config {
  width: 220px;
  flex-shrink: 0;
  padding: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.galerie-config-nom {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.galerie-toggle {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid;
}
.galerie-toggle.actif {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}
.galerie-toggle.inactif {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.galerie-config-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.galerie-config-section.desactive {
  opacity: 0.4;
  pointer-events: none;
}
.galerie-config-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(167, 139, 250, 0.7);
}
.galerie-config-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.galerie-range {
  flex: 1;
  height: 14px;
  cursor: pointer;
  accent-color: #a78bfa;
}
.galerie-config-valeur {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-family: monospace;
  width: 32px;
  text-align: right;
}
.galerie-color {
  width: 28px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.galerie-config-texte {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
}
.galerie-config-hex {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-family: monospace;
  margin-left: auto;
}
.galerie-config-info {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.35);
}
.galerie-apercu {
  width: 200px;
  height: 112px;
  position: relative;
  border-radius: 4px;
  background-image: repeating-conic-gradient(rgba(255, 255, 255, 0.03) 0% 25%, transparent 0% 50%);
  background-size: 16px 16px;
  overflow: hidden;
}
.galerie-apercu svg {
  display: block;
}
.galerie-vide {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  padding: 40px 0;
}

/* --- Overlay du cadre de l'app (bord extérieur du canvas 1920x1080) --- */
.cadre-app-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}
.cadre-app-overlay svg {
  display: block;
}

/* =============================================================================
 * MODE GLISSER-DÉPOSER — Bouton sidebar + overlay canvas + modale de choix
 * =============================================================================
 * Portage de RUST_SOS_2026v0.1/src/lib/composants/Sidebar.svelte (.btn-drag-drop)
 * + DragDropOverlay.svelte + DragDropChoixModal.svelte
 *
 * Bouton sidebar : toggle du mode drag-drop.
 *   Inactif (rouge) → clic → Actif (vert) → drop → auto-désactivation (rouge).
 * Overlay canvas : zone de drop verte dashed quand le mode est actif.
 * Modale de choix : après drop, demande widget flottant vs widget normal.
 * ============================================================================= */

/* Bouton Glisser/Déposer dans la sidebar — toggle du mode drag-drop.
   Inactif : rouge (action). Actif : vert (succès, prêt à drop). */
.btn-drag-drop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255, 100, 100, 0.2);
  box-shadow: 0 0 4px rgba(255, 100, 100, 0.08);
  transition: all 0.2s ease;
}
.btn-drag-drop:hover {
  border-color: rgba(255, 100, 100, 0.4);
  box-shadow: 0 0 8px rgba(255, 100, 100, 0.15);
}
.btn-drag-drop.actif {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.6);
  background: rgba(74, 222, 128, 0.1);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.3);
  text-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}
.btn-drag-drop.actif:hover {
  background: rgba(74, 222, 128, 0.15);
  border-color: rgba(74, 222, 128, 0.8);
}
.btn-indicateur {
  font-size: 9px;
  opacity: 0.7;
  line-height: 1;
}

/* --- Overlay du mode drag-drop (zone de drop verte dashed sur le canvas) --- */
.drag-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: all 0.2s ease;
}
.drag-drop-overlay.survol {
  background: rgba(74, 222, 128, 0.15);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: auto;
}
.drag-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 80px;
  border: 4px dashed rgba(74, 222, 128, 0.7);
  border-radius: 24px;
  background: rgba(10, 15, 25, 0.75);
  box-shadow: 0 0 30px rgba(74, 222, 128, 0.25), 0 0 12px rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}
.drag-drop-overlay.survol .drag-drop-zone {
  border-color: rgba(74, 222, 128, 1);
  background: rgba(74, 222, 128, 0.08);
  transform: scale(1.05);
  box-shadow: 0 0 60px rgba(74, 222, 128, 0.5), 0 0 20px rgba(255, 255, 255, 0.4);
}
.drag-drop-icone {
  font-size: 64px;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.5));
}
.drag-drop-titre {
  font-size: 28px;
  font-weight: 700;
  color: #4ade80;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.7), 0 0 6px rgba(255, 255, 255, 0.5);
}
.drag-drop-sous-titre {
  font-size: 14px;
  color: rgba(74, 222, 128, 0.7);
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

/* --- Modale de choix (widget flottant vs widget normal après drop) --- */
.modal-choix-drop {
  width: 520px;
  max-width: 90vw;
}
.choix-drop-info {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 6px;
}
.choix-drop-nom {
  color: #fff;
  font-weight: 500;
}
.choix-drop-kind {
  margin-bottom: 16px;
}
.choix-drop-kind-badge {
  color: var(--section-transitions, #67e8f9);
  text-transform: capitalize;
}
.choix-drop-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choix-drop-carte {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 6px;
  border: 1px solid;
  background: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.choix-flottant {
  border-color: rgba(103, 232, 249, 0.3);
  background: rgba(103, 232, 249, 0.06);
}
.choix-flottant:hover {
  border-color: rgba(103, 232, 249, 0.6);
  background: rgba(103, 232, 249, 0.12);
}
.choix-normal {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.06);
}
.choix-normal:hover {
  border-color: rgba(74, 222, 128, 0.6);
  background: rgba(74, 222, 128, 0.12);
}
.choix-drop-carte-titre {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.choix-flottant .choix-drop-carte-titre {
  color: var(--section-transitions, #67e8f9);
}
.choix-normal .choix-drop-carte-titre {
  color: #4ade80;
}
.choix-drop-carte-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.4;
}
.modal-choix-drop .modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.modal-choix-drop .btn-annuler {
  padding: 6px 16px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  transition: all 0.15s ease;
}
.modal-choix-drop .btn-annuler:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
