/* === forms.css === */

.forms-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.forms-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.forms-header h2 {
  margin: 0 0 6px;
  color: #1e293b;
  font-size: 1.5rem;
  font-weight: 900;
}

.forms-header p {
  margin: 0;
  color: #64748b;
  font-size: 0.86rem;
}

.forms-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.forms-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.forms-search {
  position: relative;
}

.forms-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.86rem;
}

.forms-search input {
  width: 100%;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 11px 14px 11px 40px;
  color: #1e293b;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  background: #ffffff;
}

.forms-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.forms-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.forms-summary-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}

.forms-summary-value {
  display: block;
  color: #1e293b;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
}

.forms-summary-label {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.form-card {
  min-width: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.form-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

.form-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.form-card-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #059669);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.22);
}

.form-card-icon.custom {
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
}

.form-card-title {
  min-width: 0;
  flex: 1;
}

.form-card-title h3 {
  margin: 0;
  color: #1e293b;
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.form-card-title p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.4;
}

.form-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.form-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.66rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f1f5f9;
  color: #475569;
}

.form-badge.active,
.form-badge.upcoming {
  background: #dcfce7;
  color: #166534;
}

.form-badge.draft,
.form-badge.paused {
  background: #fef3c7;
  color: #92400e;
}

.form-badge.archived,
.form-badge.completed,
.form-badge.cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.form-card-url {
  margin-top: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 9px 11px;
  color: #475569;
  background: #f8fafc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.form-card-meta div {
  border-radius: 9px;
  background: #f8fafc;
  padding: 9px 10px;
}

.form-card-meta strong {
  display: block;
  color: #1e293b;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
}

.form-card-meta span {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.form-card-actions .btn-crm {
  flex: 1 1 118px;
  padding: 9px 12px;
  font-size: 0.74rem;
}

.forms-empty {
  padding: 44px 20px;
  text-align: center;
  color: #64748b;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
}

.forms-empty i {
  display: block;
  margin-bottom: 12px;
  color: #94a3b8;
  font-size: 2rem;
}

.form-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-editor-grid .span-2 {
  grid-column: 1 / -1;
}

.form-field-builder {
  margin-top: 16px;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.form-field-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.form-field-builder-head strong {
  color: #1e293b;
  font-size: 0.9rem;
  font-weight: 900;
}

.form-field-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-field-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) minmax(130px, 0.8fr) 96px 36px;
  gap: 8px;
  align-items: start;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  background: #f8fafc;
}

.form-field-row-options {
  grid-column: 1 / -1;
  display: none;
}

.form-field-row.has-options .form-field-row-options {
  display: block;
}

.form-field-required {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 800;
}

.form-field-required input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.form-remove-field {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: #fee2e2;
  color: #b91c1c;
  cursor: pointer;
}

.form-remove-field:hover {
  background: #fecaca;
}

@media (max-width: 900px) {
  .forms-toolbar,
  .forms-summary,
  .form-card-meta,
  .form-editor-grid,
  .form-field-row {
    grid-template-columns: 1fr;
  }

  .forms-header-actions {
    width: 100%;
  }

  .forms-header-actions .btn-crm {
    flex: 1;
  }
}
