/**
 * Custom Form Inputs - Unified Styling
 * Makes text inputs, textareas, and selects consistent
 */

/* Base styling for all form inputs */
input[type="text"].control,
input[type="email"].control,
input[type="password"].control,
input[type="number"].control,
input[type="tel"].control,
input[type="url"].control,
input[type="date"].control,
textarea.control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: #333;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: all 0.3s ease;
  outline: none;
  line-height: 1.5;
  box-sizing: border-box;
  min-height: 48px; /* Ensure consistent height with selects */
}

/* Placeholder styling */
input.control::placeholder,
textarea.control::placeholder {
  color: #999;
  opacity: 1;
}

/* Hover state */
input.control:hover,
textarea.control:hover {
  border-color: #c9a961;
  box-shadow: 0 2px 8px rgba(201, 169, 97, 0.15);
}

/* Focus state */
input.control:focus,
textarea.control:focus {
  border-color: #c9a961;
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

/* Disabled state */
input.control:disabled,
textarea.control:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  border-color: #e0e0e0;
}

/* Textarea specific */
textarea.control {
  min-height: 100px;
  resize: vertical;
}

/* Error state */
input.control.error,
textarea.control.error {
  border-color: #e53935;
}

input.control.error:focus,
textarea.control.error:focus {
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

/* Success state */
input.control.success,
textarea.control.success {
  border-color: #4CAF50;
}

input.control.success:focus,
textarea.control.success:focus {
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Small variant */
input.control.small,
textarea.control.small {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
}

/* Large variant */
input.control.large,
textarea.control.large {
  padding: 1rem 1.25rem;
  font-size: 1.125rem;
}

/* Number input - hide spinners for cleaner look */
input[type="number"].control::-webkit-inner-spin-button,
input[type="number"].control::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

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

/* Field label styling */
.field .label {
  display: block;
  margin-bottom: 0.5rem;
  color: #333;
  font-weight: 600;
  font-size: 0.95rem;
}

/* Field wrapper */
.field {
  margin-bottom: 1.25rem;
}

.field.field--wide {
  grid-column: 1 / -1;
}

/* Admin form specific adjustments */
.admin-form .control,
.admin-shell .control {
  width: 100%;
}

/* Modal forms */
.modal-form .control {
  width: 100%;
}

/* Focus within field labels */
.field:focus-within .label {
  color: #c9a961;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  input.control,
  textarea.control {
    padding: 0.65rem 0.875rem;
    font-size: 1rem; /* iOS requires 16px to prevent zoom */
  }
  
  .field .label {
    font-size: 0.9rem;
  }
}

/* Integration with file upload components */
.file-upload-container + .field,
.field + .file-upload-container {
  margin-top: 1.25rem;
}

/* Custom scrollbar for textareas */
textarea.control::-webkit-scrollbar {
  width: 8px;
}

textarea.control::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 4px;
}

textarea.control::-webkit-scrollbar-thumb {
  background: #c9a961;
  border-radius: 4px;
}

textarea.control::-webkit-scrollbar-thumb:hover {
  background: #d4af37;
}

/* Animation on change */
@keyframes inputPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.01); }
  100% { transform: scale(1); }
}

input.control.changed,
textarea.control.changed {
  animation: inputPulse 0.3s ease;
}

/* Read-only state */
input.control[readonly],
textarea.control[readonly] {
  background: #fafafa;
  border-color: #e0e0e0;
  cursor: default;
}

/* Required field indicator */
.field.required .label::after {
  content: ' *';
  color: #e53935;
  font-weight: bold;
}

/* Helper text */
.field-helper {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #666;
}

.field.error .field-helper {
  color: #e53935;
}

.field.success .field-helper {
  color: #4CAF50;
}

/* Input groups (e.g., with icons) */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .control {
  flex: 1;
}

.input-group-icon {
  position: absolute;
  left: 1rem;
  color: #999;
  pointer-events: none;
}

.input-group:has(.input-group-icon) .control {
  padding-left: 2.5rem;
}

