@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Source+Sans+3:wght@400;500;600&display=swap");

:root {
  --page-bg: radial-gradient(circle at top, #fff7f3 0%, #f7eeee 55%, #f3e4e1 100%);
  --card-bg: #ffffff;
  --card-border: #eadcdc;
  --text-main: #1b1716;
  --text-muted: #5a4d4a;
  --accent: #d86b5c;
  --accent-dark: #c45b4d;
  --chip-bg: #fff5f2;
}

body {
  font-family: "Source Sans 3", "Helvetica Neue", sans-serif;
  background: var(--page-bg);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 40px;
  min-height: 100vh;
  margin: 0;
}

.page {
  width: min(1100px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Modal & Create Recipe */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--page-bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 60px 20px;
}

.modal {
  background: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;
  width: 100%;
  max-width: 900px;
  padding: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px 30px;
  border-bottom: none;
  position: relative;
  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
  font-size: 32px;
  text-align: center;
  font-family: "Playfair Display", "Georgia", serif;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 12px;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
  font-weight: 600;
  position: absolute;
  left: 0;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

.create-recipe-form {
  padding: 0 60px 80px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  max-width: 800px;
  margin: 0 auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group label {
  margin: 0;
  margin-top: 0;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d7c9c6;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  height: 44px;
  box-sizing: border-box;
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
  height: auto;
  min-height: 100px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: 2px solid rgba(216, 107, 92, 0.25);
  border-color: var(--accent);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 36px;
}

.form-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* Cost Options */
.cost-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.cost-options input[type="radio"] {
  display: none;
}

.cost-label {
  padding: 12px 16px;
  border: 2px solid #d7c9c6;
  border-radius: 10px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  margin: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cost-options input[type="radio"]:checked + label {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.cost-label:hover {
  border-color: var(--accent);
}

/* Tags Options */
.tags-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags-options .tag {
  padding: 6px 12px;
  border: 2px solid #d7c9c6;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
}

.tags-options .tag:hover {
  border-color: var(--accent);
  background: rgba(216, 107, 92, 0.05);
}

.tags-options .tag.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Ingredients Input Group */
.ingredient-input-group {
  display: grid;
  grid-template-columns: 2fr 120px 120px 56px;
  gap: 16px;
  align-items: flex-end;
}

.ingredient-field {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d7c9c6;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
}

.ingredient-field:focus {
  outline: 2px solid rgba(216, 107, 92, 0.25);
  border-color: var(--accent);
}

.btn-add {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 600;
}

.btn-add:hover {
  background: var(--accent-dark);
  transform: scale(1.05);
}

/* Ingredients List */
.ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.ingredient-item {
  display: grid;
  grid-template-columns: 2fr 120px 120px 56px;
  gap: 16px;
  align-items: center;
  padding: 12px 14px;
  background: #fff5f2;
  border-radius: 10px;
  border: 1px solid #e6d7d4;
}

.ingredient-item-text {
  font-size: 14px;
  margin: 0;
}

.ingredient-remove {
  background: rgba(198, 40, 40, 0.1);
  color: #c62828;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.ingredient-remove:hover {
  background: rgba(198, 40, 40, 0.2);
}

/* Steps List */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.step-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: grab;
  padding: 12px;
  background: #fff5f2;
  border-radius: 10px;
  border: 1px solid #e6d7d4;
  transition: all 0.2s ease;
}

.step-item:hover {
  box-shadow: 0 4px 12px rgba(53, 26, 19, 0.1);
}

.step-item.dragging {
  opacity: 0.7;
  cursor: grabbing;
  box-shadow: 0 8px 16px rgba(216, 107, 92, 0.2);
}

.step-item.drag-over {
  border: 2px dashed var(--accent);
  background: rgba(216, 107, 92, 0.05);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.step-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d7c9c6;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  min-height: 44px;
  resize: vertical;
}

.step-input:focus {
  outline: 2px solid rgba(216, 107, 92, 0.25);
  border-color: var(--accent);
}

.step-delete {
  background: rgba(198, 40, 40, 0.1);
  color: #c62828;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  height: 44px;
  align-self: flex-start;
}

.step-delete:hover {
  background: rgba(198, 40, 40, 0.2);
}

.btn-add-step {
  background: none;
  border: 2px dashed #d7c9c6;
  color: var(--accent);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-step:hover {
  border-color: var(--accent);
  background: rgba(216, 107, 92, 0.05);
}

/* Message Alert */
.message {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 500;
}

.message.hidden {
  display: none;
}

.message.success,
.message.ok {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

/* Form Actions */
.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn {
  background: var(--accent);
  color: #fff;
}

.btn:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}

.btn-secondary {
  background: #f0f0f0;
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #e0e0e0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 40px 16px;
  }

  .create-recipe-form {
    padding: 0 30px 60px;
    gap: 24px;
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .cost-options {
    grid-template-columns: 1fr;
  }

  .ingredient-input-group,
  .ingredient-item {
    grid-template-columns: 1fr 1fr;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 20px 12px;
  }

  .modal-header h2 {
    font-size: 24px;
  }

  .create-recipe-form {
    padding: 0 20px 40px;
    gap: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .ingredient-input-group,
  .ingredient-item {
    grid-template-columns: 1fr;
  }

  .step-item {
    flex-direction: column;
  }

  .step-delete {
    width: 100%;
    align-self: auto;
  }
}
