/* Base page defaults */
body {
  margin: 0;
  padding: 0;
  font-family: "ABCDiatypeMono", monospace;
  height: 100vh;
  background: white;
  font-size: 16px;
}

/* Custom mono font */
@font-face {
  font-family: "ABCDiatypeMono";
  src: url("fonts/ABCDiatypeMonoEdu-Regular.woff") format("woff"),
       url("fonts/ABCDiatypeMonoEdu-Regular.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
}

/* Overall layout container */
#layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow-x: hidden;
}

/* Left column headline title */
.Headline h1 {
  font-size: 0.8rem;
  font-family: "ABCDiatypeMono", monospace;
  font-weight: 100;
  margin: 0 0 10px 0;
  text-transform: uppercase;
}

.logo-link {
  display: inline-block;
  margin: 0 0 10px 0;
}

.logo-image {
  width: 150px;
  height: auto;
  display: block;
}

/* Left column headline description */
.Headline h2 {
  font-size: 0.8rem;
  font-family: "ABCDiatypeMono", monospace;
  font-weight: 100;
  margin: 0 0 10px 0;
  text-transform: uppercase;
  line-height: 1rem;
}

/* Global link styling */
a {
  color: black;
  text-decoration: none;
}

/* Left column container */
#controls {
  font-family: "ABCDiatypeMono";
  width: 25vw;
  flex: 0 0 25vw;
  min-width: 25vw;
  max-width: 25vw;
  background: #ffffff;
  --controls-padding: 10px;
  /* padding: var(--controls-padding); */
  border-right: 1px solid black;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  text-transform: uppercase;
}

/* Left column item container */
#controls > * {
  height: 6.22vh;
  /* padding: 0px var(--controls-padding); */
  /* margin: 0 calc(-1 * var(--controls-padding)); */
  border-bottom: 1px solid black;
}

#controls > *:first-child {
  border-top: none;
}

#controls > .text-row {
  height: auto;
  align-items: flex-start;
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Header row is double height for long text */
#controls > .Headline {
  height: 25vh;
  /* padding-top: var(--controls-padding); */
  padding: 15px;
}

/* Control row wrapper */
.control-row {
  display: grid;
  grid-template-columns: 1fr 3fr;
  background-color: white;
}

.control-row > *{
  display: flex;
  align-items: center;
}

.image-row {
  align-items: stretch;
  padding-right: 0;
  gap: 8px;
}

.image-row .control-label {
  display: flex;
  align-items: center;
}

/* Label above each control */
.control-label {
  font-size: 0.8rem;
  padding: 15px;
}

/* Export row */
.export-row {
  height: auto;
  flex: 1 1 auto;
  padding: 0;
  gap: 0 !important;
  width: calc(100% + (2 * var(--controls-padding)));
  margin-left: calc(-1 * var(--controls-padding));
  margin-right: calc(-1 * var(--controls-padding));
  align-items: stretch;
  border: 0;
}

.export-row button {
  flex: 1 1 auto;
  width: 100%;
  margin: 0;
  max-width: 100%;
  height: 100%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
}

#controls > .export-row {
  height: auto;
  flex: 1 1 auto;

  /* override the generic row rule (#controls > *) */
  padding: 0 !important;
  margin: 0 !important;

  /* stretch to the borders of the #controls column */
  width: calc(100% + (2 * var(--controls-padding))) !important;
  margin-left: calc(-1 * var(--controls-padding)) !important;
  margin-right: calc(-1 * var(--controls-padding)) !important;
  margin-bottom: calc(-1 * var(--controls-padding)) !important;

  display: flex;
  align-items: stretch;
  gap: 0 !important;
  border: 0;
}

.export-row > button {
  width: 100%;
  flex: 1 1 auto;
  max-width: none;
}

/* ✅ FIX: override the 18vw constraint ONLY for the export row */
.export-row > :not(.control-label) {
  width: 100%;
  flex: 1 1 auto;
}

/* Shared input, select, button styles */
input, select, button, textarea {
  font-family: "ABCDiatypeMono", monospace;
  font-size: 0.8rem;
  font-weight: 100;
  padding: 4px 6px;
  border: none;
  background: white;
}

textarea {
  resize: vertical;
}

.text-input {
  width: 18vw;
  min-height: 5.33vh;
  line-height: 1.2;
  text-align: left;
}

#controls .text-input {
  width: 18vw;
  flex: 0 0 18vw;
}

/* Button-specific styling Send to printer */
button {
  cursor: pointer;
  background: #eeeeee;
  color: black;
  text-align: left;
  text-transform: uppercase;
}

button:hover {
  background: black;
  color: white;
}

button.is-active {
  background: #BCC7CE;
  color: white;
}

button.is-active:hover {
  background: black;
  color: white;
}

/* Select control wrapper */
.select-control {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Select button visual */
.select-trigger {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #EEEEEE;
  padding: 0;
  line-height: 1;
}

/* Font select hover via wrapper */
.select-control:hover .select-trigger {
  background: black;
  color: white;
}

/* Native select overlay for menu (also used for file input overlay) */
.font-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Reset for file input so it behaves like the select overlay */
.upload-input {
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

/* Font row fills available height */
.font-row {
  align-items: stretch;
}

.font-row .control-label {
  display: flex;
  align-items: center;
}

.font-row .select-control {
  height: 100%;
  width: 18vw;
  flex: 0 0 18vw;
  margin-left: auto;
  margin-right: calc(-1 * var(--controls-padding));
}

.font-row .select-trigger {
  height: 100%;
  width: 18vw;
}

.font-row .font-select {
  height: 100%;
}

/* Style button group */
.style-buttons {
  display: flex;
  gap: 0;
  width: 100%;
}

.style-buttons button {
  flex: 1 1 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #EEEEEE;
}

.style-buttons button:hover {
  background: black;
  color: white;
}

.style-buttons button.is-active {
  background: black;
  color: white;
}

.style-buttons button.is-active:hover {
  background: black;
  color: white;
}

/* Style row fills button height */
.style-row {
  align-items: stretch;
}

.style-row .control-label {
  display: flex;
  align-items: center;
}

.style-row .style-buttons {
  margin-top: 0;
  margin-bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr))
}

.style-row .style-buttons button {
  height: 100%;
}

/* =========================
   ✅ SLIDER (WICHTIGE FIXES)
   ========================= */

input[type=range] {
  --slider-track-h: 1px;
  --thumb-h: 100%;               /* wird per JS als px gesetzt */
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--range-h, 100%);
  cursor: pointer;
  margin: 0;
  padding: 0;
  background: transparent;
  display: block;
  line-height: 0;
}

#controls input[type="range"] {
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  justify-self: center;
  margin-left: auto;
  margin-right: auto;
  align-self: stretch;
  background-color: transparent;
}

/* Slider track */
input[type=range]::-webkit-slider-runnable-track {
  height: var(--slider-track-h);
  background: black;
}

/* Color slider track gradient */
.color-slider::-webkit-slider-runnable-track {
  background: linear-gradient(
    90deg,
    #000000 0%,
    #ff0000 14%,
    #ffff00 28%,
    #00ff00 42%,
    #00ffff 56%,
    #0000ff 70%,
    #ff00ff 84%,
    #ffffff 100%
  );
}

/* Slider thumb */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: var(--thumb-h);
  width: 8px;
  background: black;
  border-radius: 1px;
  /* Center thumb on the track line */
  margin-top: calc((var(--slider-track-h) - var(--thumb-h)) / 2);
  cursor: pointer;
}

/* Slider track (Firefox) */
input[type=range]::-moz-range-track {
  height: var(--slider-track-h);
  background: black;
}

/* Slider thumb (Firefox) */
input[type=range]::-moz-range-thumb {
  height: var(--thumb-h);
  width: 8px;
  background: black;
  border: none;
  border-radius: 1px;
  cursor: pointer;
}

/* Color slider track gradient (Firefox) */
.color-slider::-moz-range-track {
  height: var(--slider-track-h);
  background: linear-gradient(
    90deg,
    #000000 0%,
    #ff0000 14%,
    #ffff00 28%,
    #00ff00 42%,
    #00ffff 56%,
    #0000ff 70%,
    #ff00ff 84%,
    #ffffff 100%
  );
}

/* Right column container */
#canvas-container {
  flex: 0 0 75vw;
  width: 75vw;
  min-width: 75vw;
  max-width: 75vw;
  display: flex;
  justify-content: center;
  align-items: center;
  background: white;
  position: relative;
}

#canvas-wrapper {
  position: relative;
  display: block;
}

/* Canvas */
canvas {
  border: none;
  background-color: white;
  display: block;
  z-index: 1;
}

/* Canvas corner icons */
.canvas-corner {
  position: absolute;
  width: 80px;
  height: 8.89vh;
  pointer-events: none;
  z-index: 2;
}

.corner-top-left {
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
}

.corner-top-right {
  top: 0;
  right: 0;
  transform: translate(50%, -50%);
}

.corner-bottom-left {
  bottom: 0;
  left: 0;
  transform: translate(-50%, 50%);
}

.corner-bottom-right {
  bottom: 0;
  right: 0;
  transform: translate(50%, 50%);
}
