select,
input[type="text"],
input[type="number"] {
  height: var(--input-h);
  border: 1px solid var(--color-interface-200);
  background-color: var(--color-interface-100);
  font-family: var(--sans-serif);
  color: var(--color-txt);
  font-size: 1rem;
  padding-left: 0.5ch;
  // min-width: var(--input-w);
  // width: 100%;
  // padding: 0 1ch;
}

.field {
  display: flex;

  label {
    font-weight: 600;
    color: var(--color-800);
  }

  .input-with-unit {
    display: flex;
    gap: 0.3rem;
  }

  .unit-toggle {
    height: var(--input-h);
    display: flex;
    gap: 0.3rem;
    align-items: center;
  }

  .input-with-color {
    width: 100%;
    .clr-field {
      width: 100%;
      display: grid;
      grid-template-columns: var(--input-h) 1fr;
      grid-gap: 1ch;
      button {
        grid-column: 1;
        position: relative;
        border-radius: var(--border-radius);
        cursor: pointer;
        pointer-events: auto;
      }
      input {
        grid-column: 2;
      }
    }
  }
}

.field {
  display: grid;
  grid-template-columns: var(--label-w) 1fr;
  label {
    align-self: center;
  }
}

.field-font {
  display: grid;
  grid-template-columns: var(--label-w) 1fr;
  grid-template-rows: var(--input-h) var(--input-h);

  select {
    width: 100%;
  }
  .field-checkbox {
    grid-column: 2;
    padding-top: var(--space-xs);
    label {
      font-weight: 400;
      margin-left: 0.75ch;
      color: var(--color-txt);
    }
  }
}

.field-text-size {
  input[type="number"] {
    width: var(--input-w-small);
    padding-left: 0.75ch;
  }
  input[type="range"] {
    flex-grow: 2;
    flex-shrink: 2;
  }
}

.field-margin,
.field-size {
  display: inline-grid;
  width: calc(50% - 1ch);
  grid-template-columns: 6.5ch var(--input-w-small) 1fr;
  margin-bottom: var(--space-xs);
  input {
    width: var(--input-w-small);
    padding-left: 0.75ch;
  }
  &:nth-of-type(odd) {
    margin-right: 2ch;
  }
}

.checkbox-field {
  margin: calc(var(--space-xs) * 2) 0;
  grid-template-columns: 3ch 1fr;
  input {
    justify-self: left;
    margin: 0;
  }
}

.field--view-only {
  opacity: 0.3;
}

/* Label with CSS tooltip */
.label-with-tooltip {
  text-decoration: underline dotted 1px var(--color-200);
  text-underline-offset: 2px;
  cursor: help;
  position: relative;

  &::after {
    content: attr(data-css);
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 4px;
    padding: 0.25rem 0.5rem;
    background: var(--color-interface-700);
    color: var(--color-interface-050);
    font-family: var(--mono);
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition:
      opacity 0.15s ease,
      visibility 0.15s ease;
    z-index: 10;
  }

  &:hover::after {
    opacity: 1;
    visibility: visible;
  }
}

// INPUT NUMBER ===============================================

// Masquer les spinners natifs partout
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

.number-input {
  position: relative;
  // padding: 0 1ch!important;
  input {
    padding-top: 0;
    padding-bottom: 0;
  }
  .spinner-buttons {
    height: var(--input-h);
    width: var(--input-h);
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 0;

    button {
      height: calc(var(--input-h) * 0.5);
      cursor: pointer;
      padding: 0;
      svg {
        width: 10px;
        height: auto;
      }
      svg path {
        fill: var(--color-interface-600);
      }
      &:hover {
        svg path {
          fill: var(--color-interface-900);
        }
      }
    }
    .spinner-down {
      svg {
        // position: relative;
        // top: -2px;
      }
    }
  }
}
// Composant NumberInput avec boutons personnalisés
// .number-input {
//   position: relative;
//   display: flex;
//   align-items: center;
//   width: 100%;
//   position: relative;

//   input[type="number"] {
//     width: 100%;
//     box-sizing: border-box;
//   }

//   .spinner-buttons {
//     background-color: red;
//     position: absolute;
//     right: 1px;
//     top: 1px;
//     bottom: 1px;
//     display: flex;
//     flex-direction: column;
//     justify-content: center;
//     gap: 1px;
//     z-index: 10;

//     .spinner-btn {
//       display: flex;
//       align-items: center;
//       justify-content: center;
//       width: 20px;
//       height: 10px;
//       padding: 0;
//       margin: 0;
//       background-color: var(--color-interface-200);
//       border: 1px solid var(--color-interface-300);
//       border-radius: 2px;
//       cursor: pointer;
//       transition: background-color 0.15s ease;
//       color: var(--color-interface-700);
//       line-height: 0;

//       svg {
//         width: 8px;
//         height: 6px;
//         display: block;
//       }

//       &:hover:not(:disabled) {
//         background-color: var(--color-interface-300);
//         color: var(--color-interface-900);
//       }

//       &:active:not(:disabled) {
//         background-color: var(--color-interface-400);
//       }

//       &:disabled {
//         opacity: 0.3;
//         cursor: not-allowed;
//       }
//     }
//   }
// }
