/**
 * @file
 * Modern input component classes with validation states.
 */

/* ============================================
   Input Components - Form Controls
   ============================================ */

@layer components {
  /* Base input class - clean, flat design */
  .input {
    @apply block w-full px-4 py-3;
    @apply text-fluid-base text-gray-900;
    @apply bg-gray-50 border border-gray-200 rounded-lg;
    @apply placeholder:text-gray-400;
    @apply transition-smooth;
    @apply focus:outline-none focus:bg-white focus:border-gray-400;
    @apply disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed;
  }

  /* Error state modifier */
  .input-error {
    @apply border-error-500 text-error-900;
    @apply focus:border-error-500 focus:ring-error-500/20;
  }

  /* Error message text */
  .input-error-message {
    @apply text-sm text-error-600 mt-1;
  }

  /* Success state modifier */
  .input-success {
    @apply border-success-500;
    @apply focus:border-success-500 focus:ring-success-500/20;
  }

  /* Select dropdown class - clean, flat design */
  .select {
    @apply block w-full px-4 py-3 pr-10;
    @apply text-fluid-base text-gray-900;
    @apply bg-gray-50 border border-gray-200 rounded-lg;
    @apply transition-smooth;
    @apply focus:outline-none focus:bg-white focus:border-gray-400;
    @apply disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed;
    @apply appearance-none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem 1.25rem;
  }

  /* Label class */
  .label {
    @apply block text-sm font-medium text-gray-900 mb-2;
  }

  /* Form group wrapper */
  .form-group {
    @apply mb-6;
  }
}

/* ============================================
   Legacy Drupal Form Styles
   ============================================ */

form .field-multiple-table {
  margin: 0;
}
form .field-multiple-table .field-multiple-drag {
  width: 30px;
  padding-right: 0; /* LTR */
}
[dir="rtl"] form .field-multiple-table .field-multiple-drag {
  padding-left: 0;
}
form .field-multiple-table .field-multiple-drag .tabledrag-handle {
  padding-right: 0.5em; /* LTR */
}
[dir="rtl"] form .field-multiple-table .field-multiple-drag .tabledrag-handle {
  padding-right: 0;
  padding-left: 0.5em;
}
form .field-add-more-submit {
  margin: 0.5em 0 0;
}

/**
 * Markup generated by Form API.
 */
.form-item,
.form-actions {
  margin-top: 1em;
  margin-bottom: 1em;
}
tr.odd .form-item,
tr.even .form-item {
  margin-top: 0;
  margin-bottom: 0;
}
.form-composite > .fieldset-wrapper > .description,
.form-item .description {
  font-size: 0.85em;
}
label.option {
  display: inline;
  font-weight: normal;
}
.form-composite > legend,
.label {
  display: inline;
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-weight: bold;
}
.form-checkboxes .form-item,
.form-radios .form-item {
  margin-top: 0.4em;
  margin-bottom: 0.4em;
}
.form-type-radio .description,
.form-type-checkbox .description {
  margin-left: 2.4em; /* LTR */
}
[dir="rtl"] .form-type-radio .description,
[dir="rtl"] .form-type-checkbox .description {
  margin-right: 2.4em;
  margin-left: 0;
}
.marker {
  color: #e00;
}
.form-required::after {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 0.3em;
  content: "";
  vertical-align: super;
  /* Use a background image to prevent screen readers from announcing the text. */
  background-image: url(../images/icons/required.svg);
  background-repeat: no-repeat;
  background-size: 6px 6px;
}
abbr.tabledrag-changed,
abbr.ajax-changed {
  border-bottom: none;
}
.form-item input.error,
.form-item textarea.error,
.form-item select.error {
  @apply border-2 border-error-500;
}

/* Inline error messages. */
.form-item--error-message::before {
  display: inline-block;
  width: 14px;
  height: 14px;
  content: "";
  vertical-align: sub;
  background: url(../images/icons/error.svg) no-repeat;
  background-size: contain;
}
