/* PandyPan — Mobile-first UI (inspiración apps de comida) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* ==================== Paleta ==================== */
:root{
  --bg: #fbfce7;        /* beige base */
  --text:#734f27;       /* café principal */
  --muted:#9a7a5b;      /* café desaturado */
  --accent:#accf78;     /* verde acento */
  --accent-press:#9ac46a;
  --card:#ffffff;       /* tarjetas claras */
  --border: rgba(115,79,39,0.18);
  --shadow: 0 6px 20px rgba(115,79,39,0.10);
  --radius:16px;
}

*{ box-sizing:border-box; }
html,body{
  margin:0; padding:0;
  background:var(--bg);
  color:var(--text);
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}
a{ color:inherit; text-decoration:none; }

/* ==================== Layout ==================== */
.container{ width:100%; max-width:1100px; margin:0 auto; padding:16px; }

/* Header sin gradientes */
.header{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px;
  position:sticky; top:0; z-index:10;
  background:#f6f7df; /* tono del beige un poco más oscuro para contraste */
  border-bottom:1px solid var(--border);
}
.header .brand{ display:flex; gap:10px; align-items:center; font-weight:600; letter-spacing:.2px; }
.header .brand .logo{
  width:28px; height:28px; border-radius:8px;
  background: var(--accent);
  box-shadow: 0 4px 10px rgba(172,207,120,0.45);
}
.header nav{ display:flex; gap:10px; overflow:auto; -webkit-overflow-scrolling:touch; }

/* ==================== Botones ==================== */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:12px 14px; border-radius:12px;
  border:1px solid var(--border);
  background: var(--accent);           /* sólido, sin gradiente */
  color:#2f2a22;                       /* café muy oscuro para buen contraste */
  font-weight:600; cursor:pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .25s ease, background .2s ease;
}
.btn:hover{ transform: translateY(-1px); box-shadow: 0 10px 24px rgba(115,79,39,0.16); background: var(--accent-press); }
.btn:active{ transform: translateY(0); }

.btn.ghost{
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--accent);
}
.btn.danger{
  background: #ffe5e5;
  border-color: #ffbcbc;
  color: #7a2b2b;
}

/* ==================== Cards ==================== */
.grid{ display:grid; gap:16px; }
.cards{ grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); }

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:14px;
  box-shadow: var(--shadow);
}
.card h3{ margin:.2rem 0 .6rem; font-size:1.06rem; }
.small{ color:var(--muted); font-size:.92rem; }

/* Sub-card (leudados) */
.card.sub{
  background: #fff;
  border:1px solid var(--border);
  border-radius: 16px;
  padding:14px;
}

/* ==================== Formularios ==================== */
.input, select, textarea{
  width:100%; padding:12px 12px; border-radius:12px;
  border:1px solid var(--border);
  background:#fff; color:var(--text);
  outline:none;
}
.input:focus, select:focus, textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(172,207,120,0.25);
}
label{ display:block; margin:10px 0 6px; font-weight:600; color:var(--text); }
.form-row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.form-row > *{ flex:1; min-width: 140px; }

/* ==================== KPIs ==================== */
.kpi{ display:flex; gap:10px; flex-wrap:wrap; }
.kpi .pill{
  padding:8px 10px; border-radius:999px;
  background:#ffffff;
  border:1px solid var(--border);
  font-size:.88rem; color:var(--muted);
}

/* ==================== Tablas ==================== */
.table{ width:100%; border-collapse: collapse; }
.table th,.table td{ padding:10px; border-bottom:1px solid var(--border); }
.table th{
  text-align:left; color:#5b3f26; background:#eef6dd; /* header con acento suave */
  font-weight:700;
}

/* ==================== Imágenes ==================== */
.card .thumb{ width:100%; height:160px; object-fit:cover; border-radius:12px; border:1px solid var(--border); background:#f2f2f2; }

.thumb.large{
  width:100%; height:auto; max-height:300px;
  object-fit:cover; border-radius:14px;
  box-shadow: 0 3px 14px rgba(115,79,39,0.18);
  transition: transform .25s ease;
}
.thumb.large:hover{ transform: scale(1.02); }

.thumb.xl{
  width:100%; max-height:340px;
  object-fit:cover; border-radius:14px;
  box-shadow: 0 3px 14px rgba(115,79,39,0.18);
  transition: transform .25s ease;
}
.thumb.xl:hover{ transform: scale(1.02); }

.thumb.placeholder{
  background: #f4f1ea;
  border-radius: 12px; height: 180px;
  display:flex; align-items:center; justify-content:center;
  font-size:.95em; color:#b09478; border:1px solid var(--border);
}

/* ==================== Uploader (botón cámara) ==================== */
.upload-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:56px; height:56px; border-radius:50%;
  background: var(--accent); color:#2f2a22;
  font-size:20px; cursor:pointer; transition:.2s;
  box-shadow: 0 3px 10px rgba(115,79,39,0.18);
  border:1px solid var(--border);
}
/* ✅ Estilo exclusivo para las fotos del resultado final */
.thumb-final {
  width: 100%;
  height: auto !important;
  max-width: 100%;
  aspect-ratio: 1 / 1;      /* cuadradas sin deformarse */
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(115,79,39,0.25);
  background: #fbfce7;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: block;
}

.upload-btn:hover{ transform: scale(1.06); background: var(--accent-press); }

/* Contenedores de fotos */
.photo-box{
  flex:1; min-width: 180px;
  display:flex; flex-direction:column; align-items:center; gap:8px;
}

/* ==================== Filtros / chips ==================== */
.filters{ display:flex; flex-wrap:wrap; gap:8px; margin: 10px 0 20px; }
.filter{
  padding:8px 12px; border:1px solid var(--accent);
  border-radius:999px; cursor:pointer; user-select:none;
  background:#fff; color:var(--text); font-weight:600;
}
.filter.active{
  background: var(--accent);
  color:#2f2a22;
  border-color: transparent;
}

/* ==================== Footer ==================== */
footer{
  padding:24px; text-align:center; color:var(--muted);
  border-top:1px solid var(--border); margin-top: 16px;
}

/* ==================== Estrellas ==================== */
.star{ font-size:1rem; color:#d6a25f; }

/* ==================== Timers ==================== */
.timer-box{
  margin-top:8px; padding:10px 12px; border:1px dashed var(--border);
  border-radius:12px; background:#fff;
}
.timer-display{ font-weight:700; color:#5b3f26; }

/* ==================== Responsive ==================== */
@media (max-width: 720px){
  .cards{ grid-template-columns: 1fr; }
  .header{ padding:10px 12px; }
  .container{ padding:12px; }
  .thumb.large{ max-height: 240px; }
  .thumb.xl{ max-height: 280px; }
  .kpi .pill{ font-size:.85rem; }
}

@media (max-width: 420px){
  .btn{ padding:10px 12px; }
  .upload-btn{ width:52px; height:52px; font-size:18px; }
  .thumb.large{ max-height: 220px; }
  .thumb.xl{ max-height: 240px; }
}

/* 🧩 Solución real — bloquear proporción vertical y forzar cuadrado */
.card .resultado-final {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) !important;
  gap: 14px !important;
  margin-top: 8px !important;
  align-items: start !important;
}

.card .resultado-final > div {
  position: relative !important;
  width: 100% !important;
  padding-top: 100% !important;   /* ✅ fuerza relación 1:1 (cuadrado) */
  overflow: hidden !important;
  border-radius: 14px !important;
  box-shadow: 0 3px 14px rgba(115,79,39,0.15) !important;
  border: 1px solid rgba(115,79,39,0.25) !important;
  background: #fff !important;
}

/* La imagen ocupa todo el cuadrado */
.card .resultado-final img.thumb-final {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 14px !important;
  transition: transform 0.25s ease, box-shadow 0.25s ease !important;
  cursor: pointer !important;
}

/* Hover igual que leudados */
.card .resultado-final img.thumb-final:hover {
  transform: scale(1.02) !important;
  box-shadow: 0 4px 16px rgba(115,79,39,0.25) !important;
}

/* Texto “Foto 1 / Foto 2” */
.card .resultado-final .small {
  position: absolute !important;
  top: 8px !important;
  left: 10px !important;
  background: rgba(255,255,255,0.8) !important;
  padding: 2px 6px !important;
  border-radius: 6px !important;
  font-size: 0.8rem !important;
  color: #5b3f26 !important;
  z-index: 2 !important;
}

/* En móvil, una debajo de otra */
@media (max-width: 720px) {
  .card .resultado-final {
    grid-template-columns: 1fr !important;
  }
}
.upload-btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:56px;
  height:56px;
  border-radius:50%;
  background: var(--accent);
  color:#2f2a22;
  font-size:20px;
  cursor:pointer;
  transition:.2s;
  box-shadow: 0 3px 10px rgba(115,79,39,0.18);
  border:1px solid var(--border);
}
.upload-btn:hover {
  transform: scale(1.06);
  background: var(--accent-press);
}
/* ===== Tablas responsivas (recipe_view, preparation_view, etc.) ===== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
}

.table-responsive table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px; /* asegura buena visual en pantallas grandes */
}

.table-responsive::-webkit-scrollbar {
  height: 8px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
}
.table-responsive::-webkit-scrollbar-track {
  background: transparent;
}
/* === Recipe View Layout === */
.recipe-view {
  max-width: 900px;
  margin: auto;
  font-family: 'Inter', sans-serif;
  color: #3c2a1e;
}

/* === Header Section === */
.recipe-header {
  text-align: center;
  margin-bottom: 30px;
}

.recipe-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.4em;
  margin-bottom: 25px;
  text-transform: capitalize;
}

.recipe-portion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 25px;
  font-size: 1.1em;
  color: #5c4a32;
}

.recipe-portion img {
  width: 38px;
  opacity: 0.9;
}

/* === Circles === */
.recipe-meta {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 45px;
  flex-wrap: wrap;
}

.recipe-circle.flat {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
}

.recipe-circle.flat .label {
  text-transform: uppercase;
  font-size: 0.75em;
  letter-spacing: 2px;
  color: #9c8b66;
  margin-bottom: 8px;
  font-weight: 500;
}

.recipe-circle.flat .circle-value {
  border: 2px solid #d1c7a0;
  border-radius: 50%;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1em;
  color: #3c2a1e;
  background: #fffdf7;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* === Steps & Table === */
.recipe-step {
  margin-bottom: 10px;
  line-height: 1.6;
}

/* === Responsive === */
@media (max-width: 768px) {
  .recipe-meta {
    flex-direction: column;
    gap: 25px;
  }
  .recipe-circle.flat {
    width: 100px;
  }
  .recipe-circle.flat .circle-value {
    width: 90px;
    height: 90px;
    font-size: 1em;
  }
  .recipe-title {
    font-size: 1.8em;
  }
}
/* === Recipe View Layout === */
.recipe-view {
  max-width: 900px;
  margin: auto;
  font-family: 'Inter', sans-serif;
  color: #3c2a1e;
}

/* === Header Section === */
.recipe-header {
  text-align: center;
  margin-bottom: 30px;
}

.recipe-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.4em;
  margin-bottom: 25px;
  text-transform: capitalize;
  color: #3c2a1e;
}

.recipe-portion {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 25px;
  font-size: 1.1em;
  color: #5c4a32;
}

.recipe-portion img {
  width: 38px;
  opacity: 0.9;
}

/* === Circles === */
.recipe-meta {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 45px;
  flex-wrap: wrap;
}

.recipe-circle.flat {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 120px;
}

.recipe-circle.flat .label {
  text-transform: uppercase;
  font-size: 0.75em;
  letter-spacing: 2px;
  color: #9c8b66;
  margin-bottom: 8px;
  font-weight: 500;
}

.recipe-circle.flat .circle-value {
  border: 2px solid #d1c7a0;
  border-radius: 50%;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.1em;
  color: #3c2a1e;
  background: #fffdf7;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* === Cost Section === */
.recipe-total-cost {
  text-align: right;
  margin-top: 10px;
  font-size: 1.1em;
  color: #3c2a1e;
}

.recipe-total-cost strong {
  font-weight: 600;
}

.recipe-total-cost span {
  background: #f9f7ef;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
  color: #5c4a32;
}

/* === Table & Steps === */
.table th:last-child,
.table td:last-child {
  text-align: right;
}

.recipe-step {
  margin-bottom: 10px;
  line-height: 1.6;
}

/* === Responsive === */
@media (max-width: 768px) {
  .recipe-meta {
    flex-direction: column;
    gap: 25px;
  }
  .recipe-circle.flat {
    width: 100px;
  }
  .recipe-circle.flat .circle-value {
    width: 90px;
    height: 90px;
    font-size: 1em;
  }
  .recipe-title {
    font-size: 1.8em;
  }
}
/* === Cost Summary === */
.recipe-cost-summary {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.cost-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f9f7ef;
  border: 1px solid #e0d7b8;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.95em;
  color: #4c3a1f;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.cost-box .icon {
  font-size: 1em;
}

.cost-box .label {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #7b6b4b;
}

.cost-box .value {
  font-weight: 600;
  color: #3c2a1e;
}

/* Align last column right */
.table th:last-child,
.table td:last-child {
  text-align: right;
}
.btn.danger {
  background: #f8d7da;
  border: 1px solid #f5c2c7;
  color: #842029;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.9em;
  transition: 0.2s ease;
}

.btn.danger:hover {
  background: #dc3545;
  color: #fff;
}
.recipes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input {
  flex: 1;
  max-width: 260px;
  border-radius: 10px;
  border: 1px solid #d8d8d8;
  padding: 8px 12px;
  font-size: 0.95em;
}

.btn.small {
  font-size: 0.9em;
  padding: 7px 14px;
  border-radius: 10px;
}

.btn.primary {
  background-color: #b7d97f;
  color: #3d2d12;
  border: none;
  transition: background 0.2s ease-in-out;
}

.btn.primary:hover {
  background-color: #a4c86a;
}

.table.recipes-table th {
  background: #f0f4e3;
  color: #4a3b1b;
}

.table.recipes-table td {
  vertical-align: middle;
  font-size: 0.95em;
}



/* ===========================================================
   Estilos de arrastre (drag & drop)
   =========================================================== */


.drag-ghost {
  opacity: 0.7;
  background: #fffaf0;
  border: 1px dashed #bbb;
}

.drag-chosen {
  opacity: 0.9;
  transform: scale(1.02);
}

.drag-active {
  opacity: 0.6;
}

.recipe-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 24px;
  margin-bottom: 24px;
}

.recipe-card h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: #333;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
}

.btn {
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}

.btn.primary {
  background: #accf78;
  color: #fff;
}

.btn.ghost {
  background: #f5f5f5;
  color: #444;
}

.btn.danger {
  background: #ffdddd;
  color: #b00;
}

.ingrediente-item {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.etapa {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.etapa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.drop-hint {
  background: #fafafa;
  border: 1px dashed #ccc;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  font-size: 0.9rem;
  color: #999;
  margin-top: 8px;
}

/* ============================================================
   🧩 FORMULARIO DE RECETAS — BLOQUE ÚNICO (para style.css)
   ============================================================ */

/* ====== CONTENEDOR GENERAL ====== */
body .recipe-form-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 40px;
}

/* ====== GRID: INGREDIENTES Y ETAPAS ====== */
body .recipe-form-container .ingredients-stages-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: flex-start;
}

@media (max-width: 992px) {
  body .recipe-form-container .ingredients-stages-wrapper {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ====== CARDS ====== */
body .recipe-form-container .ingredients-stages-wrapper > .card {
  width: 100%;
  overflow: hidden; /* evita desbordes */
  box-sizing: border-box;
}

/* ====== INGREDIENTES ====== */
body .recipe-form-container .form-row.ingrediente-item {
  display: grid;
  grid-template-columns: 26px 3.5fr 0.9fr auto; /* icono + ingrediente + cantidad + borrar */
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

/* Handle visible */
body .recipe-form-container .form-row.ingrediente-item .drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #999;
  cursor: grab;
  user-select: none;
  width: 26px;
  height: 34px;
  line-height: 1;
}
body .recipe-form-container .form-row.ingrediente-item .drag-handle::before {
  content: "⠿";
}
body .recipe-form-container .form-row.ingrediente-item .drag-handle:hover {
  color: #555;
}

/* Inputs */
body .recipe-form-container .ingrediente-item select.input {
  width: 100%;
  min-width: 270px;
  font-size: 0.95rem;
}
body .recipe-form-container .ingrediente-item input.input[type="number"] {
  min-width: 110px;
}

/* Botón borrar */
body .recipe-form-container .ingrediente-item .btn.small.danger {
  padding: 6px 10px;
  height: 34px;
  font-size: 0.9rem;
  align-self: end;
  min-width: 70px;
}

/* ====== ETAPAS ====== */
body .recipe-form-container .etapa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
body .recipe-form-container .etapa-header .btn.small.danger {
  padding: 6px 10px;
  height: 34px;
  font-size: 0.9rem;
  min-width: 70px;
}
body .recipe-form-container .etapa {
  overflow: hidden; /* evita desbordes internos */
}

/* ====== DRAG VISUAL FEEDBACK ====== */
body .recipe-form-container .drag-ghost {
  opacity: 0.7;
  background: #fff8e1;
  border: 1px dashed #dcbf6d;
}
body .recipe-form-container .drag-chosen {
  background: #fffdf5;
  border: 1px solid #e7d58f;
  transform: scale(1.02);
  transition: transform 0.15s ease;
}

/* ====== RESPONSIVE FINO ====== */
@media (max-width: 600px) {
  body .recipe-form-container .form-row.ingrediente-item {
    grid-template-columns: 18px 1fr 1fr auto;
  }
}
