/* ============================================================
   RECIPE MODAL — centered popup with backdrop
   ============================================================ */

/* Card is clickable */
.recipe-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- BACKDROP ---------- */
.recipe-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.recipe-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* ---------- MODAL CONTAINER ---------- */
.recipe-modal {
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);

  transform: scale(0.92) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* nicer scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
}

.recipe-modal::-webkit-scrollbar          { width: 8px; }
.recipe-modal::-webkit-scrollbar-track    { background: transparent; }
.recipe-modal::-webkit-scrollbar-thumb    { background: #ccc; border-radius: 4px; }
.recipe-modal::-webkit-scrollbar-thumb:hover { background: #aaa; }

.recipe-modal-backdrop.active .recipe-modal {
  transform: scale(1) translateY(0);
}

/* ---------- CLOSE BUTTON ---------- */
.recipe-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  font-size: 20px;
  font-weight: 700;
  color: #2c3e50;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
  line-height: 1;
}

.recipe-modal-close:hover {
  background: #ff6b6b;
  color: #ffffff;
  transform: rotate(90deg) scale(1.05);
}

/* ---------- HERO IMAGE ---------- */
.recipe-modal-hero {
  width: 100%;
  height: 280px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #ffd89b 0%, #f9a825 100%);
}

.recipe-modal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- BODY ---------- */
.recipe-modal-body {
  padding: 30px 36px 40px;
}

.recipe-modal-title {
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 12px;
  line-height: 1.3;
}

.recipe-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.recipe-modal-tags .tag {
  font-size: 12px;
  padding: 5px 12px;
  background: linear-gradient(135deg, #ff6b6b 0%, #f06595 100%);
  color: #ffffff;
  border-radius: 20px;
  font-weight: 500;
}

/* meta row (time / servings / difficulty) */
.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 14px 16px;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 24px;
}

.recipe-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #495057;
  font-weight: 500;
}

.recipe-meta-item strong {
  color: #2c3e50;
}

/* section blocks */
.recipe-section {
  margin-bottom: 26px;
}

.recipe-section h4 {
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #ff6b6b;
  display: inline-block;
}

.recipe-section ul,
.recipe-section ol {
  margin: 0;
  padding-left: 22px;
  color: #4a4a4a;
  line-height: 1.75;
}

.recipe-section ul li,
.recipe-section ol li {
  margin-bottom: 8px;
  font-size: 15px;
}

.recipe-section ol li::marker {
  color: #ff6b6b;
  font-weight: 700;
}

.recipe-section p {
  margin: 0 0 10px;
  color: #4a4a4a;
  line-height: 1.7;
  font-size: 15px;
}

/* fallback when a recipe has no procedure yet */
.recipe-section em {
  color: #888;
  font-size: 14px;
}

/* lock background scroll while open */
body.modal-open {
  overflow: hidden;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 600px) {
  .recipe-modal-backdrop {
    padding: 10px;
  }

  .recipe-modal {
    border-radius: 16px 16px 0 0;
    max-height: 95vh;
    max-height: 95dvh;
    margin-top: auto;
    align-self: flex-end;
  }

  .recipe-modal-hero  { height: 200px; }
  .recipe-modal-body  { padding: 24px 20px 30px; }
  .recipe-modal-title { font-size: 22px; }
  .recipe-modal-close { top: 12px; right: 12px; width: 36px; height: 36px; }
}
