:root {
  --bg: #f7f9fb;
  --panel: #ffffff;
  --muted: #6b7280;
  --text: #1f2937;
  --accent: #f97316;   /* orange accent */
  --alt: #9e9e9e;      
  --ring: rgba(249, 115, 22, 0.25);
  --shadow: 0 6px 18px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-y: auto;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

header {
  display: grid;
  gap: 14px;
  justify-items: start;
  margin-bottom: 18px;
}

.title {
  font-size: clamp(26px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: 0.2px;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
}

.searchbar {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: var(--panel);
  border: 1px solid #e5e7eb;
  padding: 10px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.searchbar input[type="text"] {
  width: 100%;
  background: #f9fafb;
  border: 1px solid transparent;
  outline: none;
  padding: 14px 14px;
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}

.searchbar input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 5px var(--ring);
}

.searchbar .controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.radio {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.btn {
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  letter-spacing: .2px;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
  transition: background .2s;
}
.btn:hover { background: #ea580c; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* Results grid */
main {
  margin-top: 30px;
  padding: 0 20px 40px; /* padding so first card isn’t stuck to edge */
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 11;
  background: #f3f4f6;
  overflow: hidden;
  border-bottom: 1px solid #e5e7eb;
}
.thumb img {
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  display: block;
  transition: transform .35s ease;
  border-radius: 14px 14px 0 0; /* soft rounded top */
}
.card:hover .thumb img { transform: scale(1.05); }

.content { 
  padding: 16px; 
  flex: 1; 
}
.name { 
  font-weight: 700; 
  margin: 2px 0 8px; 
  font-size: 16px;
}
.tags { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 6px; 
}
.tag {
  font-size: 12px; 
  color: var(--muted);
  padding: 4px 8px; 
  border: 1px solid #e5e7eb;
  border-radius: 999px; 
  background: #f9fafb;
}

.card .actions {
  display: flex; 
  gap: 8px; 
  margin-top: 12px;
}
.btn-view {
  background: var(--accent);
  color: white;
}
.btn-view:hover { background: #ea580c; }

.btn-similar {
  background: var(--alt);
  color: white;
}
.btn-similar:hover { background: #16a34a; }

/* Empty state */
.empty, .error { 
  text-align: center; 
  color: var(--muted); 
  padding: 32px; 
  border: 1px dashed #d1d5db;
  border-radius: 16px; 
  background: #f9fafb;
}

/* Loader */
.loader { 
  display: inline-block; 
  width: 1.25em; 
  height: 1.25em; 
  border: 2px solid #e5e7eb; 
  border-top-color: var(--accent); 
  border-radius: 50%; 
  animation: spin 1s linear infinite; 
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(1turn) } }

/* Modal */
dialog.modal { 
  border: none; 
  padding: 0; 
  border-radius: 16px; 
  max-width: 920px; 
  width: min(92vw, 920px);
  background: var(--panel); 
  color: var(--text); 
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(0,0,0,.45); }
.modal .wrap { display: flex; flex-direction: column; }

.modal .media { 
  width: 100%; 
  aspect-ratio: 16 / 9; 
  overflow: hidden; 
  background: #f3f4f6; 
}
.modal img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  border-radius: 16px 16px 0 0;
}

.modal .body { padding: 20px; }
.modal h2 { margin: 0 0 12px; }

.pill { 
  display: inline-flex; 
  align-items: center; 
  gap: 6px; 
  font-size: 12px; 
  color: var(--muted); 
  padding: 4px 8px; 
  border: 1px solid #e5e7eb; 
  border-radius: 999px;
}

.section { margin-top: 16px; }
.ingredients { 
  display: grid; 
  grid-template-columns: repeat(2, minmax(0, 1fr)); 
  gap: 8px; 
}
.ingredients li { 
  list-style: none; 
  padding: 8px 10px; 
  border-radius: 10px; 
  border: 1px solid #e5e7eb; 
  background: #f9fafb; 
  font-size: 14px; 
}

.instr { 
  white-space: pre-wrap; 
  color: #374151; 
  font-size: 14px; 
}

.closebar { 
  display: flex; 
  justify-content: flex-end; 
  padding: 10px; 
}
.closebtn { 
  background: transparent; 
  border: none; 
  color: var(--muted); 
  font-weight: 700; 
  cursor: pointer; 
  font-size: 18px; 
}

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

/* --- Buttons: make View same as Search, Similar complementary --- */
.btn, .btn-view {
  background: var(--accent);
  color: #fff;
}
.btn:hover, .btn-view:hover {
  background: #ea580c;
}
.btn-similar {
  background: var(--alt);
  color: #fff;
}
.btn-similar:hover {
  background:  #8f8d8d;
}

/* --- Modal image: smaller banner height --- */
.modal .media {
  height: 220px;          /* reduce banner size */
  aspect-ratio: auto;     /* override earlier aspect ratio if any */
  overflow: hidden;
}
.modal .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Instructions: numbered steps look tidy --- */
.instr {
  margin-top: 8px;
}
.instr ol {
  margin: 0;
  padding-left: 18px;     /* indent numbers a bit */
}
.instr li {
  margin: 6px 0;
  line-height: 1.6;
}

/* --- Ingredients: show bullets instead of pill boxes --- */
.ingredients {
  padding-left: 18px;     /* space for bullets */
  margin: 10px 0 0;
}
.ingredients li {
  list-style: disc;       /* bullet style */
  border: none;           /* remove previous box styling */
  background: transparent;
  padding: 0;             /* tighten up so it feels like bullets */
  font-size: 14px;
}


/* Remove orange glow from all buttons */
.btn,
.btn-view,
.btn-similar {
  box-shadow: none !important;  /* kills the orange glow */
}

/* Keep Search button orange without glow */
.btn {
  background: var(--accent);
  color: #fff;
}
.btn:hover {
  background: #ea580c;
}

/* View button -> Grey */
.btn-view {
  background: #9e9e9e;
  color: #fff;
}
.btn-view:hover {
  background: #6b7280;
}

/* Similar button -> White with black text */
.btn-similar {
  background: #ffffff;
  color: #000;
  border: 1px solid #d1d5db;
}
.btn-similar:hover {
  background: #f3f4f6;
}

