/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

input,
button,
select,
textarea {
  font-family: var(--font-family);
}

/* ============================================================================
   GUI CONTAINER
   ============================================================================ */

.custom-gui {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 20rem;
  background: black;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.5rem;
  padding-bottom: 6rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
}
.custom-gui::-webkit-scrollbar {
  width: 0.5rem;
}
.custom-gui::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}
.custom-gui::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 0.25rem;
}
.custom-gui::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ============================================================================
   GUI SECTIONS
   ============================================================================ */

.gui-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: fit-content;
}
.gui-section-title {
  color: #fff;
  font-size: 0.8rem;
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.gui-section-subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.625rem;
  margin: 0.25rem 0 0 0;
  font-weight: 700;
  font-style: italic;
}

.gui-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

/* ============================================================================
   GUI CONTROLS
   ============================================================================ */

.gui-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}
.gui-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}
.gui-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.gui-control-row label {
  flex-shrink: 0;
}
.gui-control-value {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  text-align: right;
  min-width: 3rem;
}
.gui-control label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 400;
}
.gui-control select,
.gui-control input[type=range],
.gui-control input[type=text] {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  color: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.gui-control select:hover,
.gui-control input[type=range]:hover,
.gui-control input[type=text]:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}
.gui-control select:focus,
.gui-control input[type=range]:focus,
.gui-control input[type=text]:focus {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}
.gui-control select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='rgba(255,255,255,0.7)' d='M0 0l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 0.625rem;
  appearance: none;
}
.gui-control select option {
  background: #1a1a1a;
  color: #fff;
  padding: 0.5rem;
}
.gui-control input[type=range] {
  padding: 0;
  height: 0.375rem;
  appearance: none;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 0.25rem;
  cursor: pointer;
}
.gui-control input[type=range]::-webkit-slider-thumb, .gui-control input[type=range]::-moz-range-thumb {
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  background: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3), 0 0 0 0.125rem rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}
.gui-control input[type=range]::-webkit-slider-thumb:hover, .gui-control input[type=range]::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.4), 0 0 0 0.125rem rgba(255, 255, 255, 0.2);
}
.gui-control input[type=range]::-webkit-slider-thumb:active, .gui-control input[type=range]::-moz-range-thumb:active {
  transform: scale(1.05);
}
.gui-control input[type=text] {
  cursor: text;
}

/* ============================================================================
   COLOR CONTROLS
   ============================================================================ */

.gui-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.gui-hex-input {
  text-transform: uppercase;
  cursor: text !important;
  flex: 1;
  padding-right: 2.5rem;
}
.gui-hex-input:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}
.gui-hex-input:focus {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.4);
}
.gui-hex-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.gui-paste-btn {
  position: absolute;
  right: 0.25rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 0.25rem;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
}
.gui-paste-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.gui-paste-btn:active {
  transform: scale(0.95);
}
.gui-paste-btn i {
  pointer-events: none;
}

.gui-color-picker {
  width: 100%;
  height: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background: none;
  padding: 0.25rem;
}
.gui-color-picker:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.02);
}
.gui-color-picker:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
}
.gui-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}
.gui-color-picker::-webkit-color-swatch, .gui-color-picker::-moz-color-swatch {
  border: none;
  border-radius: 0.25rem;
}

.gui-colors {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.gui-color-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}
.gui-color-item label {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
}

.gui-color-wrapper {
  position: relative;
  width: 3rem;
  height: 3rem;
}

.gui-color-input {
  width: 100%;
  height: 100%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background: none;
  pointer-events: auto;
}
.gui-color-input:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.05);
}
.gui-color-input:focus {
  outline: none;
}
.gui-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.gui-color-input::-webkit-color-swatch, .gui-color-input::-moz-color-swatch {
  border: none;
  border-radius: 0.125rem;
}

.gui-color-checkmark {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 0.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.gui-color-checkmark i {
  color: #fff;
  font-size: 1.5rem;
}
.gui-color-checkmark.show {
  opacity: 1;
}

/* ============================================================================
   TIME CONTROLS
   ============================================================================ */

.gui-time-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.gui-time-control .gui-time-value {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  text-align: center;
  color: #fff;
  font-size: 0.875rem;
}
.gui-time-control button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  color: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 2.5rem;
}
.gui-time-control button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}
.gui-time-control button:active {
  transform: scale(0.95);
}

/* ============================================================================
   GUI ELEMENTS
   ============================================================================ */

/* Status indicator */

.gui-status {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.375rem;
  padding: 0.75rem;
  text-align: center;
  color: yellow;
  font-size: 0.8rem;
  font-style: italic;
}

/* Buttons */

.gui-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.375rem;
  color: #fff;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  width: 100%;
  font-weight: 500;
}
.gui-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}
.gui-button:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.98);
}

/* Checkboxes */

.gui-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}
.gui-checkbox input[type=checkbox] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.25rem;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.gui-checkbox input[type=checkbox]:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}
.gui-checkbox input[type=checkbox]:checked {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.9);
}
.gui-checkbox input[type=checkbox]:checked::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.0625rem;
  width: 0.375rem;
  height: 0.625rem;
  border: solid #000;
  border-width: 0 0.125rem 0.125rem 0;
  transform: rotate(45deg);
}
.gui-checkbox label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
  cursor: pointer;
  margin: 0;
}

/* ============================================================================
   RESPONSIVE STYLES
   ============================================================================ */

/* Mobile Styles (800px and below) */
@media screen and (max-width: 800px) {
  /* Move GUI panel to bottom on mobile */
  .custom-gui {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 50vh;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

  /* Adjust color grid alignment on mobile */
  .gui-colors {
    justify-content: flex-start;
  }
}
