/*
 * CraftBook Custom Theme V1 — Form Styles
 *
 * Shared form input, label, and button styles.
 * Individual forms (comment, newsletter, search) extend these in
 * their respective component stylesheets.
 */

/* Base input / select / textarea */
input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="password"],
textarea,
select {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-background-alt);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-slow);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-placeholder);
}

/* Select dropdown arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

/* Checkbox and radio */
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

/* Label */
label {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

/* Required indicator */
.required {
  color: var(--color-error);
}

/* Form group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

/* Error state */
.form-group--error input,
.form-group--error textarea {
  border-color: var(--color-error);
}

.form-error-message {
  font-size: var(--text-sm);
  color: var(--color-error);
}

/* Success state */
.form-group--success input,
.form-group--success textarea {
  border-color: var(--color-success);
}

/* Search form (WordPress default) */
.search-form {
  display: flex;
  gap: var(--space-2);
}

.search-form .search-field {
  flex: 1;
}

.search-form .search-submit {
  padding: var(--space-3) var(--space-5);
  background-color: var(--color-accent);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  transition: background-color var(--transition-fast);
}

.search-form .search-submit:hover {
  background-color: var(--color-accent-hover);
}

.search-form .search-submit:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
