html {
  box-sizing: border-box;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}

* {
  margin: 0;
  padding: 0;
  font-family: "Raleway", sans-serif;
}

html,
body {
  min-height: 100%;
}

body {
  background-color: #f4f4f4;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh; /* real viewport height on mobile browsers */
  width: 100%;
  padding: 24px 16px;
  background:
    linear-gradient(0deg, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)),
    url("./assets/bg.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.container {
  width: 100%;
  max-width: 375px;
  background-color: rgba(0, 0, 0, 0.5);
  color: #eee;
  padding: clamp(16px, 5vw, 20px);
  padding-bottom: clamp(20px, 6vw, 30px);
  border-radius: 8px;
  box-shadow: 0px 0px 4px 2px rgba(0, 0, 0, 0.25);
  border: 1px solid #333;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.logo {
  margin-bottom: 2.4ex;
}
.logo h1 {
  color: #895c2b;
  font-size: clamp(1.5rem, 6vw, 1.8rem);
}
.logo h4 {
  margin-top: -3px;
  color: #ddd;
  font-weight: 500;
  font-size: 0.95rem;
}

.input-section {
  margin-bottom: 20px;
}

.input-section label {
  display: block;
  font-size: 0.9rem;
}

#ingredients {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border: 1px solid #333;
  border-radius: 4px;
  background-color: #222;
  color: #eee;
  font-size: 16px; /* keeps iOS Safari from auto-zooming on focus */
}
#ingredients::placeholder {
  color: #999;
  opacity: 0.9;
}

#search-button {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border: none;
  border-radius: 4px;
  background-color: #5e3f1d;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}

#search-button:hover {
  background-color: #8e5f2c;
}

#recipe-display {
  text-align: left;
  display: none; /* Hidden initially */
}

#recipe-name {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0px;
  word-break: break-word;
}

#recipe-ingredients,
#missing-ingredients {
  margin-bottom: 10px;
  word-break: break-word;
}

#download-button {
  display: none;
}

.text-center {
  text-align: center !important;
}

#recipe-display {
  margin-top: 2ex;
}
#recipe-display h2 {
  font-size: 20px;
}

.buttons {
  margin-top: 2ex;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.button {
  border: none;
  outline: none;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  background-color: rgba(255, 132, 0, 0.95);
  color: #222;
  border: 1px solid rgba(255, 132, 0, 0.95);
  border-radius: 24px;
  transition: 0.3s;
  flex: 1 1 120px;
}

#next-recipe-button,
#download-button {
  background-color: transparent;
  border: 1px solid #ddd;
  color: #ddd;
}
#next-recipe-button:hover,
#download-button:hover {
  background-color: #eaeaea;
  border: 1px solid #eaeaea;
  color: #000;
}

#next-recipe-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#next-recipe-button:disabled:hover {
  background-color: transparent;
  color: #eaeaea;
}

textarea:focus,
input:focus,
button:focus-visible {
  outline: 2px solid #ca9255;
  outline-offset: 2px;
}

#cooking-time {
  margin-top: 10px;
  font-style: italic;
  color: #ca9255;
}

#entered-ingredients {
  display: none; /* Hide ingredient info initially to avoid clutter */
  padding: 10px;
  border-radius: 4px;
  width: 100%;
  margin-top: 10px;
  background-color: rgba(68, 93, 19, 0.85);
  color: #fff;
  word-break: break-word;
}

#recipe-ingredients,
#missing-ingredients {
  padding: 10px;
  border-radius: 4px;
  width: 100%;
  margin-top: 10px;
}
#missing-ingredients {
  background-color: rgba(182, 125, 8, 0.7);
  color: #fff;
}

.match-count {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #c48642;
  font-weight: bold;
}

/* Extra breathing room fix for very small phones (e.g. iPhone SE) */
@media all and (max-width: 360px) {
  body {
    padding: 16px 10px;
  }
  .container {
    padding: 14px;
  }
}
