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

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

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --accent: #d4622a;
  --accent2: #2a7d4f;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e0dbd2;
  --radius: 12px;
}

body { background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif; min-height: 100vh; }

nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 2rem; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.logo { font-family: 'Lora', serif; font-size: 1.3rem; font-weight: 600; color: var(--accent); }
nav a { color: var(--muted); text-decoration: none; margin-left: 1.5rem; font-size: 0.9rem; }
nav a:hover { color: var(--accent); }

main { max-width: 1000px; margin: 0 auto; padding: 2rem 1rem; }

.card {
  max-width: 400px; margin: 4rem auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2.5rem; display: flex; flex-direction: column; gap: 1rem;
}
.card h2 { font-family: 'Lora', serif; font-size: 1.6rem; }
.card input {
  padding: 0.75rem 1rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.95rem; width: 100%;
}
.card button {
  background: var(--accent); color: white; border: none;
  padding: 0.8rem; border-radius: 8px; font-size: 1rem; cursor: pointer;
}
.card button:hover { opacity: 0.9; }
.card p { font-size: 0.85rem; color: var(--muted); text-align: center; }
.card a { color: var(--accent); }

.dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 700px) { .dashboard { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}
.panel h2 { font-family: 'Lora', serif; margin-bottom: 1rem; font-size: 1.2rem; }

.input-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.input-row input {
  flex: 1; min-width: 70px; padding: 0.6rem 0.8rem;
  border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem;
}
.input-row button {
  background: var(--accent2); color: white; border: none;
  padding: 0.6rem 1rem; border-radius: 8px; cursor: pointer; white-space: nowrap;
}

#lista-ingredientes { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
#lista-ingredientes li {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg); border-radius: 8px; padding: 0.5rem 0.8rem; font-size: 0.9rem;
}
#lista-ingredientes li button { background: none; border: none; color: #cc3333; cursor: pointer; font-size: 1rem; }

.btn-generar {
  width: 100%; background: var(--accent); color: white; border: none;
  padding: 0.85rem; border-radius: 8px; font-size: 1rem;
  cursor: pointer; font-family: 'Lora', serif;
}
.btn-generar:hover { opacity: 0.9; }
.btn-generar:disabled { opacity: 0.6; cursor: not-allowed; }

.receta-card {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem; margin-bottom: 0.75rem; cursor: pointer; transition: border-color 0.2s;
}
.receta-card:hover { border-color: var(--accent); }
.receta-card h3 { font-family: 'Lora', serif; font-size: 1rem; }
.receta-card .meta { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.receta-card .stars { color: #f5a623; font-size: 0.9rem; margin-top: 0.25rem; }
.receta-card .acciones { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.receta-card .acciones button {
  font-size: 0.8rem; padding: 0.35rem 0.75rem;
  border-radius: 6px; border: none; cursor: pointer;
}
.btn-calificar { background: var(--accent2); color: white; }
.btn-eliminar { background: #eee; color: #333; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--surface); border-radius: var(--radius);
  padding: 2rem; max-width: 520px; width: 90%;
  max-height: 80vh; overflow-y: auto; position: relative;
}
.modal-content .close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted);
}
.modal-content h2 { font-family: 'Lora', serif; margin-bottom: 1rem; }
.modal-content h4 { margin: 1rem 0 0.5rem; color: var(--accent); }
.modal-content ol, .modal-content ul { padding-left: 1.2rem; font-size: 0.9rem; line-height: 1.8; }

.hidden { display: none !important; }
.error {
  background: #fff0f0; color: #cc0000;
  border: 1px solid #ffcccc; border-radius: 8px;
  padding: 0.75rem; font-size: 0.9rem;
}
.vacio { color: var(--muted); font-size: 0.9rem; font-style: italic; }