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;
  &:focus{
    border-color: var(--color-interface-400);
  }
  
}

/// RANGE ---------------------------------------------------------------------------------

input[type="range"]{
  -webkit-appearance: none; 
  background: transparent; 
}

@mixin thumb(){
  border: 2px solid var(--color-panel-bg);
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--color-interface-500);
  position: relative;
  top: -6px;
  cursor: pointer;
}

@mixin track(){
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: var(--color-interface-200);
  border-radius: 2px;
}

/* WebKit/Blink */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  @include thumb();
}
input[type=range]::-webkit-slider-runnable-track {
  @include track();
}

/*  Firefox */
input[type=range]::-moz-range-thumb {
  @include thumb();
}
input[type=range]::-moz-range-track{
  @include track();
}
/*  IE */
input[type=range]::-ms-thumb {
  @include thumb();
}
input[type=range]::-ms-track{
  background: transparent; 
  border-color: transparent;
  color: transparent;
  @include track();
}




// Checkbox ===============================================

input[type="checkbox"]{
 display: none;
}

input[type="checkbox"] + label{
  position: relative;
  padding-left: 24px;
}

input[type="checkbox"] + label::before{
  content: "✔";
  font-size: 11px;
  padding-bottom: 3px;
  padding-left: 3px;
  --size: 11px;
  width: var(--size);
  height: var(--size);
  border-radius: var(--border-radius);
  display: block;
  position: absolute;
  top: 0px;
  border: 1px solid var(--color-interface-400);
  background-color: var(--color-interface-100);

  color: transparent;
}


input[type="checkbox"]:checked + label::before{
  background-color: var(--color-interface-600);
  border-color: var(--color-interface-600);
  color: var(--color-panel-bg);
}




// GENERAL FIELD  ===========================================

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



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


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



  .input-with-range {
    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);
      grid-gap: 1ch;
      button{
        grid-column: 1;
        position: relative;
        border-radius: var(--border-radius);

      }
      input{
        grid-column: 2;
      }

    }
  }
}





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

  select{
    width: 100%;
  }
  .checkbox-field{
    grid-column: 2;
    padding-top: var(--space-xs);
    margin: 0;
    label{
      font-weight: 400;
      color: var(--color-txt);
      text-decoration-color: var(--color-interface-300)!important;
    }
  }
}

.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;

  }
}


.margins label{
  color: var(--color-txt);
  font-weight: normal;
  text-decoration-color: var(--color-interface-300)!important;
}

.field-generated-content{
  

  .positions{
    display: flex;
    gap: 2em;
  }

  .group-position{
    display: flex;
    gap: 0.3em;
  }
}









// TOOLTIP ===============================================
.label-with-tooltip {
  text-decoration: underline dotted 1px var(--color-400);
  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 ===============================================

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;
  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); }
      }
    }
  }

}
