/*
 * custom-background.css — styles for the per-session background layer and its
 * control panel. Aesthetic matches the official whiteboard: navy #212F52,
 * blue #0677BB, Rubik, frosted white surfaces.
 */

/* The pinned-to-canvas background layer. Lives inside #elements, painted behind
   everything else, and must never intercept pointer events (boats/drawing stay
   fully interactive). */
#custom-background-layer {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  /* No will-change: inside the zoomed board it kept the backdrop at the
     resolution it was first drawn at, so it blurred when zoomed in. */
}

/* ---- Control panel -------------------------------------------------------- */
.custom-bg-panel {
  position: fixed;
  top: 90px;
  right: 20px;
  width: 280px;
  z-index: 1000;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0px 8px 24px rgba(0, 0, 0, 0.18);
  font-family: Rubik, sans-serif;
  color: #212F52;
  overflow: hidden;
  user-select: none;
}

.custom-bg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #212F52;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.custom-bg-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.custom-bg-close:hover { color: #4F9CCC; }

.custom-bg-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Upload button (styled file input) */
.custom-bg-upload {
  display: block;
  text-align: center;
  padding: 10px;
  border-radius: 8px;
  background: #0677BB;
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.custom-bg-upload:hover { background: #0587d3; }
.custom-bg-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.custom-bg-url-row {
  display: flex;
  gap: 6px;
}
.custom-bg-url-row input {
  flex: 1;
  min-width: 0;
  padding: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: Rubik, sans-serif;
  font-size: 13px;
  color: #212F52;
}
.custom-bg-url-row input:focus {
  outline: none;
  border-color: #0677BB;
}
.custom-bg-url-row button {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #212F52;
  color: #fff;
  font-family: Rubik, sans-serif;
  font-size: 13px;
  cursor: pointer;
}
.custom-bg-url-row button:hover { background: #2c3d6b; }

.custom-bg-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.custom-bg-field label {
  font-size: 14px;
  font-weight: 500;
}
.custom-bg-field select {
  flex: 1;
  max-width: 150px;
  padding: 7px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: Rubik, sans-serif;
  font-size: 13px;
  color: #212F52;
  background: #fff;
  cursor: pointer;
}
.custom-bg-field input[type="range"] {
  flex: 1;
  max-width: 150px;
  accent-color: #0677BB;
  cursor: pointer;
}

.custom-bg-remove {
  padding: 9px;
  border: 1px solid #e2b4b4;
  border-radius: 8px;
  background: #fff5f5;
  color: #b23b3b;
  font-family: Rubik, sans-serif;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.custom-bg-remove:hover:not(:disabled) { background: #ffe6e6; }
.custom-bg-remove:disabled {
  opacity: 0.5;
  cursor: default;
}

.custom-bg-note {
  margin: 0;
  font-size: 11px;
  color: #7a869a;
  text-align: center;
}
