/* ================================
   Global Design System
================================ */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap");

:root {
  --bg: #f2f4f8;
  --card-bg: #ffffff;
  --accent: #4b6bfb;
  --accent-dark: #2444d4;
  --text: #1f2937;
  --muted: #6b7280;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(0,0,0,0.08);

  --veg: #22c55e;
  --nonveg: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background: #c89666;
  color: var(--text);
}

/* ================================
   Header
================================ */
.site-header {
  background: #12343b;
  padding: 20px;
  box-shadow: var(--shadow);
  top: 0;
  z-index: 20;
}

.site-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 12px;
  color: antiquewhite;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.controls input,
.controls select {
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: var(--radius);
  font-size: 14px;
}

#addRecipeBtn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.2s ease;
}

#addRecipeBtn:hover {
  background: #c80909;
}

/* ================================
   Grid Cards
================================ */
.grid {
  margin: 30px auto;
  padding: 20px;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-3px);
}

.card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.card h3 {
  font-size: 20px;
  margin-bottom: 6px;
}

.card p {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Meta Tags */
.recipe-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.tag {
  background: tan;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 12px;
}

.tag.veg {
  background: var(--veg);
  color: white;
}

.tag.nonveg {
  background: var(--nonveg);
  color: white;
}

/* ================================
   Buttons
================================ */
.btn {
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s ease;
}

.btn.view {
  background: var(--accent);
  color: #fff;
}

.btn.view:hover {
  background: var(--accent-dark);
}

.btn.edit {
  background: #c80909;
  color: white;
}

.btn.delete {
  background: #ff6b6b;
  color: white;
}

/* ================================
   Detail Page
================================ */
#detailView img {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 15px;
}

#detailView h2 {
  font-size: 26px;
  margin-bottom: 8px;
}

#detailView p {
  margin-bottom: 12px;
}

.meta-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#detailView ul,
#detailView ol {
  padding-left: 20px;
  margin-bottom: 18px;
}

#detailView h4 {
  font-size: 18px;
  margin: 12px 0;
}

.backBtn {
  background: #ddd;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: none;
  margin-bottom: 15px;
  cursor: pointer;
}

/* ================================
   Review Section
================================ */
.review-card {
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 10px;
}

.review-card strong {
  font-size: 16px;
  color: #f59e0b;
  display: block;
  margin-bottom: 5px;
}

/* ================================
   Review Popup
================================ */
#reviewPopup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
}

.popup.hidden {
  display: none !important;
}

.popup-content {
  background: white;
  padding: 20px;
  width: 340px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: fadeIn 0.25s ease;
}

.popup-content h3 {
  margin-bottom: 10px;
}

.popup-content select,
.popup-content textarea {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid #ccc;
  margin-bottom: 12px;
}

.popup-actions {
  display: flex;
  justify-content: space-between;
}

.popup-actions .btn {
  width: 48%;
}

@keyframes fadeIn {
  from {opacity: 0; transform: scale(0.95);}
  to {opacity: 1; transform: scale(1);}
}

/* ================================
   Form UI
================================ */
.form {
  max-width: 700px;
  margin: 20px auto;
  padding: 25px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid #ccc;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.error {
  font-size: 12px;
  color: red;
  margin-top: 2px;
}

.hidden {
  display: none;
}

/* Highlight invalid fields */
input:invalid, textarea:invalid, select:invalid {
  border-color: red;
}

/* ================================
   Footer
================================ */
.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  margin-top: 40px;
}

/* ================================
   Review Popup (FIXED)
================================ */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
}

.popup.hidden {
  display: none;
}

.popup-content {
  background: #fff;
  padding: 20px;
  width: 90%;
  max-width: 400px;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: popupIn 0.2s ease;
}

.popup-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

.popup-content select,
.popup-content textarea {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ccc;
  margin-bottom: 10px;
}

@keyframes popupIn {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

