/* ── CodRobot panel form system ── */

.form-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.form-section-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.form-section-title {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

.form-section-fields {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  margin-bottom: 0;
  width: 100%;
}

.form-group > label:not(.field-check-label):not(.field-radio-option) {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.45;
}

.form-group > .field-hint:first-child {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

/* Text inputs, textareas, selects */
.field-input,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="search"],
.form-group input[type="tel"],
.form-group input[type="url"],
.form-group textarea,
.form-group select,
.filters-grid input,
.filters-grid select,
.filters-grid textarea,
.team-create-form input,
.team-create-form select,
.team-create-form textarea,
.conversations-filters input,
.conversations-filters select,
.orders-filters input,
.orders-filters select,
.customers-filters input,
.customers-filters select,
.wa-advanced-form input,
.wa-advanced-form textarea,
.wa-advanced-form select,
.wa-instructions-form input,
.wa-instructions-form textarea,
.wa-instructions-form select,
.app-content .card input:not([type="checkbox"]):not([type="radio"]),
.app-content .card textarea,
.app-content .card select,
.products-modal input:not([type="checkbox"]):not([type="radio"]),
.products-modal textarea,
.products-modal select,
.product-modal input:not([type="checkbox"]):not([type="radio"]),
.product-modal textarea,
.product-modal select {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group textarea,
.field-input-textarea {
  resize: vertical;
  min-height: 6rem;
}

.form-group select,
.field-select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem;
  cursor: pointer;
}

.field-input:focus,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.filters-grid input:focus,
.filters-grid select:focus,
.filters-grid textarea:focus,
.team-create-form input:focus,
.team-create-form select:focus,
.team-create-form textarea:focus,
.wa-advanced-form input:focus,
.wa-advanced-form textarea:focus,
.wa-advanced-form select:focus,
.wa-instructions-form input:focus,
.wa-instructions-form textarea:focus,
.wa-instructions-form select:focus,
.app-content .card input:focus,
.app-content .card textarea:focus,
.app-content .card select:focus,
.products-modal input:focus,
.products-modal textarea:focus,
.products-modal select:focus,
.product-modal input:focus,
.product-modal textarea:focus,
.product-modal select:focus {
  outline: none;
  border-color: var(--brand-accent, #f5a623);
  box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.25);
}

/* Checkbox row: box left, label + hint stacked right */
.field-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
}

.field-check-content {
  flex: 1;
  min-width: 0;
  padding-top: 0.05rem;
}

.field-check-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: #111827;
  line-height: 1.4;
  cursor: pointer;
}

.field-check .field-hint {
  margin-top: 0.25rem;
}

/* Custom checkbox */
.field-checkbox,
.form-group input[type="checkbox"],
.field-check input[type="checkbox"],
.wa-toggle-label input[type="checkbox"],
.agent-product-check-item input[type="checkbox"] {
  appearance: none;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  border: 2px solid #d1d5db;
  border-radius: 0.3rem;
  background: #fff;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-checkbox:checked,
.form-group input[type="checkbox"]:checked,
.field-check input[type="checkbox"]:checked,
.wa-toggle-label input[type="checkbox"]:checked,
.agent-product-check-item input[type="checkbox"]:checked {
  border-color: var(--brand-accent, #f5a623);
  background-color: var(--brand-accent, #f5a623);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.85rem;
}

.field-checkbox:focus-visible,
.form-group input[type="checkbox"]:focus-visible,
.field-check input[type="checkbox"]:focus-visible,
.wa-toggle-label input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.35);
}

/* Legacy wa-toggle — align with field-check */
.wa-toggle-row {
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: none;
}

.wa-toggle-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
}

.wa-toggle-label > span {
  flex: 1;
  padding-top: 0.05rem;
  line-height: 1.4;
  color: #111827;
}

.wa-toggle-highlight {
  padding: 0;
  background: transparent;
  border: none;
}

/* Custom radio */
.field-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.field-radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  width: 100%;
  margin: 0;
}

.field-radio-option input[type="radio"],
.agent-product-options input[type="radio"] {
  appearance: none;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.1rem 0 0;
  border: 2px solid #d1d5db;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-radio-option input[type="radio"]:checked,
.agent-product-options input[type="radio"]:checked {
  border-color: var(--brand-accent, #f5a623);
  border-width: 2px;
  background: radial-gradient(circle, var(--brand-accent, #f5a623) 40%, #fff 42%);
}

.field-radio-option input[type="radio"]:focus-visible,
.agent-product-options input[type="radio"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.35);
}

.field-radio-text {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  color: #374151;
  line-height: 1.45;
  padding-top: 0.05rem;
}

/* Product checklist */
.agent-product-checklist {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: #fff;
}

.agent-product-checklist[hidden] {
  display: none;
}

.agent-product-check-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.4rem 0;
  font-size: 0.95rem;
  cursor: pointer;
  width: 100%;
}

.agent-product-check-item span {
  flex: 1;
  line-height: 1.45;
  color: #374151;
  padding-top: 0.05rem;
}

.agent-language-other {
  margin-top: 0.75rem;
}

.agent-language-other[hidden] {
  display: none;
}

/* Order confirmation message — hidden when toggle off */
.agent-order-section:not(:has(#order_confirmation_enabled:checked)) .order-confirm-message-wrap {
  display: none;
}

.form-actions-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  width: 100%;
}
