﻿.recipe-library {
  margin-top: 2.75rem;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.interaction-status {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 18px;
  border-radius: 12px;
  background: #222;
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 4px 18px #0002;
}

.recipe-library-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ededed;
}

.recipe-library-heading h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.recipe-count {
  margin-left: 0.4rem;
  color: #767676;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0;
}

.recipe-library-heading .sort-form {
  display: flex;
  align-items: flex-start;
  position: relative;
  margin: 0 0 0 auto;
}

.recipe-library-heading .sort-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0.4rem 0.25rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #666;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
  transform: none;
}

.recipe-library-heading .sort-toggle:hover { background: transparent; color: #000; transform: none; }
.recipe-library-heading .sort-toggle:focus-visible { outline: none; }

.sort-chevron {
  width: 0.48rem;
  height: 0.48rem;
  flex: 0 0 0.48rem;
  margin-top: -0.2rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 120ms ease;
}

.sort-toggle[aria-expanded="true"] .sort-chevron {
  margin-top: 0.2rem;
  transform: rotate(225deg);
}

.recipe-library-heading .sort-options {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.35rem);
  right: 0;
  width: min(300px, calc(100vw - 2rem));
  overflow: hidden;
  border: 1px solid #000;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 14px #00000012;
}

.recipe-library-heading .sort-options[hidden] { display: none; }

.recipe-library-heading .sort-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 0.8rem 1rem;
  border: 0;
  border-bottom: 1px solid #d9dde0;
  border-radius: 0;
  background: #fff;
  color: #111;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 400;
  cursor: pointer;
  box-shadow: none;
  transform: none;
}

.recipe-library-heading .sort-option:last-child { border-bottom: 0; }
.recipe-library-heading .sort-option:hover,
.recipe-library-heading .sort-option:focus-visible { background: #f4f5f6; outline: none; transform: none; }
.recipe-library-heading .sort-option.is-selected { font-weight: 700; }
.sort-check { font-size: 1.15rem; }

.recipe-library-heading .edit-toggle {
  display: inline-block;
  flex: 0 0 2.6rem;
  margin: 0;
  padding: 0.4rem 0;
  color: #666;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}

.recipe-library-heading .edit-toggle:hover {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2.5rem 1.5rem;
  align-items: stretch;
}

.recipe-card,
.recipe-card:not(.recipe-card-edit) {
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid #efefef;
  border-radius: 14px;
  box-shadow: 0 6px 22px #00000007;
  text-align: left;
  color: #000;
}

.recipe-card:not(.recipe-card-edit) { padding-bottom: 0; }
.recipe-card-copy { display: flex; flex-direction: column; flex: 1; padding: 20px 18px; }
.recipe-title-row { display: flex; align-items: flex-start; gap: 10px; }
.recipe-title-row h3 { flex: 1; min-width: 0; min-height: 3em; }
.recipe-title-row h3 a { color: inherit; text-decoration: none; }

.recipe-card-time {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: #777;
  font-size: 0.875rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.recipe-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.recipe-card-time svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.recipe-card-media {
  display: block;
  overflow: hidden;
  aspect-ratio: 1.4375;
  border-radius: 13px 13px 0 0;
  background: #f5f5f7;
}

.recipe-card .recipe-card-media img,
.recipe-card .recipe-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
  background: #f5f5f7;
}

.recipe-card-media img { transition: transform 0.4s cubic-bezier(0.2, 0.65, 0.3, 1); }

.recipe-card .recipe-placeholder {
  display: grid;
  place-items: center;
  background: #f5f5f7;
  color: #777;
  font-size: 0.8rem;
}

.recipe-card h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-height: 3em;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.recipe-card-link { border-radius: 14px 14px 0 0; }
.recipe-card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 14px;
}
.recipe-title-row h3 a { position: relative; z-index: 2; }
.recipe-card-link:focus-visible { outline: 2px solid #000; outline-offset: 4px; }

.recipe-card .favorite-form {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
}

.recipe-card .add-ingredients-form {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  margin: 0;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
}

.recipe-card .add-ingredients-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  background: #fff;
  color: #000;
}

.add-ingredients-btn svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.recipe-card .delete-recipe-form {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  transform: translate(-50%, -50%);
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, visibility 160ms;
}

.recipe-card .delete-btn {
  position: static;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  margin: 0;
}

.delete-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.recipe-library.is-editing .delete-recipe-form { opacity: 1; visibility: visible; }
.recipe-library.is-editing .favorite-form,
.recipe-library.is-editing .add-ingredients-form { visibility: hidden; }
.recipe-library.is-editing .recipe-card-media img { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .recipe-card .delete-recipe-form,
  .recipe-card-media img,
  .sort-chevron { transition: none; }
}

@media (hover: hover) and (pointer: fine) {
  .recipe-card-link:hover .recipe-card-media img,
  .recipe-card-link:focus-visible .recipe-card-media img { transform: scale(1.06); }
}

@media (min-width: 601px) and (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 601px) and (max-width: 850px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .recipe-library { margin-top: 2rem; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem; }
  .recipe-card-copy { padding: 16px 14px; }
  .recipe-card h3 { font-size: 0.9rem; }
}

@media (max-width: 400px) {
  .grid { grid-template-columns: 1fr; }
}

.recipe-card-footer .add-ingredients-form { margin-left: auto; }
