/* ==========================================================================
   Peerly Board — Bottom Toolbar (style ClassroomScreen, desktop uniquement)
   ==========================================================================
   Barre flottante centrée en bas, avec deux onglets :
     - Dessin : outils + palette 2×6 + épaisseur
     - Widgets : 8 widgets + bouton "Plus"

   Visible uniquement à partir de 840px (voir responsive.css).

   Slide verticale :
     - Panel sortant : translateY(-100%) (monte et disparaît)
     - Panel entrant : depuis translateY(100%) → 0 (monte depuis le bas)
     - Retour : inverse (descend)
   ========================================================================== */

.bottom-toolbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: none; /* activé via responsive.css */
  align-items: center;
  gap: 6px;
  padding: 6px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-radius: 22px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: 500;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  transition:
    background-color var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard),
    transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
    opacity var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.bottom-toolbar--collapsed .bottom-toolbar__content {
  display: none;
}

.bottom-toolbar--collapsed .bottom-toolbar__collapse i {
  transform: rotate(180deg);
}

/* ==========================================================================
   TABS (à gauche)
   ========================================================================== */

.bottom-toolbar__tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 6px;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  justify-content: center;
  flex-shrink: 0;
}

.bottom-toolbar__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: var(--md-sys-color-on-surface-variant);
  background: transparent;
  cursor: pointer;
  transition:
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    transform var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.bottom-toolbar__tab:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
  color: var(--md-sys-color-on-surface);
}

.bottom-toolbar__tab:active {
  transform: scale(0.94);
}

.bottom-toolbar__tab--active,
.bottom-toolbar__tab--active:hover {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.bottom-toolbar__tab i {
  font-size: 16px;
}

/* ==========================================================================
   CONTENT — fenêtre dans laquelle les panels slide verticalement
   ==========================================================================
   La largeur est fixée en JS (max des deux panels).
   La hauteur (64px) permet au panel le plus haut de tenir.
   ========================================================================== */

.bottom-toolbar__content {
  position: relative;
  height: 60px;
  overflow: hidden;
  flex-shrink: 0;
  /* width définie dynamiquement par JS */
}

/* ==========================================================================
   PANELS — superposés, slide vertical
   ========================================================================== */

.bottom-toolbar__panel {
  position: absolute;
  inset: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 8px;
  white-space: nowrap;

  /* État par défaut : sous la fenêtre (prêt à entrer en montant) */
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;

  transition:
    transform 340ms cubic-bezier(0.2, 0, 0, 1),
    opacity 220ms cubic-bezier(0.2, 0, 0, 1);
}

/* Panel actif : centré */
.bottom-toolbar__panel--active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Panel sorti vers le haut (après un forward) */
.bottom-toolbar__panel--exit-up {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* Classe transitoire pour mesures : position static → largeur naturelle */
.bottom-toolbar__panel--measuring {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
  width: max-content !important;
}

/* ==========================================================================
   TOOLS
   ========================================================================== */

.bottom-tools {
  display: flex;
  gap: 2px;
}

.bottom-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--md-sys-color-on-surface);
  background: transparent;
  cursor: pointer;
  transition:
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    transform var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.bottom-tool:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

.bottom-tool:active {
  transform: scale(0.94);
}

.bottom-tool--active,
.bottom-tool--active:hover {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.bottom-tool i {
  font-size: 20px;
}

/* ==========================================================================
   DIVIDER
   ========================================================================== */

.bottom-toolbar__divider {
  width: 1px;
  height: 36px;
  background: var(--md-sys-color-outline-variant);
  flex-shrink: 0;
  margin: 0 2px;
}

/* ==========================================================================
   COLORS — grille 6×2 avec padding pour accueillir le ring
   ========================================================================== */

.bottom-colors {
  display: grid;
  grid-template-columns: repeat(6, 20px);
  grid-template-rows: repeat(2, 20px);
  gap: 3px;
  padding: 4px;
  flex-shrink: 0;
}

.bottom-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  transition:
    transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  position: relative;
}

.bottom-color:hover {
  transform: scale(1.15);
}

.bottom-color--active {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.08),
    0 0 0 2px var(--md-sys-color-surface-container-high),
    0 0 0 3px var(--md-sys-color-primary);
}

/* ==========================================================================
   THICKNESS
   ========================================================================== */

.bottom-thickness {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  flex-shrink: 0;
}

.bottom-brush-preview {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  flex-shrink: 0;
  transition:
    width var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    height var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.bottom-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 32px;
  background: transparent;
  cursor: pointer;
  outline: none;
}

.bottom-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: var(--md-sys-color-surface-container-highest);
  border-radius: 9999px;
}

.bottom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  margin-top: -6px;
  cursor: pointer;
  transition: box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.bottom-slider:hover::-webkit-slider-thumb {
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--md-sys-color-primary) 15%, transparent);
}

.bottom-slider::-moz-range-track {
  width: 100%;
  height: 4px;
  background: var(--md-sys-color-surface-container-highest);
  border-radius: 9999px;
}

.bottom-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  border: none;
  cursor: pointer;
}

.bottom-thickness__value {
  font-family: var(--md-sys-typescale-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  min-width: 22px;
  text-align: right;
}

/* ==========================================================================
   WIDGETS
   ========================================================================== */

.bottom-widgets {
  display: flex;
  gap: 2px;
}

.bottom-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 10px;
  min-width: 62px;
  border-radius: 12px;
  color: var(--md-sys-color-on-surface-variant);
  background: transparent;
  cursor: pointer;
  transition:
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    transform var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  font-family: inherit;
}

.bottom-widget:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
  color: var(--md-sys-color-on-surface);
}

.bottom-widget:active {
  transform: scale(0.94);
}

.bottom-widget i {
  font-size: 22px;
  line-height: 1;
}

.bottom-widget span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1;
}

.bottom-widget--more {
  color: var(--md-sys-color-primary);
}

/* ==========================================================================
   COLLAPSE BUTTON
   ========================================================================== */

.bottom-toolbar__collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 2px;
  padding: 0;
  border-radius: 10px;
  color: var(--md-sys-color-on-surface-variant);
  background: transparent;
  cursor: pointer;
  transition:
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  flex-shrink: 0;
}

.bottom-toolbar__collapse:hover {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
  color: var(--md-sys-color-on-surface);
}

.bottom-toolbar__collapse i {
  font-size: 20px;
  transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}

/* ==========================================================================
   ESPACE CANVAS
   ========================================================================== */

@media (min-width: 840px) {
  .canvas-placeholder {
    padding-bottom: 120px;
  }
}