/* ==========================================================================
   Peerly Draw — Bottom Toolbar (style ClassroomScreen, desktop uniquement)
   ==========================================================================
   Barre flottante centrée en bas de l'écran, avec deux onglets :
     - Dessin : outils + palette 2×6 + épaisseur
     - Widgets : 8 widgets + bouton "Plus"
   Visible uniquement à partir de 840px de large (voir responsive.css).
   ========================================================================== */

.bottom-toolbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: none; /* activé via responsive.css */
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  border-radius: 24px;
  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: 8px;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  align-self: stretch;
  justify-content: center;
}

.bottom-toolbar__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  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);
}

.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 {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

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

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

/* ==========================================================================
   PANELS
   ========================================================================== */

.bottom-toolbar__content {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.bottom-toolbar__content::-webkit-scrollbar { display: none; }

.bottom-toolbar__panel {
  display: none;
  gap: 10px;
  align-items: center;
  padding: 2px 4px;
}

.bottom-toolbar__panel--active {
  display: flex;
}

/* ==========================================================================
   TOOLS (crayon, gomme, etc.)
   ========================================================================== */

.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 {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.bottom-tool--active:hover {
  background: var(--md-sys-color-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 (2 rangées de 6)
   ========================================================================== */

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

.bottom-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  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 {
  border-color: var(--md-sys-color-on-surface);
  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 4px 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 (à droite)
   ========================================================================== */

.bottom-toolbar__collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 4px;
  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);
}

/* ==========================================================================
   AJUSTEMENT : décaler le canvas-placeholder pour ne pas être mangé
   ========================================================================== */

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