@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #faf9f7;
  --color-surface: #ffffff;
  --color-border: #e2dfd9;
  --color-border-focus: #4f46e5;
  --color-accent: #4f46e5;
  --color-accent-soft: rgba(79, 70, 229, 0.08);
  --color-accent-hover: #4338ca;
  --color-text: #1a1a2e;
  --color-text-muted: #6b6878;
  --color-text-hint: #9590a0;
  --color-error: #dc2626;
  --color-error-soft: rgba(220, 38, 38, 0.08);
  --color-success: #16a34a;
  --color-success-soft: rgba(22, 163, 74, 0.08);
  --radius: 0.75rem;
  --radius-lg: 1rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding-bottom: 4rem;
}

/* ===== LAYOUT ===== */
.form-container {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem;
}

@media (min-width: 640px) {
  .form-container { padding: 2rem; }
}

/* ===== HEADER ===== */
.form-header {
  text-align: center;
  padding: 2.5rem 0 2rem;
}

.form-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.form-header p {
  color: var(--color-text-muted);
  font-size: 1rem;
  max-width: 28rem;
  margin: 0 auto;
  line-height: 1.5;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1.5rem;
}

.progress-track {
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.375rem;
  text-align: center;
}

/* ===== SECTIONS ===== */
.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.25rem;
}

.form-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.form-section-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

/* ===== FIELDS ===== */
.field {
  margin-bottom: 1.25rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.375rem;
}

.field-label .required {
  color: var(--color-error);
  margin-left: 0.125rem;
}

.field-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-hint);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

input.error, select.error, textarea.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-soft);
}

textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.5;
}

select {
  cursor: pointer;
  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 1.5L6 6.5L11 1.5' stroke='%236b6878' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.field-error {
  font-size: 0.8rem;
  color: var(--color-error);
  margin-top: 0.375rem;
  display: none;
}

.field.has-error .field-error {
  display: block;
}

/* ===== CHECKBOXES / MULTI-SELECT ===== */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checkbox-pill {
  position: relative;
}

.checkbox-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-pill label {
  display: inline-block;
  padding: 0.625rem 1.125rem;
  border: 1.5px solid var(--color-border);
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}

.checkbox-pill input:checked + label {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.checkbox-pill label:active {
  transform: scale(0.97);
}

/* ===== IMAGE UPLOAD ===== */
.image-upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.image-upload-area:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.image-upload-area .upload-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}

.image-upload-area .upload-text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.image-upload-area .upload-text strong {
  color: var(--color-accent);
}

.image-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.image-preview {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-bg);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview .remove-btn {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ===== REPEATER (testimonials, products, etc.) ===== */
.repeater-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  position: relative;
}

.repeater-item .remove-repeater {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--color-text-hint);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.repeater-item .remove-repeater:hover {
  color: var(--color-error);
}

.add-repeater-btn {
  width: 100%;
  padding: 0.75rem;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  background: none;
  color: var(--color-accent);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.add-repeater-btn:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

/* ===== OPTIONAL EXPANDER ===== */
.optional-expander {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--color-accent-soft);
  border: none;
  border-radius: var(--radius);
  color: var(--color-accent);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  transition: background 0.15s;
}

.optional-expander:hover {
  background: rgba(79, 70, 229, 0.12);
}

.optional-expander .chevron {
  transition: transform 0.2s;
}

.optional-expander.expanded .chevron {
  transform: rotate(180deg);
}

.optional-content {
  display: none;
}

.optional-content.show {
  display: block;
}

/* ===== BUTTONS ===== */
.btn-submit {
  width: 100%;
  padding: 1rem;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-submit:hover { background: var(--color-accent-hover); }
.btn-submit:active { transform: scale(0.99); }
.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== CONFIRMATION ===== */
.confirmation {
  text-align: center;
  padding: 3rem 1.5rem;
}

.confirmation .check-circle {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--color-success-soft);
  color: var(--color-success);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 1.75rem;
}

.confirmation h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.confirmation p {
  color: var(--color-text-muted);
  max-width: 24rem;
  margin: 0 auto;
  line-height: 1.5;
}

/* ===== AUTOSAVE INDICATOR ===== */
.autosave-badge {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 100px;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 20;
  pointer-events: none;
}

.autosave-badge.show {
  opacity: 1;
}

/* ===== LANDING PAGE ===== */
.landing-hero {
  text-align: center;
  padding: 4rem 1.5rem 2rem;
}

.landing-hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.landing-hero p {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 32rem;
  margin: 0 auto;
  line-height: 1.5;
}

.template-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

@media (min-width: 640px) {
  .template-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .template-cards { grid-template-columns: repeat(3, 1fr); }
}

.template-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.template-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.1);
  transform: translateY(-2px);
}

.template-card .card-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.template-card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
}

.template-card p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ===== FOOTER ===== */
.form-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.8rem;
  color: var(--color-text-hint);
}

.form-footer a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
}
