@import './variables';

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Roboto', sans-serif;
  color: $gray-900;
}

.section-hero {
  padding: 1.5rem;
  max-width: 900px;
  margin-inline: auto;
  margin-bottom: 2rem;
}

.header {
  text-align: center;
  border-bottom: 1px solid $gray-300;
  padding-bottom: 2rem;
  padding-top: 1rem;
  h1 {
    margin: 0;
    color: $gray-800;
  }
}

.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.form-label {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: $gray-700;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: $gray-900;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid $gray-400;
  border-radius: 0.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  outline: 0;
  &:focus {
    border-color: $lightBlue;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  }
  &::placeholder {
    transition: 100ms ease-in-out;
  }
}

.form-floating {
  position: relative;
  background: $gray-200;
  border-radius: 0.25rem;
}

.form-floating .form-label {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  padding: 1rem 0.75rem;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 0 0;
  transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
}

.form-floating .form-control {
  padding: 1rem 0.75rem;
  line-height: 1.25;
  height: 16.25rem;
}

.form-floating .form-control:focus,
.form-floating .form-control:not(:placeholder-shown) {
  padding-top: 1.675rem;
  padding-bottom: 2.625rem;
}

textarea {
  resize: none;
  min-height: 12rem;
}

.form-floating .form-control:not(:focus)::placeholder {
  color: transparent;
}

.form-floating .form-control:focus::placeholder {
  color: $gray-400;
}

.form-floating .form-control:focus ~ .form-label,
.form-floating > .form-control:not(:placeholder-shown) ~ .form-label {
  opacity: 0.65;
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

.btn {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  cursor: pointer;
  background-color: transparent;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.25rem;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
    border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;

  &:focus {
    border-color: $lightBlue;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
  }

  &:hover {
    color: #fff;
    background-color: #0b5ed7;
    border-color: #0a58ca;
  }

  &:disabled {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
    user-select: none;
    pointer-events: none;
    cursor: default;
  }
}

.btn-primary {
  color: #fff;
  background-color: #0d6efd;
  border-color: #0d6efd;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  border-radius: 0.2rem;
}

.form-floating .btn {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
}

.svg-preview-container {
  height: 100%;
  width: 100%;
  min-height: 16.25rem;
  border: 1px dashed $gray-400;
  border-radius: 0.25rem;
  position: relative;
  overflow: hidden;
  .svg-preview-label {
    margin: 1rem 0.75rem;
    position: absolute;
    top: 0;
    left: 0;
  }

  .svg-preview {
    height: 90%;
    background-position: center;
    background-repeat: no-repeat;
  }

  .svg-preview.active ~ .svg-preview-label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem);
  }

  .color-picker {
    position: absolute;
    max-width: 3.5rem;
    height: auto;
    padding: 0.375rem;
    right: 0.5rem;
    bottom: 0.5rem;
    height: 2.5rem;
    cursor: pointer;
  }
}

.shadow-none {
  box-shadow: none;
  &:focus {
    box-shadow: none;
    border-color: $gray-400;
  }
}

.error {
  position: relative;
  padding: 1rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  color: #842029;
  background-color: #f8d7da;
  border-color: #f5c2c7;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  display: none;
}
