@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;1,400&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary:        #2d6a4f;
  --primary-dark:   #1b4332;
  --primary-light:  #52b788;
  --accent:         #c9a84c;
  --text:           #1a1a2e;
  --text-muted:     #5a6472;
  --text-inverted:  #ffffff;
  --bg:             #f8f5f0;
  --bg-alt:         #edeae4;
  --card:           #ffffff;
  --card-border:    rgba(0,0,0,0.07);
  --input-bg:       #ffffff;
  --input-text:     #1a1a2e;
  --input-placeholder: #8a95a3;
  --input-border:   rgba(0,0,0,0.15);
  --input-focus:    #2d6a4f;
  --err:            #c0392b;
  --success:        #27ae60;
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.14);
  --shadow-xl:      0 20px 60px rgba(0,0,0,0.18);
  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --font-display:   'Playfair Display', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;
  --transition:     0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --spring:         0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
  --primary:        #52b788;
  --primary-dark:   #2d6a4f;
  --primary-light:  #74c69d;
  --accent:         #e9c46a;
  --text:           #e8e6e1;
  --text-muted:     #9fa8b0;
  --text-inverted:  #1a1a2e;
  --bg:             #111714;
  --bg-alt:         #191f1c;
  --card:           #1e2620;
  --card-border:    rgba(255,255,255,0.07);
  --input-bg:       #252d28;
  --input-text:     #e8e6e1;
  --input-placeholder: #6b7a72;
  --input-border:   rgba(255,255,255,0.14);
  --input-focus:    #52b788;
  --err:            #e57373;
  --success:        #66bb6a;
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.4);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.65);
  --shadow-xl:      0 20px 60px rgba(0,0,0,0.8);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
  line-height: 1.6;
  overflow-x: hidden;
}

/* grain overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9999; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

/* ── HEADER ── */
header {
  background: var(--primary-dark);
  color: var(--text-inverted);
  padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  flex-wrap: nowrap;
  box-shadow: var(--shadow-md);
  position: sticky; top: 0; z-index: 200; overflow: visible;
}
header::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.06) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: shimmer 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
header h1 {
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-inverted); position: relative;
}

.header-icon {
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
}
header:hover .header-icon {
  transform: rotate(360deg) scale(1.2);
}

.btn-round {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  width: 42px; height: 42px; border-radius: 50%; color: white; font-size: 1.2rem;
  cursor: pointer; display: grid; place-items: center;
  transition: background var(--transition), transform var(--spring);
}
.btn-round:hover { background: rgba(255,255,255,0.25); transform: scale(1.1) rotate(-5deg); }
.btn-round:active { transform: scale(0.95); }

/* Botón soporte técnico */
a.support-btn {
  text-decoration: none;
  position: relative;
}
a.support-btn i { color: white; font-size: 1.1rem; }
a.support-btn:hover { background: rgba(245,166,35,0.35); border-color: rgba(245,166,35,0.6); }
a.support-btn::after {
  display: none;
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid rgba(245,166,35,0.5);
  opacity: 0;
  transition: opacity .2s;
}
a.support-btn:hover::after { opacity: 1; }

/* ── CATEGORY FILTERS ── */
#category-filters {
  padding: 12px 16px; display: flex; gap: 8px; overflow-x: auto;
  background: var(--bg-alt); border-bottom: 1px solid var(--card-border);
  scrollbar-width: none;
  animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
#category-filters::-webkit-scrollbar { display: none; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.category-btn {
  padding: 7px 18px; border: 1.5px solid var(--input-border); border-radius: 999px;
  background: var(--card); color: var(--text-muted); cursor: pointer;
  white-space: nowrap; font-family: var(--font-body); font-size: 0.88rem; font-weight: 500;
  transition: all var(--transition);
}
.category-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.category-btn.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 4px 14px rgba(45,106,79,0.35); transform: translateY(-1px);
}

/* ── SEARCH BAR ── */
#search-bar {
  padding: 12px 16px; background: var(--bg-alt); border-bottom: 1px solid var(--card-border);
  animation: slideDown 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s both;
}
#search-input {
  width: 100%; padding: 11px 16px 11px 42px;
  border: 1.5px solid var(--input-border); border-radius: var(--radius-md);
  background: var(--input-bg); color: var(--input-text);
  font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a95a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}
#search-input:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.15), var(--shadow-sm);
}
#search-input::placeholder { color: var(--input-placeholder); }

/* ── RECIPES GRID ── */
#recipes-container { flex: 1; overflow-y: auto; padding: 20px 16px; background: var(--bg); }
#recipes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

.recipe-card {
  background: var(--card); border-radius: var(--radius-md); overflow: hidden;
  box-shadow: var(--shadow-sm); cursor: pointer; border: 1px solid var(--card-border);
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow var(--transition), border-color var(--transition);
  animation: cardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.recipe-card:nth-child(1)  { animation-delay: 0.05s; }
.recipe-card:nth-child(2)  { animation-delay: 0.10s; }
.recipe-card:nth-child(3)  { animation-delay: 0.15s; }
.recipe-card:nth-child(4)  { animation-delay: 0.20s; }
.recipe-card:nth-child(5)  { animation-delay: 0.25s; }
.recipe-card:nth-child(6)  { animation-delay: 0.30s; }
.recipe-card:nth-child(n+7){ animation-delay: 0.35s; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.recipe-card:hover { transform: translateY(-7px) scale(1.01); box-shadow: var(--shadow-xl); border-color: rgba(45,106,79,0.2); }
.recipe-card:active { transform: translateY(-3px) scale(0.99); }

.recipe-card .img-wrapper { overflow: hidden; height: 165px; position: relative; }
.recipe-card img { width: 100%; height: 165px; object-fit: cover; display: block; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.recipe-card:hover img { transform: scale(1.08); }

.difficulty-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: white; background: rgba(27,67,50,0.75); border: 1px solid rgba(255,255,255,0.15);
}

.recipe-info { padding: 14px 16px; }
.recipe-title {
  font-family: var(--font-display); font-size: 1.07rem; font-weight: 600;
  margin-bottom: 6px; color: var(--text); line-height: 1.3; transition: color var(--transition);
}
.recipe-card:hover .recipe-title { color: var(--primary); }
.recipe-meta { font-size: 0.82rem; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }

/* ── MODAL ── */
.modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.72); z-index: 1000;
  align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal[style*="flex"] { display: flex; animation: modalFadeIn 0.3s ease both; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  background: var(--card); width: 100%; max-width: 520px; max-height: 92vh;
  border-radius: var(--radius-lg); padding: 28px 24px; overflow-y: auto;
  box-shadow: var(--shadow-xl); border: 1px solid var(--card-border);
  scrollbar-width: thin; scrollbar-color: var(--primary) transparent;
  animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-content h2 {
  font-family: var(--font-display); font-size: 1.5rem; color: var(--text);
  margin-bottom: 20px; padding-bottom: 14px; border-bottom: 2px solid var(--primary);
}

/* ── FORM ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; margin-bottom: 7px; font-weight: 600; font-size: 0.88rem;
  color: var(--text); letter-spacing: 0.03em; text-transform: uppercase;
}
.form-group label small { text-transform: none; font-weight: 400; color: var(--text-muted); font-size: 0.82rem; letter-spacing: 0; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--input-border); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--input-text);
  font-family: var(--font-body); font-size: 0.95rem; line-height: 1.5;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition), transform 0.2s;
  -webkit-appearance: none; appearance: none;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--input-placeholder); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.15);
  transform: translateY(-1px);
}
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .form-group textarea:focus {
  box-shadow: 0 0 0 3px rgba(82,183,136,0.2);
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a95a3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer;
}
.form-group select option { background: var(--input-bg); color: var(--input-text); }
.form-group textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── BUTTONS ── */
.btn-group { display: flex; gap: 12px; margin-top: 22px; }
.btn {
  flex: 1; padding: 13px; border: none; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.95rem; cursor: pointer; font-family: var(--font-body);
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  position: relative; overflow: hidden;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(45,106,79,0.35); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 6px 20px rgba(45,106,79,0.5); transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--bg-alt); color: var(--text-muted); border: 1.5px solid var(--input-border); }
.btn-secondary:hover { color: var(--text); transform: translateY(-1px); }

/* ── DETAIL VIEW — slide from right ── */
.detail-view {
  display: none; flex-direction: column;
  position: fixed; inset: 0; z-index: 500;
  background: var(--bg);
  transform: translateX(100%);
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.detail-view.visible { display: flex; }
.detail-view.active  { transform: translateX(0); }

.detail-header {
  background: var(--primary-dark); color: #fff;
  padding: 14px 18px; position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  box-shadow: var(--shadow-md); overflow: hidden;
}
.detail-header::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.05) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: shimmer 6s ease-in-out infinite;
  pointer-events: none;
}

.back-btn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.2);
  width: 44px; height: 44px; border-radius: 50%; color: white; font-size: 1.3rem;
  cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
  transition: background var(--transition), transform var(--spring);
}
.back-btn:hover { background: rgba(255,255,255,0.25); transform: translateX(-4px) scale(1.08); }
.back-btn:active { transform: translateX(-2px) scale(0.95); }

.detail-title { flex: 1; font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; margin: 0; color: #fff; }

.action-btn {
  background: rgba(255,255,255,0.12); color: white;
  border: 1px solid rgba(255,255,255,0.2); padding: 8px 16px;
  border-radius: var(--radius-sm); cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  font-size: 0.88rem; font-family: var(--font-body); font-weight: 500;
  transition: all var(--transition);
}
.action-btn:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }
.action-btn:active { transform: translateY(0); }
.action-btn-danger { background: rgba(192,57,43,0.3) !important; border-color: rgba(192,57,43,0.4) !important; }
.action-btn-danger:hover { background: rgba(192,57,43,0.55) !important; }

.detail-content { padding: 24px 20px; overflow-y: auto; flex: 1; }

.section-title {
  font-family: var(--font-display); font-size: 1.2rem; font-weight: 600;
  color: var(--primary); margin: 28px 0 12px; padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
}

#detail-images { margin: 18px 0; border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-md); }
.glide__slide img { width: 100%; height: 260px; object-fit: cover; display: block; }

/* ── ANIMATED LISTS ── */
.ingredients-list, .steps-list { list-style: none; padding: 0; }
.ingredients-list li, .steps-list li {
  padding: 11px 0; border-bottom: 1px solid var(--card-border);
  color: var(--text); font-size: 0.97rem; display: flex; gap: 10px; align-items: flex-start;
  opacity: 0; transform: translateX(-10px);
  animation: listItemIn 0.4s ease forwards;
}
.ingredients-list li:nth-child(1), .steps-list li:nth-child(1) { animation-delay: 0.05s; }
.ingredients-list li:nth-child(2), .steps-list li:nth-child(2) { animation-delay: 0.10s; }
.ingredients-list li:nth-child(3), .steps-list li:nth-child(3) { animation-delay: 0.15s; }
.ingredients-list li:nth-child(4), .steps-list li:nth-child(4) { animation-delay: 0.20s; }
.ingredients-list li:nth-child(5), .steps-list li:nth-child(5) { animation-delay: 0.25s; }
.ingredients-list li:nth-child(n+6), .steps-list li:nth-child(n+6) { animation-delay: 0.30s; }
@keyframes listItemIn { to { opacity: 1; transform: translateX(0); } }

.ingredients-list li::before {
  content: '•'; color: var(--primary); font-size: 1.2rem; line-height: 1.3;
  flex-shrink: 0; transition: transform var(--spring);
}
.ingredients-list li:hover::before { transform: scale(1.6); }

.steps-list { counter-reset: steps; }
.steps-list li { counter-increment: steps; }
.steps-list li::before {
  content: counter(steps); background: var(--primary); color: #fff;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0; margin-top: 2px;
  transition: transform var(--spring), background var(--transition);
}
.steps-list li:hover::before { transform: scale(1.2); background: var(--accent); }

/* ── FAB ── */
.fab-btn {
  position: fixed; bottom: 26px; right: 26px;
  width: 58px; height: 58px; font-size: 1.6rem;
  background: var(--primary); color: white; z-index: 900;
  border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 5px 18px rgba(45,106,79,0.5);
  transition: transform var(--spring), box-shadow var(--transition);
  animation: fabPulse 3s ease-in-out infinite;
}
.fab-btn:hover {
  transform: scale(1.15) rotate(12deg);
  box-shadow: 0 10px 28px rgba(45,106,79,0.65);
  animation: none;
}
.fab-btn:active { transform: scale(0.92); }
@keyframes fabPulse {
  0%, 100% { box-shadow: 0 5px 18px rgba(45,106,79,0.5), 0 0 0 0 rgba(45,106,79,0.4); }
  50%       { box-shadow: 0 5px 18px rgba(45,106,79,0.5), 0 0 0 10px rgba(45,106,79,0); }
}

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--err); color: white; padding: 13px 26px;
  border-radius: var(--radius-sm); z-index: 2000; opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  font-weight: 500; font-size: 0.95rem; box-shadow: var(--shadow-lg);
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.success { background: var(--success); }

/* ── CONFIRM ── */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.72);
  z-index: 1500; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); animation: modalFadeIn 0.2s ease both;
}
.confirm-modal {
  background: var(--card); padding: 28px; border-radius: var(--radius-lg);
  max-width: 340px; text-align: center; box-shadow: var(--shadow-xl);
  border: 1px solid var(--card-border); color: var(--text);
  animation: modalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.confirm-modal p { margin: 10px 0 0; color: var(--text-muted); }
.confirm-buttons { display: flex; gap: 12px; margin-top: 22px; }
.confirm-buttons button {
  flex: 1; padding: 12px; border: none; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; font-family: var(--font-body); font-size: 0.95rem;
  transition: all var(--transition);
}
.btn-cancel { background: var(--bg-alt); color: var(--text-muted); border: 1.5px solid var(--input-border); }
.btn-cancel:hover { color: var(--text); transform: translateY(-1px); }
.btn-confirm { background: var(--err); color: white; box-shadow: 0 3px 10px rgba(192,57,43,0.35); }
.btn-confirm:hover { filter: brightness(1.1); transform: translateY(-1px); }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--input-border); border-radius: var(--radius-md);
  background: var(--input-bg); transition: all var(--transition); overflow: hidden; margin-top: 8px;
}
.upload-zone.drag-over {
  border-color: var(--primary); background: rgba(45,106,79,0.06);
  transform: scale(1.01); box-shadow: 0 0 0 4px rgba(45,106,79,0.1);
}
.upload-zone-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px; cursor: pointer; transition: background var(--transition); }
.upload-zone-inner:hover { background: rgba(45,106,79,0.04); }
.upload-icon { font-size: 2rem; color: var(--primary); opacity: 0.75; transition: transform var(--spring), opacity var(--transition); }
.upload-zone-inner:hover .upload-icon { transform: translateY(-4px) scale(1.1); opacity: 1; }
.upload-zone.drag-over .upload-icon { transform: translateY(-6px) scale(1.2); opacity: 1; animation: bounce 0.5s ease infinite alternate; }
@keyframes bounce { to { transform: translateY(-10px) scale(1.2); } }
.upload-zone-inner p { font-size: 0.9rem; color: var(--input-text); text-align: center; }
.upload-link { color: var(--primary); font-weight: 600; text-decoration: underline; }
.upload-zone-inner small { font-size: 0.78rem; color: var(--text-muted); }
.upload-progress { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: rgba(0,0,0,0.05); }
[data-theme="dark"] .upload-progress { background: rgba(255,255,255,0.04); }
.upload-bar { flex: 1; height: 5px; background: var(--primary); border-radius: 3px; transition: width 0.15s; }
#upload-status { font-size: 0.82rem; color: var(--text-muted); white-space: nowrap; }

.images-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; min-height: 0; }
.img-thumb-wrap {
  position: relative; width: 82px; height: 82px; border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 2px solid transparent;
  transition: border-color var(--transition), transform var(--spring), box-shadow var(--transition);
  animation: thumbIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes thumbIn {
  from { opacity: 0; transform: scale(0.7) rotate(-5deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}
.img-thumb-wrap:first-child { border-color: var(--primary); }
.img-thumb-wrap:hover { transform: scale(1.06); box-shadow: var(--shadow-md); }
.img-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.img-thumb-wrap:hover img { transform: scale(1.08); }
.img-remove-btn {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  background: rgba(0,0,0,0.65); color: white; border: none; border-radius: 50%;
  font-size: 14px; line-height: 1; cursor: pointer; display: flex;
  align-items: center; justify-content: center; padding: 0;
  transition: all var(--transition); opacity: 0; transform: scale(0.7);
}
.img-thumb-wrap:hover .img-remove-btn { opacity: 1; transform: scale(1); }
.img-remove-btn:hover { background: var(--err); transform: scale(1.15) !important; }
.img-badge-main {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(45,106,79,0.88); color: white; font-size: 9px;
  text-align: center; padding: 2px; font-weight: 600; text-transform: uppercase;
}

.url-section { margin-top: 10px; font-size: 0.87rem; color: var(--text-muted); }
.url-section summary { cursor: pointer; padding: 5px 0; color: var(--text-muted); user-select: none; transition: color var(--transition); }
.url-section summary:hover { color: var(--primary); }
.url-input-row { display: flex; gap: 8px; margin-top: 8px; }
.url-input-row input { flex: 1; }
.btn-sm { padding: 8px 14px !important; font-size: 0.85rem !important; white-space: nowrap; flex: none !important; }

/* ── DETAIL META ── */
#detail-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
#detail-meta span {
  background: var(--bg-alt); color: var(--text-muted);
  padding: 5px 12px; border-radius: 999px;
  font-size: 0.84rem; font-weight: 500; border: 1px solid var(--card-border);
  opacity: 0;
  animation: pillIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
#detail-meta span:nth-child(1) { animation-delay: 0.10s; }
#detail-meta span:nth-child(2) { animation-delay: 0.18s; }
#detail-meta span:nth-child(3) { animation-delay: 0.26s; }
#detail-meta span:nth-child(4) { animation-delay: 0.34s; }
@keyframes pillIn {
  from { opacity: 0; transform: translateY(8px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── EMPTY STATE ── */
.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 4rem 2rem; color: var(--text-muted);
  animation: fadeIn 0.5s ease both;
}
.empty-state .empty-icon {
  font-size: 3.5rem; display: block; margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  #recipes-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .recipe-card img, .recipe-card .img-wrapper { height: 120px; }
}

/* ══════════════════════════════════════════════
   MEJORAS VISUAL / UI
   ══════════════════════════════════════════════ */

/* ── TOGGLE VISTA (grid / lista) ── */
#search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
#search-input { flex: 1; }

.btn-view-toggle {
  flex-shrink: 0;
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all var(--transition);
}
.btn-view-toggle:hover { border-color: var(--primary); color: var(--primary); transform: scale(1.08); }
.btn-view-toggle.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── MODO LISTA ── */
#recipes-grid.list-view {
  grid-template-columns: 1fr;
  gap: 10px;
}
#recipes-grid.list-view .recipe-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 90px;
}
#recipes-grid.list-view .recipe-card .img-wrapper {
  width: 110px;
  height: 90px;
  flex-shrink: 0;
  border-radius: 0;
}
#recipes-grid.list-view .recipe-card img {
  height: 90px;
  border-radius: 0;
}
#recipes-grid.list-view .recipe-card .img-wrapper { border-radius: var(--radius-md) 0 0 var(--radius-md); }
#recipes-grid.list-view .recipe-card .difficulty-badge { top: 6px; right: 6px; font-size: 0.65rem; padding: 2px 7px; }
#recipes-grid.list-view .recipe-info {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
#recipes-grid.list-view .recipe-title {
  font-size: 0.97rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0;
}
#recipes-grid.list-view .recipe-card:hover { transform: translateX(4px); }

/* ── ANIMACIÓN DE BORRADO ── */
.recipe-card.removing {
  animation: cardRemove 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
  pointer-events: none;
}
@keyframes cardRemove {
  0%   { opacity: 1; transform: scale(1); max-height: 400px; margin-bottom: 18px; }
  40%  { opacity: 0; transform: scale(0.85) translateY(10px); }
  100% { opacity: 0; transform: scale(0.85); max-height: 0; margin-bottom: 0; padding: 0; }
}

/* ── MODO MAGAZINE (imagen con gradiente y título encima) ── */
#recipes-grid.magazine-view {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
#recipes-grid.magazine-view .recipe-card .img-wrapper {
  height: 220px;
  position: relative;
}
#recipes-grid.magazine-view .recipe-card .img-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,20,15,0.88) 0%, rgba(10,20,15,0.3) 50%, transparent 100%);
  pointer-events: none;
}
#recipes-grid.magazine-view .recipe-info {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 16px;
  z-index: 2;
}
#recipes-grid.magazine-view .recipe-card {
  position: relative;
  overflow: hidden;
}
#recipes-grid.magazine-view .recipe-title {
  color: #fff !important;
  font-size: 1.15rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
#recipes-grid.magazine-view .recipe-meta {
  color: rgba(255,255,255,0.75);
}
#recipes-grid.magazine-view .recipe-card:hover .recipe-title { color: var(--accent) !important; }

@media (max-width: 480px) {
  #recipes-grid.list-view .recipe-card .img-wrapper,
  #recipes-grid.list-view .recipe-card img { width: 90px; height: 90px; }
}

/* ══════════════════════════════════════════════
   FUNCIONALIDAD
   ══════════════════════════════════════════════ */

/* ── ESTRELLAS DE VALORACIÓN ── */
.detail-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 6px;
  animation: pillIn 0.4s var(--spring) both;
}
.star {
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--bg-alt);
  filter: grayscale(1);
  transition: transform var(--spring), filter var(--transition), color var(--transition);
  line-height: 1;
  user-select: none;
}
.star:hover,
.star.hovered { transform: scale(1.3) rotate(-5deg); filter: grayscale(0); color: var(--accent); }
.star.active  { filter: grayscale(0); color: var(--accent); transform: scale(1.1); }
.rating-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: 6px;
}

/* ── FAVORITO ── */
#fav-btn { transition: all var(--transition); }
#fav-btn.is-fav {
  background: rgba(192, 57, 43, 0.25) !important;
  border-color: rgba(220, 80, 60, 0.4) !important;
  color: #ff6b6b !important;
}
#fav-btn.is-fav i { animation: heartPop 0.4s var(--spring); }
@keyframes heartPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* badge de favorito en la tarjeta */
.fav-badge {
  position: absolute;
  top: 10px; left: 10px;
  width: 28px; height: 28px;
  background: rgba(192,57,43,0.8);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.2);
  animation: heartPop 0.4s var(--spring);
}

/* ── ESCALADOR DE PORCIONES ── */
.portion-scaler {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin: 16px 0 4px;
  width: fit-content;
  animation: pillIn 0.4s var(--spring) 0.1s both;
  opacity: 0;
}
.scaler-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}
.scaler-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--input-border);
  background: var(--card);
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all var(--spring);
  line-height: 1;
}
.scaler-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(1.12); }
.scaler-btn:active { transform: scale(0.92); }
#scaler-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 28px;
  text-align: center;
  transition: transform var(--spring);
}
#scaler-value.bump { animation: scaleBump 0.3s var(--spring); }
@keyframes scaleBump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* ingrediente escalado */
.ing-amount {
  font-weight: 600;
  color: var(--primary);
  transition: color var(--transition);
}
.ing-amount.changed { animation: amountFlash 0.4s ease; }
@keyframes amountFlash {
  0%, 100% { color: var(--primary); }
  50%       { color: var(--accent); }
}

/* ── TEMPORIZADOR EN PASOS ── */
.step-timer-btn {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 3px 9px;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  transition: all var(--transition);
  white-space: nowrap;
}
.step-timer-btn:hover { border-color: var(--primary); color: var(--primary); }
.step-timer-btn.running {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  animation: timerPulse 1s ease-in-out infinite;
}
.step-timer-btn.done {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* ── IMPRIMIR ── */
@media print {
  header, #category-filters, #search-bar, #add-btn,
  #edit-recipe-btn, #delete-recipe-btn, #fav-btn, #print-btn,
  .back-btn, .portion-scaler, .step-timer-btn, .glide__bullets,
  body::before { display: none !important; }

  body, #detail-view, .detail-content {
    background: white !important;
    color: black !important;
    height: auto !important;
    overflow: visible !important;
    position: static !important;
    transform: none !important;
  }
  #detail-view {
    display: flex !important;
    flex-direction: column;
  }
  .detail-header {
    background: #1b4332 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    padding: 12px 18px;
  }
  .glide__slide img { height: 200px; }
  .section-title { color: #1b4332 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .steps-list li::before { background: #1b4332 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #detail-rating .star.active { color: #c9a84c !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ══════════════════════════════════════════════
   BÚSQUEDA Y ORGANIZACIÓN
   ══════════════════════════════════════════════ */

/* ── FILTROS AVANZADOS ── */
.advanced-filters {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--card-border);
  padding: 12px 16px;
  overflow: hidden;
  max-height: 200px;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s ease,
              padding 0.3s ease;
  opacity: 1;
}
.advanced-filters.hidden {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.filter-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.filter-group label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--input-border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(45,106,79,0.3);
  transform: translateY(-1px);
}
.chip:active { transform: translateY(0) scale(0.96); }

.btn-clear-filters {
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 4px 0;
  transition: color var(--transition);
}
.btn-clear-filters:hover { color: var(--err); }

/* botón filtros activo */
#filter-toggle.has-filters {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* badge contador de filtros activos */
#filter-toggle { position: relative; }
#filter-toggle .filter-count {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--accent);
  color: #1a1a2e;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  animation: heartPop 0.3s var(--spring);
}

/* resultado contador */
#results-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 6px 16px 0;
  transition: opacity 0.2s;
}

@media (max-width: 480px) {
  .filter-row { gap: 12px; }
  .advanced-filters { max-height: 280px; }
}

/* ══════════════════════════════════════════════
   PWA: OFFLINE + COMPARTIR
   ══════════════════════════════════════════════ */

/* ── BANNER OFFLINE ── */
.offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: #c0392b;
  color: white;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.offline-banner.visible {
  transform: translateY(0);
}
.offline-banner.hidden {
  display: none;
}

/* empujar el header cuando hay banner */
body.is-offline header {
  top: 42px;
}

/* ── MODAL COMPARTIR ── */
.share-modal-content {
  max-width: 480px !important;
}
.share-modal-content h2 {
  margin-bottom: 16px;
}

.share-preview {
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 320px;
  overflow-y: auto;
  font-family: var(--font-body);
  margin-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.share-preview strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--primary);
  display: block;
  margin-bottom: 8px;
}

/* ══════════════════════════════════════════════
   MEJORAS DE APARIENCIA GENERAL
   ══════════════════════════════════════════════ */

/* ── FIX FAB: el + nunca desaparece ── */
.fab-btn {
  color: #ffffff !important;
  line-height: 1;
  font-size: 1.8rem !important;
  font-weight: 300;
  letter-spacing: 0;
}
.fab-btn:hover  { color: #ffffff !important; }
.fab-btn:active { color: #ffffff !important; }

/* FAB con gradiente y tooltip */
.fab-btn {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark)) !important;
}
.fab-btn::before {
  content: 'Nueva receta';
  position: absolute;
  right: 68px;
  bottom: 50%;
  transform: translateY(50%) translateX(8px);
  background: var(--primary-dark);
  color: white;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.3s var(--spring);
  font-family: var(--font-body);
}
.fab-btn:hover::before {
  opacity: 1;
  transform: translateY(50%) translateX(0);
}

/* ── HEADER mejorado: subtítulo + gradiente ── */
header {
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 60%, #1b4332 100%) !important;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* ── TARJETAS: aspecto más rico ── */
.recipe-card {
  border-radius: var(--radius-lg) !important;
}
.recipe-card .img-wrapper {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}
.recipe-card .recipe-info {
  border-top: 1px solid var(--card-border);
}

/* degradado sutil en la parte inferior de la imagen en modo normal */
.recipe-card .img-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 50px;
  background: linear-gradient(to top, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
}

/* ── BARRA DE CATEGORÍAS mejorada ── */
#category-filters {
  padding: 10px 16px 10px;
  gap: 7px;
}
.category-btn {
  font-size: 0.84rem;
  padding: 6px 16px;
  letter-spacing: 0.01em;
}

/* ── BUSCADOR mejorado ── */
#search-input {
  border-radius: var(--radius-lg) !important;
  padding-left: 44px;
  font-size: 0.93rem;
}

/* ── MODAL: header con acento de color ── */
.modal-content h2 {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  border-bottom-color: var(--primary-light);
}

/* ── SECTION TITLE con icono decorativo ── */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--primary-light), transparent);
  margin-left: 4px;
}

/* ── DETAIL HEADER: más aire ── */
.detail-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%) !important;
}

/* ── INGREDIENTES: fondo alternado para facilitar lectura ── */
.ingredients-list li:nth-child(even) {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding-left: 8px;
  padding-right: 8px;
}

/* ── PASOS: línea conectora vertical ── */
.steps-list {
  position: relative;
  padding-left: 4px;
}
.steps-list li {
  position: relative;
  padding-left: 8px;
}

/* ── CHIPS de filtros: más redondos y coloridos ── */
.chip.active[data-diff="fácil"]   { background: #27ae60; border-color: #27ae60; }
.chip.active[data-diff="medio"]   { background: #e67e22; border-color: #e67e22; }
.chip.active[data-diff="difícil"] { background: #c0392b; border-color: #c0392b; }
.chip.active[data-time]           { background: var(--primary); border-color: var(--primary); }

/* ── EMPTY STATE mejorado ── */
.empty-state p {
  font-size: 1rem;
  line-height: 1.6;
  max-width: 260px;
  margin: 0 auto;
}

/* ── SCROLLBAR más fina y elegante ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 2px; }

/* ── MODO CLARO: fondo con textura sutil ── */
body:not([data-theme="dark"]) #recipes-container {
  background-image: radial-gradient(circle at 20% 50%, rgba(45,106,79,0.03) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(201,168,76,0.04) 0%, transparent 40%);
}

/* ── DARK MODE: cards con borde luminoso sutil ── */
[data-theme="dark"] .recipe-card:hover {
  border-color: rgba(82,183,136,0.25);
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(82,183,136,0.15);
}

/* ── BOTONES de acción en detalle: más compactos ── */
@media (max-width: 600px) {
  .action-btn span { display: none; }
  #edit-recipe-btn .fas, #delete-recipe-btn .fas { margin: 0; }
  .detail-header { gap: 8px; }
}

/* ══════════════════════════════════════════════
   SPLASH SCREEN
   ══════════════════════════════════════════════ */
.splash-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(145deg, #1b4332 0%, #2d6a4f 50%, #1b4332 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.splash-screen.fade-out {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}
.splash-screen.gone { display: none; }

.splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: splashIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes splashIn {
  from { opacity: 0; transform: translateY(30px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.splash-pan {
  font-size: 5rem;
  line-height: 1;
  animation: panWobble 1.2s ease-in-out infinite;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
}
@keyframes panWobble {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  25%       { transform: rotate(8deg) scale(1.05); }
  50%       { transform: rotate(-4deg) scale(1); }
  75%       { transform: rotate(6deg) scale(1.02); }
}

.splash-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 16px rgba(0,0,0,0.3);
  margin: 0;
}

.splash-sub {
  font-family: var(--font-body);
  font-size: 1rem;
  color: rgba(255,255,255,0.65);
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 300;
}

.splash-loader {
  width: 160px;
  height: 3px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  margin-top: 10px;
  overflow: hidden;
}
.splash-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light), var(--accent));
  border-radius: 999px;
  width: 0%;
  animation: splashLoad 1.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes splashLoad {
  0%   { width: 0%; }
  60%  { width: 75%; }
  100% { width: 100%; }
}

/* ── CONFETTI ── */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  z-index: 99998;
  pointer-events: none;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ══════════════════════════════════════════════
   CALCULADORA DE CALORÍAS
   ══════════════════════════════════════════════ */
.calorie-display {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(201,168,76,0.06));
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin: 10px 0 16px;
  animation: pillIn 0.4s var(--spring) both;
}
[data-theme="dark"] .calorie-display {
  background: linear-gradient(135deg, rgba(233,196,106,0.1), rgba(233,196,106,0.05));
  border-color: rgba(233,196,106,0.25);
}
.calorie-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.calorie-info {
  flex: 1;
}
.calorie-main {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.calorie-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.calorie-total {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: right;
  border-left: 1px solid var(--card-border);
  padding-left: 14px;
}
.calorie-total strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
}

/* ══════════════════════════════════════════════
   COLORES POR CATEGORÍA
   ══════════════════════════════════════════════ */

/* Chips de categoría con color propio */
.category-btn[data-cat="Entrantes"]   { --cat-color: #e67e22; }
.category-btn[data-cat="Principales"] { --cat-color: #c0392b; }
.category-btn[data-cat="Postres"]     { --cat-color: #8e44ad; }
.category-btn[data-cat="Guarniciones"]{ --cat-color: #27ae60; }
.category-btn[data-cat="Salsas"]      { --cat-color: #d35400; }
.category-btn[data-cat="Bebidas"]     { --cat-color: #2980b9; }
.category-btn[data-cat="Otros"]       { --cat-color: #7f8c8d; }

.category-btn[data-cat]:hover {
  border-color: var(--cat-color);
  color: var(--cat-color);
}
.category-btn[data-cat].active {
  background: var(--cat-color);
  border-color: var(--cat-color);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--cat-color) 40%, transparent);
}

/* Badge de categoría en tarjetas */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: white;
  margin-bottom: 4px;
}

/* Franja de color en el borde superior de la tarjeta */
.recipe-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cat-stripe, var(--primary-light));
  z-index: 2;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: height var(--transition);
}
.recipe-card:hover::before { height: 5px; }

/* Colores por categoría en tarjetas */
.recipe-card[data-cat="Entrantes"]    { --cat-stripe: #e67e22; --cat-bg: rgba(230,126,34,0.12); --cat-color: #e67e22; }
.recipe-card[data-cat="Principales"] { --cat-stripe: #c0392b; --cat-bg: rgba(192,57,43,0.12);  --cat-color: #c0392b; }
.recipe-card[data-cat="Postres"]     { --cat-stripe: #8e44ad; --cat-bg: rgba(142,68,173,0.12); --cat-color: #8e44ad; }
.recipe-card[data-cat="Guarniciones"]{ --cat-stripe: #27ae60; --cat-bg: rgba(39,174,96,0.12);  --cat-color: #27ae60; }
.recipe-card[data-cat="Salsas"]      { --cat-stripe: #d35400; --cat-bg: rgba(211,84,0,0.12);   --cat-color: #d35400; }
.recipe-card[data-cat="Bebidas"]     { --cat-stripe: #2980b9; --cat-bg: rgba(41,128,185,0.12); --cat-color: #2980b9; }
.recipe-card[data-cat="Otros"]       { --cat-stripe: #7f8c8d; --cat-bg: rgba(127,140,141,0.12);--cat-color: #7f8c8d; }

.recipe-card .cat-badge { background: var(--cat-color, var(--primary)); }

/* En modo lista el badge queda bien a la derecha */
#recipes-grid.list-view .cat-badge {
  position: absolute;
  top: 8px; right: 8px;
  margin: 0;
}

/* ══════════════════════════════════════════════
   EXPORTAR COMO IMAGEN
   ══════════════════════════════════════════════ */
.export-modal-content {
  max-width: 560px !important;
}
.export-preview-wrap {
  position: relative;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#export-canvas {
  max-width: 100%;
  border-radius: var(--radius-md);
  display: block;
  box-shadow: var(--shadow-md);
}
.export-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg-alt);
}
.export-loading span {
  font-size: 2.5rem;
  animation: panWobble 1s ease-in-out infinite;
}
.export-loading.hidden { display: none; }

/* ══════════════════════════════════════════════
   EXPORTAR COMO IMAGEN
   ══════════════════════════════════════════════ */
.export-modal-content {
  max-width: 560px !important;
}
.export-preview-wrap {
  display: flex;
  justify-content: center;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  overflow: hidden;
}
#export-canvas {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 100%;
  height: auto;
}
.export-options {
  margin-bottom: 14px;
}
.export-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.export-style-btns {
  display: flex;
  gap: 8px;
}
.export-style {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--input-border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.export-style:hover  { border-color: var(--primary); color: var(--primary); }
.export-style.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ══════════════════════════════════════════════
   PLANIFICADOR SEMANAL
   ══════════════════════════════════════════════ */
.planner-modal-overlay { align-items: flex-start !important; padding-top: 20px !important; }

.planner-modal-content {
  max-width: 900px !important;
  width: 100% !important;
  max-height: 90vh !important;
}

.planner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.planner-header h2 {
  border-bottom: none !important;
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  background: none !important;
  -webkit-text-fill-color: var(--text) !important;
}

.planner-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Grid de días */
.planner-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.planner-day {
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  border: 2px solid var(--card-border);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), background var(--transition);
  overflow: hidden;
}
.planner-day.drag-over {
  border-color: var(--primary);
  background: rgba(45,106,79,0.08);
}
.planner-day.today {
  border-color: var(--accent);
}

.planner-day-header {
  background: var(--primary-dark);
  color: white;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  position: relative;
}
.planner-day.today .planner-day-header {
  background: var(--accent);
  color: #1a1a2e;
}
.planner-day-name { display: block; font-size: 0.72rem; }
.planner-day-date { display: block; font-size: 0.88rem; font-weight: 700; }

.planner-day-body {
  flex: 1;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  max-height: 200px;
  scrollbar-width: thin;
}

/* Receta en el planificador */
.planner-recipe-item {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: grab;
  border-left: 3px solid var(--primary);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  animation: thumbIn 0.3s var(--spring) both;
  position: relative;
}
.planner-recipe-item:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.planner-recipe-item:active { cursor: grabbing; }
.planner-recipe-item .planner-remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--transition), color var(--transition);
  flex-shrink: 0;
}
.planner-recipe-item:hover .planner-remove { opacity: 1; }
.planner-recipe-item .planner-remove:hover { color: var(--err); }

/* Botón añadir receta al día */
.planner-add-btn {
  background: none;
  border: 1.5px dashed var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.1rem;
  width: 100%;
  padding: 4px;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: auto;
}
.planner-add-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(45,106,79,0.05); }

/* Acciones del planificador */
.planner-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Picker de recetas */
.planner-picker-content {
  max-width: 420px !important;
  max-height: 80vh !important;
}
.planner-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--input-text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  margin-bottom: 10px;
  transition: border-color var(--transition);
}
.planner-search-input:focus { outline: none; border-color: var(--primary); }

.planner-recipe-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 52vh;
  overflow-y: auto;
  scrollbar-width: thin;
}
.planner-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all var(--transition);
  font-size: 0.88rem;
  font-weight: 500;
}
.planner-picker-item:hover { border-color: var(--primary); background: var(--card); color: var(--primary); }
.planner-picker-item img {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.planner-picker-meta { font-size: 0.75rem; color: var(--text-muted); }

/* Print planificador */
@media print {
  .planner-modal-overlay { display: flex !important; position: static !important; background: none !important; }
  .planner-modal-content { box-shadow: none !important; max-height: none !important; }
  .planner-actions, #planner-close-btn, .planner-remove, .planner-add-btn { display: none !important; }
}

@media (max-width: 700px) {
  .planner-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
  .planner-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════
   ESCANDALLO
   ══════════════════════════════════════════════ */

#escandallo-btn {
  background: linear-gradient(135deg, rgba(201,168,76,0.25), rgba(201,168,76,0.1)) !important;
  border-color: rgba(201,168,76,0.4) !important;
  color: var(--accent) !important;
  font-weight: 600;
}
#escandallo-btn:hover {
  background: linear-gradient(135deg, rgba(201,168,76,0.4), rgba(201,168,76,0.2)) !important;
}

.escandallo-overlay { align-items: flex-start !important; padding-top: 16px !important; }

.escandallo-content {
  max-width: 860px !important;
  width: 100% !important;
  max-height: 92vh !important;
  padding: 24px !important;
}

.escandallo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}
.escandallo-header h2 {
  border-bottom: none !important;
  margin-bottom: 4px !important;
  padding-bottom: 0 !important;
  font-size: 1.3rem !important;
  background: linear-gradient(135deg, var(--accent), #e67e22) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}
.escandallo-recipe-name {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* Config row */
.escandallo-config {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--card-border);
}
.escandallo-config-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 110px;
  flex: 1;
}
.escandallo-config-item label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.escandallo-config-item input,
.escandallo-config-item select {
  padding: 8px 10px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--input-text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}
.escandallo-config-item input:focus,
.escandallo-config-item select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Tabla */
.escandallo-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.escandallo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  font-family: var(--font-body);
}
.escandallo-table thead {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
}
.escandallo-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.escandallo-table tbody tr {
  border-bottom: 1px solid var(--card-border);
  transition: background var(--transition);
}
.escandallo-table tbody tr:nth-child(even) {
  background: var(--bg-alt);
}
.escandallo-table tbody tr:hover {
  background: rgba(45,106,79,0.06);
}
.escandallo-table td {
  padding: 8px 12px;
  vertical-align: middle;
}
.escandallo-table td:first-child {
  font-weight: 500;
  color: var(--text);
  max-width: 180px;
}

/* Inputs dentro de la tabla */
.esc-input {
  width: 80px;
  padding: 5px 8px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--input-text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  text-align: right;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.esc-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.2);
}
.esc-input.qty  { width: 70px; }
.esc-input.price { width: 80px; }
.esc-input.merma { width: 60px; }

/* Select de unidad */
.esc-unit-select {
  padding: 5px 6px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--input-text);
  font-family: var(--font-body);
  font-size: 0.82rem;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
}
.esc-unit-select:focus { outline: none; border-color: var(--accent); }

/* Celda de coste */
.esc-coste-cell {
  font-weight: 700;
  color: var(--primary);
  text-align: right;
  white-space: nowrap;
  min-width: 80px;
}
.esc-coste-cell.zero { color: var(--text-muted); font-weight: 400; }

/* Fila total */
.escandallo-total-row {
  background: linear-gradient(135deg, rgba(45,106,79,0.08), rgba(45,106,79,0.04)) !important;
  border-top: 2px solid var(--primary-light) !important;
}
.escandallo-total-row td {
  padding: 12px !important;
  font-size: 0.95rem;
}

/* Resumen económico */
.escandallo-resumen {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.esc-resumen-card {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--card-border);
  transition: transform var(--spring), box-shadow var(--transition);
}
.esc-resumen-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.esc-resumen-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.esc-resumen-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}
.esc-coste    { background: rgba(45,106,79,0.08);  border-color: rgba(45,106,79,0.2);  }
.esc-coste    .esc-resumen-value { color: var(--primary); }
.esc-pvp      { background: rgba(201,168,76,0.08); border-color: rgba(201,168,76,0.2); }
.esc-pvp      .esc-resumen-value { color: var(--accent); }
.esc-pvp-iva  { background: rgba(41,128,185,0.08); border-color: rgba(41,128,185,0.2); }
.esc-pvp-iva  .esc-resumen-value { color: #2980b9; }
.esc-ratio    { background: rgba(192,57,43,0.08);  border-color: rgba(192,57,43,0.2);  }
.esc-ratio    .esc-resumen-value { color: var(--err); }
.esc-ratio.ok { background: rgba(39,174,96,0.08);  border-color: rgba(39,174,96,0.2);  }
.esc-ratio.ok .esc-resumen-value { color: var(--success); }

/* ── Tabs ── */
.esc-tabs { display:flex; gap:.5rem; padding:.5rem 1.2rem 0; border-bottom:1px solid var(--border); background:var(--bg2); }
.esc-tab { background:none; border:none; padding:.55rem 1rem; border-radius:6px 6px 0 0; font-size:.85rem; font-weight:500; color:var(--text-muted); cursor:pointer; transition:all .2s; border-bottom:2px solid transparent; }
.esc-tab:hover { color:var(--text); background:rgba(255,255,255,.05); }
.esc-tab.active { color:var(--primary); border-bottom-color:var(--primary); background:none; }
.esc-panel { }

/* ── Alerta ratio ── */
.esc-alerta { display:flex; align-items:center; gap:.7rem; background:rgba(192,57,43,.1); border:1px solid rgba(192,57,43,.3); border-radius:8px; padding:.7rem 1rem; margin:.8rem 0; font-size:.85rem; color:var(--err); }
.esc-alerta i { font-size:1rem; flex-shrink:0; }

/* ── Comparación ── */
.esc-comp-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:1rem; padding:.8rem 0; }
.esc-comp-list { display:flex; flex-direction:column; gap:1rem; }
.esc-comp-item { background:var(--bg2); border:1px solid var(--border); border-radius:10px; padding:1rem; }
.esc-comp-item-header { display:flex; align-items:center; gap:.6rem; margin-bottom:.8rem; }
.esc-comp-label-input { flex:1; background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:.4rem .7rem; font-size:.9rem; color:var(--text); font-weight:600; }
.esc-comp-fields { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:.5rem; }
.esc-comp-field { display:flex; align-items:center; gap:.5rem; background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:.35rem .6rem; }
.esc-comp-ing { font-size:.8rem; color:var(--text-muted); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.esc-comp-price { width:80px; background:none; border:none; font-size:.85rem; color:var(--text); text-align:right; font-weight:500; }
.esc-comp-price:focus { outline:none; color:var(--primary); }
.esc-comp-result { margin-top:1rem; background:var(--bg2); border:1px solid var(--border); border-radius:10px; padding:1rem; }
.esc-comp-table { width:100%; border-collapse:collapse; font-size:.85rem; }
.esc-comp-table th { text-align:left; padding:.4rem .6rem; color:var(--text-muted); font-weight:500; border-bottom:1px solid var(--border); font-size:.78rem; text-transform:uppercase; }
.esc-comp-table td { padding:.45rem .6rem; border-bottom:1px solid rgba(255,255,255,.04); }
.esc-comp-table tr.comp-winner td { color:var(--success); font-weight:600; }
.btn-sm { padding:.3rem .7rem; font-size:.8rem; }

.escandallo-btns { flex-wrap: wrap; }

/* Botón eliminar fila */
.esc-remove-row {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all var(--transition);
}
.esc-remove-row:hover { color: var(--err); background: rgba(192,57,43,0.1); }

/* Print escandallo */
@media print {
  body > *:not(.escandallo-overlay) { display: none !important; }
  .escandallo-overlay {
    display: flex !important; position: static !important;
    background: white !important; padding: 0 !important;
  }
  .escandallo-content { box-shadow: none !important; max-height: none !important; }
  .escandallo-btns, #escandallo-close-btn, #escandallo-close-btn2 { display: none !important; }
}

@media (max-width: 600px) {
  .escandallo-resumen { grid-template-columns: 1fr 1fr; }
  .escandallo-table thead th:nth-child(5) { display: none; }
  .escandallo-table td:nth-child(5) { display: none; }
}

/* ══════════════════════════════════════════════
   BACKUP & RESTAURACIÓN
   ══════════════════════════════════════════════ */
.backup-content {
  max-width: 500px !important;
}
.backup-content h2 {
  background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

.backup-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.backup-section-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  letter-spacing: 0.01em;
}
.backup-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.backup-stats {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.backup-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.backup-stat strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--primary);
  line-height: 1;
}
.backup-stat span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.backup-divider {
  height: 1px;
  background: var(--card-border);
  margin: 6px 0;
}

/* Dropzone */
.backup-dropzone {
  border: 2px dashed var(--input-border);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--input-bg);
}
.backup-dropzone:hover,
.backup-dropzone.drag-over {
  border-color: var(--primary);
  background: rgba(45,106,79,0.05);
}
.backup-drop-icon {
  font-size: 2rem;
  color: var(--primary);
  opacity: 0.7;
  display: block;
  margin-bottom: 8px;
  transition: transform var(--spring);
}
.backup-dropzone:hover .backup-drop-icon { transform: translateY(-4px) scale(1.1); opacity: 1; }
.backup-dropzone p { font-size: 0.88rem; color: var(--text); margin-bottom: 4px; }
.backup-dropzone small { font-size: 0.75rem; color: var(--text-muted); }

/* Preview del archivo */
.backup-preview {
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.85rem;
  border: 1px solid var(--card-border);
  animation: pillIn 0.3s var(--spring) both;
}
.backup-preview .preview-ok   { color: var(--success); font-weight: 600; }
.backup-preview .preview-err  { color: var(--err);     font-weight: 600; }
.backup-preview .preview-list {
  margin-top: 8px;
  max-height: 100px;
  overflow-y: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  scrollbar-width: thin;
}

/* Opciones de importación */
.backup-import-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: pillIn 0.3s var(--spring) both;
}
.backup-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--input-border);
  transition: all var(--transition);
}
.backup-radio:hover { border-color: var(--primary); background: rgba(45,106,79,0.04); }
.backup-radio input[type="radio"] { accent-color: var(--primary); }

/* ══════════════════════════════════════════════
   IMPORTAR DESDE URL
   ══════════════════════════════════════════════ */

/* FAB secundario */
.fab-import-btn {
  position: fixed;
  bottom: 96px;
  right: 26px;
  width: 46px; height: 46px;
  font-size: 1rem;
  background: white !important;
  color: var(--primary) !important;
  border: 2px solid var(--primary-light) !important;
  z-index: 900;
  box-shadow: var(--shadow-md);
  transition: all var(--spring);
  animation: none !important;
}
.fab-import-btn:hover {
  background: var(--primary) !important;
  color: white !important;
  transform: scale(1.1) !important;
}

.import-url-content { max-width: 620px !important; }
.import-url-content h2 {
  background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

.import-url-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.import-url-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.import-url-input-row input {
  flex: 1;
  padding: 11px 14px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--input-text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color var(--transition);
}
.import-url-input-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.12);
}

.import-url-sites {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
}
.import-url-sites-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.import-url-site {
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--card-border);
}

/* Loading */
.import-url-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--text-muted);
  animation: pillIn 0.3s var(--spring) both;
}
.import-spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Preview */
.import-url-preview {
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
  overflow: hidden;
  animation: cardIn 0.4s var(--spring) both;
}
.import-preview-header {
  display: flex;
  gap: 14px;
  padding: 14px;
  align-items: flex-start;
  border-bottom: 1px solid var(--card-border);
}
#import-preview-img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.import-preview-source {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin-bottom: 4px;
}
.import-preview-header h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 5px;
}
.import-preview-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.import-preview-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.import-preview-sections > div {
  padding: 12px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.import-preview-sections > div:first-child {
  border-right: 1px solid var(--card-border);
}
.import-preview-list {
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  font-size: 0.83rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  padding-left: 16px;
}
.import-preview-list li {
  padding: 3px 0;
  border-bottom: 1px solid var(--card-border);
  line-height: 1.4;
}

@media (max-width: 500px) {
  .import-preview-sections { grid-template-columns: 1fr; }
  .import-url-input-row { flex-direction: column; }
}

/* ══════════════════════════════════════════════
   TOOLTIPS EN BOTONES
   ══════════════════════════════════════════════ */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--primary-dark);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: var(--primary-dark);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Tooltips que van hacia abajo (para botones en la parte superior) */
[data-tooltip-down]::after {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateX(-50%) translateY(-4px);
}
[data-tooltip-down]::before {
  top: calc(100% + 2px);
  bottom: auto;
  border-top-color: transparent;
  border-bottom-color: var(--primary-dark);
  transform: translateX(-50%) translateY(-4px);
}
[data-tooltip-down]:hover::after,
[data-tooltip-down]:hover::before {
  transform: translateX(-50%) translateY(0);
}

/* Tooltip a la izquierda (para FABs en la esquina derecha) */
[data-tooltip-left]::after {
  right: calc(100% + 8px);
  left: auto;
  bottom: 50%;
  transform: translateY(50%) translateX(-4px);
}
[data-tooltip-left]::before {
  right: calc(100% + 2px);
  left: auto;
  bottom: 50%;
  transform: translateY(50%) translateX(-4px);
  border-top-color: transparent;
  border-left-color: var(--primary-dark);
}
[data-tooltip-left]:hover::after,
[data-tooltip-left]:hover::before {
  transform: translateY(50%) translateX(0);
}

/* ══════════════════════════════════════════════
   RESPONSIVE COMPLETO + TÁCTIL
   ══════════════════════════════════════════════ */

/* ── BASE TÁCTIL: targets más grandes en touch ── */
@media (hover: none) and (pointer: coarse) {
  /* Aumentar área táctil de botones */
  .btn-round, .btn-view-toggle, .category-btn, .chip,
  .action-btn, .scaler-btn, .planner-add-btn,
  .fab-btn, .fab-import-btn, .back-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* Desactivar tooltips en táctil (no hay hover) */
  [data-tooltip]::after,
  [data-tooltip]::before,
  [data-tooltip-down]::after,
  [data-tooltip-down]::before,
  [data-tooltip-left]::after,
  [data-tooltip-left]::before { display: none !important; }

  /* Tap highlight sutil */
  * { -webkit-tap-highlight-color: rgba(45,106,79,0.15); }

  /* Desactivar hover en tarjetas (evita que se queden activadas) */
  .recipe-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  .recipe-card:active {
    transform: scale(0.97);
    box-shadow: var(--shadow-md);
  }

  /* Items de lista más altos para dedo */
  .ingredients-list li, .steps-list li { padding: 14px 0; }

  /* Scroll suave en iOS */
  #recipes-container, .detail-content, .modal-content,
  .planner-day-body, .planner-recipe-list { -webkit-overflow-scrolling: touch; }

  /* Evitar zoom en inputs iOS */
  input, select, textarea { font-size: 16px !important; }

  /* Botón eliminar imagen siempre visible en táctil */
  .img-remove-btn { opacity: 1 !important; transform: scale(1) !important; }

  /* FAB más grande en táctil */
  .fab-btn { width: 64px; height: 64px; font-size: 2rem !important; }
  .fab-import-btn { width: 52px; height: 52px; bottom: 106px; }
}

/* ══════════ DESKTOP GRANDE (>1400px) ══════════ */
@media (min-width: 1400px) {
  #recipes-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
  #recipes-container { padding: 28px 32px; }
  .detail-content { padding: 32px 28px; max-width: 900px; margin: 0 auto; }
  .modal-content { max-width: 600px; }
  header h1 { font-size: 1.6rem; }
}

/* ══════════ TABLET LANDSCAPE (1024px - 1280px) ══════════ */
@media (min-width: 1024px) and (max-width: 1280px) {
  #recipes-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ══════════ TABLET PORTRAIT (768px - 1023px) ══════════ */
@media (min-width: 768px) and (max-width: 1023px) {
  #recipes-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  #recipes-container { padding: 16px 14px; }
  header { padding: 12px 16px; }
  header h1 { font-size: 1.3rem; }

  /* Detalle a pantalla completa en tablet */
  .detail-view { position: fixed; inset: 0; }
  .detail-content { padding: 20px; }

  /* Modal más ancho en tablet */
  .modal-content { max-width: 680px; max-height: 88vh; }

  /* Planificador en tablet — 4 días por fila */
  .planner-grid { grid-template-columns: repeat(4, 1fr); }

  /* Escandallo en tablet */
  .escandallo-resumen { grid-template-columns: repeat(2, 1fr); }
  .escandallo-table thead th:nth-child(5) { display: none; }
  .escandallo-table td:nth-child(5) { display: none; }
}

/* ══════════ MÓVIL GRANDE (480px - 767px) ══════════ */
@media (min-width: 480px) and (max-width: 767px) {
  #recipes-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  #recipes-container { padding: 14px 12px; }
  header { padding: 10px 14px; }
  header h1 { font-size: 1.2rem; }

  /* Ocultar texto en botones de acción del detalle */
  .action-btn .fa-pen ~ *, .action-btn .fa-trash ~ *,
  .action-btn .fa-calculator ~ * { display: none; }
  #escandallo-btn i + * { display: none; }

  /* Modal a casi pantalla completa */
  .modal { padding: 8px; align-items: flex-end; }
  .modal-content {
    max-height: 94vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 22px 18px;
  }

  /* Planificador 2 columnas */
  .planner-grid { grid-template-columns: repeat(2, 1fr); }
  .escandallo-resumen { grid-template-columns: repeat(2, 1fr); }

  /* FAB más separado del borde */
  .fab-btn { bottom: 20px; right: 16px; }
  .fab-import-btn { bottom: 88px; right: 18px; }

  /* Filtros más compactos */
  .filter-row { gap: 10px; }
  .chip { padding: 5px 10px; font-size: 0.8rem; }

  /* Detail header compacto */
  .detail-header { padding: 10px 12px; gap: 8px; }
  .detail-title { font-size: 1.1rem; }

  /* Escandallo tabla — ocultar columnas menos importantes */
  .escandallo-table thead th:nth-child(5),
  .escandallo-table td:nth-child(5) { display: none; }
}

/* ══════════ MÓVIL PEQUEÑO (<480px) ══════════ */
@media (max-width: 479px) {
  /* Grid de recetas — 1 o 2 columnas según el contenido */
  #recipes-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  #recipes-container { padding: 12px 10px; }

  .recipe-card .img-wrapper, .recipe-card img { height: 110px; }
  .recipe-title { font-size: 0.92rem; }
  .recipe-meta { font-size: 0.75rem; }
  .cat-badge { font-size: 0.65rem; padding: 2px 6px; }

  /* Header muy compacto */
  header { padding: 10px 12px; }
  header h1 { font-size: 1.05rem; }
  .btn-round { width: 38px; height: 38px; font-size: 1rem; }

  /* Categorías scroll horizontal */
  #category-filters { padding: 8px 10px; gap: 6px; }
  .category-btn { padding: 5px 12px; font-size: 0.8rem; }

  /* Buscador */
  #search-bar { padding: 8px 10px; gap: 7px; }
  #search-input { font-size: 0.88rem; padding: 9px 12px 9px 36px; }

  /* Modal bottom sheet en móvil */
  .modal { padding: 0; align-items: flex-end; }
  .modal-content {
    max-height: 96vh;
    border-radius: 20px 20px 0 0;
    padding: 20px 16px;
    width: 100%;
  }

  /* Barra indicadora de bottom sheet */
  .modal-content::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    background: var(--card-border);
    border-radius: 2px;
    margin: -8px auto 16px;
  }

  /* FAB */
  .fab-btn { width: 56px; height: 56px; bottom: 18px; right: 14px; }
  .fab-import-btn { width: 46px; height: 46px; bottom: 84px; right: 16px; font-size: 0.9rem; }

  /* Detalle */
  .detail-header { padding: 10px 10px; gap: 7px; flex-wrap: nowrap; overflow-x: auto; }
  .detail-title { font-size: 1rem; min-width: 80px; }
  .action-btn { padding: 7px 10px; font-size: 0.8rem; flex-shrink: 0; }
  /* Solo mostrar icono en móvil pequeño */
  .action-btn span, #escandallo-btn .fa-calculator + * { display: none; }

  .detail-content { padding: 14px 12px; }
  .glide__slide img { height: 200px; }
  .section-title { font-size: 1rem; margin: 20px 0 8px; }

  /* Escandallo resumen 2x2 */
  .escandallo-resumen { grid-template-columns: 1fr 1fr; gap: 8px; }
  .esc-resumen-value { font-size: 1.1rem; }
  /* Ocultar columnas en tabla */
  .escandallo-table thead th:nth-child(5),
  .escandallo-table td:nth-child(5),
  .escandallo-table thead th:nth-child(7),
  .escandallo-table td:nth-child(7) { display: none; }
  .esc-input { width: 60px; font-size: 0.8rem; }

  /* Planificador 1 columna */
  .planner-grid { grid-template-columns: repeat(2, 1fr); }

  /* Filtros avanzados */
  .advanced-filters { max-height: 320px; }
  .filter-row { flex-direction: column; gap: 10px; }

  /* Export canvas — escalar */
  #export-canvas { max-width: 100%; }

  /* Resumen escandallo */
  .escandallo-config { flex-direction: column; }
  .escandallo-config-item { min-width: unset; }

  /* Share preview */
  .share-preview { font-size: 0.82rem; max-height: 240px; }

  /* Portion scaler */
  .portion-scaler { padding: 8px 12px; gap: 8px; }

  /* Ocultar textos largos en detail meta */
  #detail-meta span { font-size: 0.78rem; padding: 4px 9px; }
}

/* ══════════ MÓVIL MUY PEQUEÑO (<360px) ══════════ */
@media (max-width: 360px) {
  #recipes-grid { grid-template-columns: 1fr; }
  header h1 { font-size: 0.95rem; }
  .btn-round { width: 34px; height: 34px; }
  .detail-header { gap: 5px; }
  .action-btn { padding: 6px 8px; }
}

/* ══════════ SWIPE GESTURE HINT ══════════ */
/* Indicador visual de que el detalle se puede cerrar con swipe */
@media (hover: none) and (pointer: coarse) {
  .detail-view.active .detail-header::before {
    content: '';
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
  }
}

/* ══════════ LANDSCAPE MÓVIL ══════════ */
@media (max-width: 767px) and (orientation: landscape) {
  header { padding: 8px 14px; }
  header h1 { font-size: 1rem; }
  .btn-round { width: 36px; height: 36px; }
  #category-filters { padding: 6px 12px; }
  #search-bar { padding: 6px 12px; }
  .glide__slide img { height: 160px; }
  .fab-btn { width: 50px; height: 50px; bottom: 14px; }
  .fab-import-btn { bottom: 72px; }
}

/* ══════════════════════════════════════════════
   FIX VISTA DETALLE
   ══════════════════════════════════════════════ */

/* FAB visibility controlled by JS classes */

/* Fix: pastillas de meta no cortadas */
#detail-meta {
  padding: 6px 0 2px 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
}
#detail-meta::-webkit-scrollbar { display: none; }
#detail-meta span { flex-shrink: 0; }

/* Header del detalle: scroll horizontal en pantallas pequeñas */
.detail-header {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex-wrap: nowrap !important;
}
.detail-header::-webkit-scrollbar { display: none; }
.detail-header h2 { flex-shrink: 1; min-width: 0; }

/* Botones de acción del header — siempre en una línea */
.action-btn { flex-shrink: 0; }

/* Separador visual entre grupos de botones */
.detail-header-sep {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
  margin: 0 2px;
}

/* En pantalla < 900px ocultar texto de Editar/Eliminar/Escandallo */
@media (max-width: 900px) {
  #edit-recipe-btn .fa-pen ~ *,
  #delete-recipe-btn .fa-trash ~ * { display: none; }
  #escandallo-btn { font-size: 0; }
  #escandallo-btn i { font-size: 0.9rem; }
  #edit-recipe-btn, #delete-recipe-btn { padding: 8px 11px; }
}

/* En pantalla < 700px solo iconos en todos los action-btn */
@media (max-width: 700px) {
  .action-btn { padding: 8px 10px; min-width: 38px; justify-content: center; }
  .action-btn i { margin: 0 !important; }
  .action-btn > *:not(i) { display: none !important; }
  .detail-title { font-size: 1rem; }
  .detail-header { gap: 6px; padding: 10px 12px; }
}

/* Fix: porción scaler no se corta en móvil */
.portion-scaler { flex-wrap: wrap; width: 100%; }

/* Fix: detail-content no queda debajo del FAB */
.detail-view .detail-content {
  padding-bottom: 32px;
}

/* FAB oculto cuando el detalle está abierto */
.fab-btn.fab-hidden,
.fab-import-btn.fab-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: scale(0) !important;
  transition: transform 0.3s var(--spring), opacity 0.2s ease !important;
}

/* ── FAB SIEMPRE VISIBLE (fix definitivo) ── */
#add-btn:not(.fab-hidden) {
  display: grid !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: fixed !important;
  bottom: 26px !important;
  right: 26px !important;
  z-index: 900 !important;
  transform: none !important;
}

/* ══════════════════════════════════════════════
   COMPARTIR — OPCIONES
   ══════════════════════════════════════════════ */
.share-modal-content { max-width: 420px !important; }
.share-modal-content h2 {
  background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 4px 0 18px;
}

.share-option-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--spring);
}
.share-option-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  color: var(--text);
}
.share-option-btn:active { transform: translateY(-1px) scale(0.97); }

.share-option-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  transition: transform var(--spring);
}
.share-option-btn:hover .share-option-icon { transform: scale(1.1); }

.whatsapp-icon { background: #25D366; color: white; }
.telegram-icon { background: #0088cc; color: white; }
.email-icon    { background: #EA4335; color: white; }
.copy-icon     { background: var(--primary); color: white; }

/* Preview colapsable */
.share-preview-details {
  margin-bottom: 4px;
}
.share-preview-details summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
  transition: color var(--transition);
}
.share-preview-details summary:hover { color: var(--primary); }
.share-preview-details[open] summary { color: var(--primary); }

.share-preview {
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 260px;
  overflow-y: auto;
  font-family: var(--font-body);
  margin-top: 8px;
  scrollbar-width: thin;
}

/* ══════════════════════════════════════════════
   LISTA DE LA COMPRA
   ══════════════════════════════════════════════ */
.shopping-content {
  max-width: 580px !important;
  max-height: 90vh !important;
}

.shopping-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
}
.shopping-header h2 {
  border-bottom: none !important;
  margin-bottom: 4px !important;
  padding-bottom: 0 !important;
  background: linear-gradient(135deg, #27ae60, #2980b9) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}
.shopping-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin: 0;
}

/* Selector de recetas */
.shopping-recipe-selector {
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--card-border);
}
.shopping-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.shopping-section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.btn-add-recipe {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition);
}
.btn-add-recipe:hover { background: var(--primary-dark); transform: translateY(-1px); }

.shopping-selected-recipes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 32px;
  align-items: center;
}
.shopping-empty-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* Tag de receta seleccionada */
.shopping-recipe-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--card);
  border: 1.5px solid var(--primary-light);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--primary);
  animation: thumbIn 0.3s var(--spring) both;
}
.shopping-recipe-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  line-height: 1;
  transition: color var(--transition);
  display: flex;
  align-items: center;
}
.shopping-recipe-tag button:hover { color: var(--err); }

/* Lista de ingredientes */
.shopping-list-section {
  margin-bottom: 14px;
}
.shopping-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.shopping-list-actions {
  display: flex;
  gap: 6px;
}
.btn-sm-action {
  background: var(--bg-alt);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--transition);
}
.btn-sm-action:hover { border-color: var(--primary); color: var(--primary); }

.shopping-list-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

/* Item de la lista */
.shopping-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  transition: all var(--transition);
  animation: listItemIn 0.3s ease both;
  cursor: pointer;
}
.shopping-item:hover { border-color: var(--primary-light); }
.shopping-item.checked {
  opacity: 0.5;
  background: var(--bg-alt);
  text-decoration: line-through;
}
.shopping-item input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.shopping-item-text {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
}
.shopping-item-source {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  flex-shrink: 0;
}

/* Separador de categoría */
.shopping-category-sep {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  padding: 10px 2px 4px;
  border-bottom: 1px solid var(--primary-light);
  margin-bottom: 2px;
}

/* Footer */
.shopping-footer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Print lista de la compra */
@media print {
  body > *:not(#shopping-modal) { display: none !important; }
  #shopping-modal {
    display: flex !important;
    position: static !important;
    background: white !important;
  }
  .shopping-content { box-shadow: none !important; max-height: none !important; }
  .shopping-footer-actions, #shopping-close-btn,
  .shopping-recipe-selector, .btn-add-recipe { display: none !important; }
  .shopping-item.checked { display: none !important; }
}

/* ── SHOPPING: TABS ── */
.shopping-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  background: var(--bg-alt);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border);
}
.shopping-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
}
.shopping-tab:hover { color: var(--text); }
.shopping-tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ── SHOPPING: INPUT MANUAL ── */
.shopping-manual-input {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.shopping-manual-input input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--input-text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: border-color var(--transition);
}
.shopping-manual-input input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.12);
}

.shopping-manual-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Item manual */
.shopping-manual-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  animation: listItemIn 0.3s ease both;
}
.shopping-manual-item span {
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
}
.shopping-manual-item button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 4px;
  transition: color var(--transition);
}
.shopping-manual-item button:hover { color: var(--err); }

/* ── SHOPPING: SHARE OPTIONS ── */
.shopping-share-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.share-option-sm {
  padding: 8px 10px !important;
  gap: 5px !important;
  font-size: 0.72rem !important;
}
.share-option-sm .share-option-icon {
  width: 30px !important;
  height: 30px !important;
  font-size: 1rem !important;
}
.shopping-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shopping-footer-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
/* ═══════════════════════════════════════════════
   MÓDULO DE INVENTARIO — KitchenPro Chef
   Añadir al final de style.css
   ═══════════════════════════════════════════════ */

/* Badge de alerta en el botón del header */
.inventario-btn { position: relative; }
.inv-badge {
  position: absolute; top: -4px; right: -4px;
  background: #e74c3c; color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 99px; padding: 1px 5px;
  pointer-events: none;
}

/* Modal principal */
.inv-modal-content {
  width: min(700px, 96vw);
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.inv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
}
.inv-header h2 { margin: 0; font-size: 1.2rem; }

/* Tabs */
.inv-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 24px 0;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
  flex-wrap: wrap;
}
.inv-tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--text-secondary, #666);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.inv-tab:hover { background: rgba(0,0,0,0.05); }
.inv-tab.active {
  background: var(--primary, #d32f2f);
  color: #fff;
}

/* Paneles */
.inv-panel {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}

/* Toolbar */
.inv-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.inv-search-input, .inv-select {
  flex: 1; min-width: 160px;
  padding: 8px 12px;
  border: 1px solid var(--border, rgba(0,0,0,0.15));
  border-radius: 8px;
  background: var(--card, #fff);
  color: var(--text, #222);
  font-size: 0.9rem;
}

/* Cards de ingredientes */
.inv-list { display: flex; flex-direction: column; gap: 10px; }
.inv-card {
  background: var(--card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 12px;
  padding: 12px 14px;
}
.inv-card-alerta {
  border-color: #e74c3c;
  background: rgba(231,76,60,0.04);
}
.inv-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}
.inv-card-nombre { font-weight: 600; font-size: 0.95rem; }
.inv-card-cat {
  font-size: 0.75rem;
  color: var(--text-secondary, #888);
  background: rgba(0,0,0,0.06);
  border-radius: 99px;
  padding: 2px 8px;
  margin-left: 6px;
}
.inv-card-acciones { display: flex; gap: 6px; flex-shrink: 0; }
.inv-card-stock {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.inv-card-min { color: var(--text-secondary, #888); font-size: 0.8rem; }
.inv-card-precio { color: var(--text-secondary, #888); font-size: 0.8rem; }
.inv-badge-alerta {
  background: rgba(231,76,60,0.12);
  color: #c0392b;
  font-size: 0.75rem;
  border-radius: 99px;
  padding: 2px 8px;
  font-weight: 600;
}

/* Barra de progreso */
.inv-progress-bg {
  height: 4px;
  background: rgba(0,0,0,0.08);
  border-radius: 99px;
  overflow: hidden;
}
.inv-progress-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s;
}

/* Botones inline */
.inv-btn-mov {
  padding: 4px 10px;
  border: none;
  background: var(--primary, #d32f2f);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
}
.inv-btn-edit, .inv-btn-del {
  padding: 4px 8px;
  border: 1px solid var(--border, rgba(0,0,0,0.15));
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary, #666);
  cursor: pointer;
  font-size: 0.8rem;
}
.inv-btn-del:hover { background: rgba(231,76,60,0.1); color: #e74c3c; }

/* Movimientos */
.inv-mov-list { display: flex; flex-direction: column; gap: 8px; }
.inv-mov-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.08));
  border-radius: 10px;
}
.inv-mov-emoji { font-size: 1.2rem; flex-shrink: 0; }
.inv-mov-info { flex: 1; }
.inv-mov-info strong { display: block; font-size: 0.9rem; }
.inv-mov-nota { font-size: 0.78rem; color: var(--text-secondary, #888); }
.inv-mov-right { text-align: right; flex-shrink: 0; }
.inv-mov-fecha { display: block; font-size: 0.75rem; color: var(--text-secondary, #888); }

/* Reporte */
.inv-reporte-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.inv-rep-card {
  background: var(--card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
}
.inv-rep-alerta { border-color: #e74c3c; background: rgba(231,76,60,0.04); }
.inv-rep-num { display: block; font-size: 1.5rem; font-weight: 700; color: var(--primary, #d32f2f); }
.inv-rep-label { font-size: 0.75rem; color: var(--text-secondary, #888); }
.inv-reporte-titulo { font-size: 0.95rem; margin: 0 0 10px; }
.inv-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.inv-tabla th, .inv-tabla td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.08));
}
.inv-tabla th { font-weight: 600; color: var(--text-secondary, #888); }

/* Form modal ingrediente */
.inv-form-content {
  width: min(500px, 95vw);
  padding: 24px;
}
.inv-form-content h2 { margin: 0 0 18px; font-size: 1.1rem; }
.inv-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.inv-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-secondary, #666);
  font-weight: 500;
}
.inv-form-grid label:first-child { grid-column: 1 / -1; }
.inv-input {
  padding: 8px 12px;
  border: 1px solid var(--border, rgba(0,0,0,0.15));
  border-radius: 8px;
  background: var(--card, #fff);
  color: var(--text, #222);
  font-size: 0.9rem;
  margin-top: 2px;
}
.inv-form-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Vacío */
.inv-empty {
  text-align: center;
  color: var(--text-secondary, #888);
  padding: 32px 0;
  font-size: 0.9rem;
}

/* Hint */
.inv-hint {
  font-size: 0.85rem;
  color: var(--text-secondary, #888);
  margin: 0 0 12px;
}

@media (max-width: 480px) {
  .inv-form-grid { grid-template-columns: 1fr; }
  .inv-form-grid label:first-child { grid-column: 1; }
  .inv-tabs { gap: 2px; }
  .inv-tab { padding: 6px 10px; font-size: 0.78rem; }
}
