/* ════════════════════════════════════════════════════════
   WHITEBOARD.CSS — PhysEdBoard
   Canvas plein écran · Toolbar fixe en bas
   Mobile-first · 768 / 1024 / 1280 / 1536 / 1920px+
════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════
   VARIABLES — base mobile (< 768px)
════════════════════════════════════════ */
:root {
  /* Couleurs */
  --accent: #ffd43b;
  --red:    #ff3c3c;
  --bg:     #061428;
  --panel:  #0d2040;
  --border: rgba(255,255,255,0.08);
  --text:   #fff;

  /* Toolbar */
  --wb-toolbar-h:      52px;
  --wb-toolbar-pad:    4px 8px;
  --wb-toolbar-gap:    1px;
  --wb-toolbar-radius: 12px;

  /* Cards */
  --wb-card-icon-fs:   13px;
  --wb-card-label-fs:  7px;
  --wb-card-label-d:   block;
  --wb-card-pad:       6px 7px 5px;
  --wb-card-min-w:     36px;

  /* Slider taille */
  --wb-size-track-w:   46px;
  --wb-size-val-fs:    13px;

  /* Boutons icône */
  --wb-btn-size:       28px;
  --wb-btn-radius:     6px;
  --wb-btn-icon-fs:    11px;

  /* Popup — s'affiche juste au-dessus de la toolbar */
  --wb-popup-bottom:   calc(var(--wb-toolbar-h) + 10px);
}

/* ════════════════════════════════════════
   RESPONSIVE — Mobile-first
   1. Tablette portrait       768px+
   2. Tablette paysage/laptop 1024px+
   3. Laptop standard         1280px+
   4. Laptop HD               1536px+
   5. Grand écran             1920px+
════════════════════════════════════════ */

@media (min-width: 768px) {
  :root {
    --wb-toolbar-h:      56px;
    --wb-toolbar-pad:    3px 6px;
    --wb-toolbar-gap:    1px;
    --wb-toolbar-radius: 13px;
    --wb-card-icon-fs:   12px;
    --wb-card-label-fs:  6px;
    --wb-card-pad:       4px 6px 3px;
    --wb-card-min-w:     36px;
    --wb-size-track-w:   44px;
    --wb-btn-size:       26px;
    --wb-btn-icon-fs:    10px;
    --wb-popup-bottom: calc(var(--wb-toolbar-h) + 10px);
  }
}

@media (min-width: 1024px) {
  :root {
    --wb-toolbar-h:      58px;
    --wb-toolbar-pad:    3px 7px;
    --wb-toolbar-gap:    2px;
    --wb-toolbar-radius: 14px;
    --wb-card-icon-fs:   13px;
    --wb-card-label-fs:  7px;
    --wb-card-pad:       5px 8px 4px;
    --wb-card-min-w:     40px;
    --wb-size-track-w:   54px;
    --wb-btn-size:       28px;
    --wb-btn-icon-fs:    11px;
    --wb-popup-bottom: calc(var(--wb-toolbar-h) + 10px);
  }
}

@media (min-width: 1280px) {
  :root {
    --wb-toolbar-h:      60px;
    --wb-toolbar-pad:    4px 8px;
    --wb-toolbar-gap:    2px;
    --wb-toolbar-radius: 15px;
    --wb-card-icon-fs:   13px;
    --wb-card-label-fs:  7px;
    --wb-card-pad:       6px 9px 5px;
    --wb-card-min-w:     42px;
    --wb-size-track-w:   62px;
    --wb-size-val-fs:    15px;
    --wb-btn-size:       30px;
    --wb-popup-bottom: calc(var(--wb-toolbar-h) + 10px);
  }
}

@media (min-width: 1536px) {
  :root {
    --wb-toolbar-h:      64px;
    --wb-toolbar-pad:    4px 10px;
    --wb-toolbar-gap:    2px;
    --wb-toolbar-radius: 16px;
    --wb-card-icon-fs:   14px;
    --wb-card-label-fs:  7px;
    --wb-card-pad:       6px 10px 5px;
    --wb-size-track-w:   68px;
    --wb-size-val-fs:    15px;
    --wb-btn-size:       32px;
    --wb-popup-bottom: calc(var(--wb-toolbar-h) + 10px);
  }
}

@media (min-width: 1920px) {
  :root {
    --wb-toolbar-h:      76px;
    --wb-toolbar-pad:    8px 14px;
    --wb-toolbar-gap:    6px;
    --wb-toolbar-radius: 22px;
    --wb-card-icon-fs:   20px;
    --wb-card-label-fs:  10px;
    --wb-card-pad:       10px 16px 9px;
    --wb-card-min-w:     56px;
    --wb-size-track-w:   90px;
    --wb-size-val-fs:    18px;
    --wb-btn-size:       44px;
    --wb-btn-icon-fs:    17px;
    --wb-popup-bottom: calc(var(--wb-toolbar-h) + 10px);
  }
}

/* Paysage mobile (hauteur < 500px) */
@media (max-height: 500px) {
  :root {
    --wb-toolbar-h:      44px;
    --wb-toolbar-pad:    3px 5px;
    --wb-toolbar-gap:    1px;
    --wb-card-pad:       4px 6px 3px;
    --wb-card-icon-fs:   12px;
    --wb-card-label-fs:  0px;
    --wb-card-label-d:   none;
    --wb-size-track-w:   40px;
    --wb-popup-bottom: calc(var(--wb-toolbar-h) + 10px);
  }
}

/* Paysage tablette compact (hauteur 500–700px, largeur ≥ 768px) */
@media (max-height: 700px) and (min-width: 768px) {
  :root {
    --wb-toolbar-h:      50px;
    --wb-card-pad:       4px 7px 3px;
    --wb-popup-bottom: calc(var(--wb-toolbar-h) + 10px);
  }
}

/* Touch */
@media (hover: none) and (pointer: coarse) {
  .wb-card { min-height: 44px; }
  .wb-btn  { min-width: 44px; min-height: 44px; }
  .wb-card:active,
  .wb-btn:active  { opacity: 0.75; transition: opacity 0.08s; }
  .wb-popup-color { min-width: 32px; min-height: 32px; }
}


/* ════════════════════════════════════════
   RESET
════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Barlow Condensed', sans-serif;
}


/* ════════════════════════════════════════
   CANVAS — plein écran sous le header
════════════════════════════════════════ */
.wb-canvas-wrap {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: var(--wb-toolbar-h); /* laisse la place à la toolbar */
  background: #ffffff;
  z-index: 1;
}

#wbCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
  z-index: 2;
  will-change: contents;
}


/* ════════════════════════════════════════
   TOOLBAR — collée au bas, pleine largeur
   Design : dock navy profond, accent jaune
════════════════════════════════════════ */
.wb-toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--wb-toolbar-gap);
  height: var(--wb-toolbar-h);
  padding: var(--wb-toolbar-pad);

  /* Navy profond avec reflet subtil en haut */
  background: #071830;
  border-top: 1px solid rgba(255, 212, 59, 0.18);

  /* Ligne jaune fine en haut — signature visuelle */
  box-shadow:
    0 -1px 0 0 rgba(255, 212, 59, 0.12),
    0 -8px 32px rgba(0, 0, 0, 0.5),
    0 -2px 8px rgba(0, 0, 0, 0.35);

  /* Pas de border-radius en bas — collée au bas */
  border-radius: var(--wb-toolbar-radius) var(--wb-toolbar-radius) 0 0;

  white-space: nowrap;
  contain: layout style;
  overflow-x: auto;
  scrollbar-width: none;
}
.wb-toolbar::-webkit-scrollbar { display: none; }

/* Séparateur — filet jaune très atténué */
.wb-separator {
  width: 1px;
  height: clamp(18px, 3vh, 26px);
  background: rgba(255, 212, 59, 0.14);
  margin: 0 clamp(2px, 0.4vw, 5px);
  align-self: center;
  flex-shrink: 0;
}


/* ════════════════════════════════════════
   CARD — outil avec icône + label
   Inactif : texte bleuté discret
   Hover    : fond navy légèrement éclairci
   Actif    : fond jaune doré, texte noir
════════════════════════════════════════ */
.wb-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--wb-card-pad);
  border-radius: clamp(7px, 1.2vw, 10px);
  border: 1px solid transparent;
  background: transparent;
  color: rgba(180, 205, 230, 0.45);
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s, box-shadow 0.14s;
  flex-shrink: 0;
  position: relative;
  min-width: var(--wb-card-min-w);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.wb-card i {
  font-size: var(--wb-card-icon-fs);
  line-height: 1;
}
.wb-card-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: var(--wb-card-label-fs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1;
  pointer-events: none;
  display: var(--wb-card-label-d);
}

/* Hover — fond navy légèrement éclairci */
.wb-card:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(210, 230, 248, 0.85);
  border-color: rgba(255, 212, 59, 0.1);
}

/* Actif — accent jaune complet */
.wb-card.active {
  background: rgba(255, 212, 59, 0.12);
  border-color: rgba(255, 212, 59, 0.35);
  color: #ffd43b;
  box-shadow: inset 0 0 12px rgba(255, 212, 59, 0.06);
}

/* Indicateur actif — trait jaune en haut de la card */
.wb-card.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(16px, 2.5vw, 28px);
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: #ffd43b;
  box-shadow: 0 0 6px rgba(255, 212, 59, 0.6);
}

/* Danger (Effacer) */
.wb-card-danger {
  color: rgba(255, 100, 100, 0.4);
}
.wb-card-danger:hover {
  background: rgba(255, 60, 60, 0.1);
  color: #ff6464;
  border-color: rgba(255, 60, 60, 0.25);
}


/* ════════════════════════════════════════
   BOUTON ICÔNE SEUL (secondaire)
════════════════════════════════════════ */
.wb-btn {
  width: var(--wb-btn-size);
  height: var(--wb-btn-size);
  border-radius: var(--wb-btn-radius);
  border: 1px solid transparent;
  background: transparent;
  color: rgba(180, 205, 230, 0.35);
  font-size: var(--wb-btn-icon-fs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s, color 0.13s, border-color 0.13s;
  flex-shrink: 0;
  align-self: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 36px;
  min-height: 36px;
}
.wb-btn:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(210,230,248,0.8);
}
.wb-btn.active {
  background: rgba(255,212,59,0.12);
  border-color: rgba(255,212,59,0.3);
  color: #ffd43b;
}
/* ════════════════════════════════════════
   TOOLTIP — utilise ::after pour éviter
   le conflit avec ::before (trait actif)
════════════════════════════════════════ */
.wb-card[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #071830;
  color: rgba(255,255,255,0.88);
  border: 1px solid rgba(255,212,59,0.2);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(9px, 1.2vw, 11px);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 500;
}
/* Masquer le tooltip quand la card est active (le ::before occupe ::after) */
.wb-card.active[data-tip]:hover::after { display: none; }
@media (hover: none) {
  .wb-card[data-tip]:hover::after { display: none; }
}


/* ════════════════════════════════════════
   SWATCH COULEUR
════════════════════════════════════════ */
.wb-swatch-icon {
  width: clamp(14px, 2.2vw, 19px);
  height: clamp(14px, 2.2vw, 19px);
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.22);
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  flex-shrink: 0;
  transition: transform 0.13s;
}
.wb-card:hover .wb-swatch-icon { transform: scale(1.1); }
.wb-card.active .wb-swatch-icon { border-color: #ffd43b; }


/* ════════════════════════════════════════
   SLIDER TAILLE
════════════════════════════════════════ */
.wb-card-slider {
  flex-direction: column;
  padding: clamp(4px, 0.8vh, 6px) clamp(7px, 1.2vw, 11px) clamp(3px, 0.6vh, 5px);
  cursor: default;
  min-width: clamp(72px, 10vw, 110px);
}
.wb-card-slider:hover {
  background: rgba(255,255,255,0.04);
  color: rgba(180,205,230,0.7);
  border-color: transparent;
}
.wb-size-row {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.7vw, 7px);
}
.wb-size-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: var(--wb-size-val-fs);
  color: #ffd43b;
  min-width: 18px;
  text-align: right;
  line-height: 1;
}
.wb-size-track {
  -webkit-appearance: none;
  appearance: none;
  width: var(--wb-size-track-w);
  height: 3px;
  border-radius: 3px;
  background: rgba(255,212,59,0.18);
  outline: none;
  cursor: pointer;
}
.wb-size-track::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: clamp(11px, 1.6vw, 13px);
  height: clamp(11px, 1.6vw, 13px);
  border-radius: 50%;
  background: #ffd43b;
  border: none;
  box-shadow: 0 0 6px rgba(255,212,59,0.5);
  cursor: pointer;
  transition: transform 0.1s;
}
.wb-size-track::-webkit-slider-thumb:hover { transform: scale(1.25); }
.wb-size-track::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #ffd43b;
  border: none;
  cursor: pointer;
}


/* ════════════════════════════════════════
   CARD DANGER — déjà défini plus haut
   (pas de doublon)
════════════════════════════════════════ */


/* ════════════════════════════════════════
   POPUP COULEUR
   Même charte navy + bordure jaune fine
════════════════════════════════════════ */
.wb-popup {
  position: fixed;
  bottom: var(--wb-popup-bottom);
  left: 50%;
  transform: translateX(-50%);
  z-index: 410;
  background: #071830;
  border: 1px solid rgba(255,212,59,0.22);
  border-radius: clamp(12px, 1.8vw, 16px);
  padding: clamp(10px, 1.6vw, 14px) clamp(12px, 1.8vw, 16px);
  box-shadow:
    0 -4px 24px rgba(0,0,0,0.6),
    0 16px 40px rgba(0,0,0,0.7);
  display: none;
  flex-direction: column;
  gap: clamp(7px, 1vw, 10px);
}
.wb-popup.open { display: flex; }

.wb-popup-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(7px, 0.9vw, 9px);
  font-weight: 700;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(255,212,59,0.4);
}
.wb-popup-colors {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(5px, 0.8vw, 7px);
  max-width: clamp(160px, 24vw, 200px);
}
.wb-popup-color {
  width: clamp(22px, 3vw, 26px);
  height: clamp(22px, 3vw, 26px);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  touch-action: manipulation;
}
.wb-popup-color:hover  { transform: scale(1.18); }
.wb-popup-color.active { border-color: #ffd43b; transform: scale(1.12); }

.wb-popup-shapes {
  display: flex;
  gap: clamp(6px, 0.9vw, 10px);
}

.wb-popup-shape {
  --wb-popup-shape-bg: rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: clamp(62px, 8vw, 82px);
  padding: 8px 10px;
  background: var(--wb-popup-shape-bg);
  color: rgba(210, 230, 248, 0.85);
  border: 1px solid rgba(255,212,59,0.14);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}

.wb-popup-shape i {
  font-size: 15px;
}

.wb-triangle-icon {
  width: 18px;
  height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wb-triangle-icon svg {
  width: 18px;
  height: 15px;
  display: block;
}

.wb-triangle-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.wb-popup-shape span {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.wb-popup-shape:hover {
  --wb-popup-shape-bg: rgba(255,255,255,0.09);
  transform: translateY(-1px);
  background: var(--wb-popup-shape-bg);
}

.wb-popup-shape.active {
  --wb-popup-shape-bg: rgba(255,212,59,0.12);
  border-color: rgba(255,212,59,0.48);
  color: #ffd43b;
  background: var(--wb-popup-shape-bg);
}

.wb-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 700;
}

.wb-modal {
  width: min(420px, calc(100vw - 32px));
  background: #071830;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 28px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.8);
  font-family: 'Barlow Condensed', sans-serif;
}

.wb-modal-title {
  margin-bottom: 14px;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.wb-modal-message {
  margin-bottom: 22px;
  font-size: 18px;
  line-height: 1.3;
  color: rgba(255,255,255,0.72);
}

.wb-modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.wb-modal-btn {
  border-radius: 10px;
  padding: 10px 20px;
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.wb-modal-btn-secondary {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.65);
}

.wb-modal-btn-danger {
  background: #ff5f57;
  border: none;
  color: #fff;
  padding-inline: 24px;
}


/* ════════════════════════════════════════
   CURSEUR GOMME
════════════════════════════════════════ */
#wbEraserCursor {
  display: none;
  position: fixed;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.4);
  background: rgba(200,200,200,0.15);
  pointer-events: none;
  z-index: 500;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(255,255,255,0.3);
  will-change: transform, left, top;
}