// Vagabond RPG - Form Styles
// ===========================

.vagabond {
  // Text input
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  input[type="search"] {
    @include input-base;
    width: 100%;
  }

  // Number input (smaller for stats)
  input[type="number"] {
    text-align: center;

    // Hide spinner buttons
    &::-webkit-outer-spin-button,
    &::-webkit-inner-spin-button {
      -webkit-appearance: none;
      margin: 0;
    }
    -moz-appearance: textfield;
  }

  // Textarea
  textarea {
    @include input-base;
    width: 100%;
    min-height: 100px;
    resize: vertical;
  }

  // Select
  select {
    @include input-base;
    width: 100%;
    height: 2.5rem; // Fixed height for consistent visibility
    padding: $spacing-2 $spacing-8 $spacing-2 $spacing-3;
    cursor: pointer;
    appearance: none;
    background-color: var(--color-bg-input) !important;
    color: var(--color-text-primary) !important;
    font-size: $font-size-base;
    line-height: 1.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232c2416' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right $spacing-3 center;
  }

  // Dark theme select arrow override (per-sheet, following D&D5e pattern)
  &.themed.theme-dark select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e8dcc8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  }

  // Checkbox
  input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-accent-primary);

    @include focus-visible;
  }

  // Checkbox with label
  .checkbox-group {
    display: flex;
    align-items: center;
    gap: $spacing-2;

    label {
      cursor: pointer;
    }
  }

  // Radio button
  input[type="radio"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
    accent-color: var(--color-accent-primary);

    @include focus-visible;
  }

  // Form group (label + input)
  .form-group {
    margin-bottom: $spacing-4;

    label {
      display: block;
      margin-bottom: $spacing-1;
      font-weight: $font-weight-medium;
      color: var(--color-text-secondary);
    }

    &.inline {
      @include flex-between;

      label {
        margin-bottom: 0;
        margin-right: $spacing-2;
      }

      input,
      select {
        flex: 1;
        max-width: 200px;
      }
    }
  }

  // Form row (multiple inputs side by side)
  .form-row {
    display: flex;
    gap: $spacing-4;

    .form-group {
      flex: 1;
    }
  }

  // Stat input (large centered number)
  .stat-input {
    @include stat-badge;

    input {
      width: 100%;
      height: 100%;
      padding: 0;
      font-family: $font-family-header;
      font-size: $font-size-3xl;
      font-weight: $font-weight-bold;
      text-align: center;
      background: transparent;
      border: none;
      color: inherit;

      &:focus {
        outline: none;
      }
    }
  }

  // Resource input (current / max)
  .resource-input {
    display: flex;
    align-items: center;
    gap: $spacing-1;

    input {
      width: 3rem;
      text-align: center;
    }

    .separator {
      color: var(--color-text-muted);
    }
  }

  // Inline editable field
  .inline-edit {
    padding: $spacing-1 $spacing-2;
    background: transparent;
    border: 1px solid transparent;
    border-radius: $radius-sm;
    transition: all $transition-fast;

    &:hover {
      border-color: var(--color-border-light);
    }

    &:focus {
      background: var(--color-bg-input);
      border-color: var(--color-accent-primary);
      outline: none;
    }
  }

  // Readonly display (looks like text, not input)
  .readonly-value {
    padding: $spacing-2 $spacing-3;
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: $radius-md;
    color: var(--color-text-secondary);
  }
}

// Global dark theme select arrow override (when body has theme-dark)
body.theme-dark .vagabond select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e8dcc8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}
