/* Reset default spacing */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Main color used in the design */
:root {
  --bg-main: #FFF6E9;
  --card: #ffffff;

  --primary: #FF9B50;
  --primary-light: #FFB76B;

  --accent: #FFD166;
  --danger: #E63946;

  --text-main: #2B2D42;
  --text-soft: #6C757D;
  --label: #4a5160;
  --muted-icon: #a2a9b6;

  --border: #F1E3D3;
  --border-strong: #e7e1d8;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.05);

  --success-bg: #c7e9d7;
  --success-text: #2d6a4f;
  --error-bg: #fde2e4;
  --info-bg: #FFF1E5;
  --info-text: #8a5a2b;

  --radius: 18px;
}

/* General page style */
body {
  font-family: Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
}

/* Top hero section */
.hero {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  color: white;
  padding: 60px 20px;
  text-align: center;
}

.hero-inner {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.hero-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
}

.hero p {
  margin-top: 10px;
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Main layout container */
.page-container {
  max-width: 1180px;
  margin: -26px auto 0;
  padding: 0 18px 40px;
}

/* Search card */
.search-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 30px;
  margin-top: -30px;
  box-shadow: var(--shadow);
}

.search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field label {
  display: block;
  margin-bottom: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--label);
}

.input-box {
  position: relative;
  width: 100%;
}

/* Small icon inside each input */
.input-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-icon);
  font-size: 1rem;
  z-index: 2;
  pointer-events: none;
}

/* Input and select style */
input,
select {
  width: 100%;
  height: 60px;
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  padding: 0 18px 0 52px;
  font-size: 1rem;
  background: #fff;
  transition: 0.2s;
  outline: none;
}

/* Focus effect */
input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 155, 80, 0.2);
}

/* Custom select arrow style */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 52px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #7a6a5d 50%),
    linear-gradient(135deg, #7a6a5d 50%, transparent 50%);
  background-position: calc(100% - 22px) 26px, calc(100% - 16px) 26px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* Buttons row */
.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* Shared button style */
.btn {
  border: none;
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: bold;
  cursor: pointer;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-icon {
  font-size: 1.7rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-1px);
}

/* Search Meals button */
.btn-primary {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #be6633 0%, #d98c49 100%);
}

/* Random Meal button */
.btn-secondary {
  background: linear-gradient(90deg,  #f7c948, var(--accent));
  color: white;
}

.btn-secondary:hover {
  background: linear-gradient(90deg, #e0b84d, #efc14a);
}

/* Clear Results button */
.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--primary);
}

.btn-outline:hover {
  background: #FFF1E5;
}

/* Message styles */
.message {
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 16px 20px;
  border-radius: 16px;
  font-weight: 700;
}

.message.error {
  background: var(--error-bg);
  color: var(--danger);
}

.message.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.message.info {
  background: var(--info-bg);
  color: var(--info-text);
}

/* Hide elements when needed */
.hidden {
  display: none !important;
}

/* Results section */
.results-wrap {
  max-width: 1180px;
  margin: 26px auto 0;
}

.results-head {
  margin-bottom: 18px;
}

.results-head h2 {
  font-size: 2rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.results-head p {
  color: var(--text-soft);
}

/* Recipe cards grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.recipe-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.recipe-image-wrap {
  position: relative;
  height: 210px;
  overflow: hidden;
}

.recipe-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Small badge for category */
.category-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
}

.recipe-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.recipe-content h3 {
  font-size: 1.35rem;
  margin-bottom: 12px;
  color: var(--text-main);
  line-height: 1.3;
}

.meta {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.meta-item {
  color: #677083;
  font-size: 0.96rem;
}

.meta-item strong {
  color: #40495d;
}

.preview-text {
  color: #6b7385;
  font-size: 0.96rem;
  line-height: 1.5;
  min-height: 52px;
  margin-bottom: 16px;
}

/* View recipe button */
.view-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  margin-top: auto;
}

.view-btn:hover {
  transform: scale(1.03);
}

/* Empty state style */
.empty-box {
  background: transparent;
  text-align: center;
  padding: 70px 20px 30px;
  color: #748096;
}

.empty-box .empty-icon {
  font-size: 5rem;
  opacity: 0.4;
  margin-bottom: 10px;
}

.empty-box h3 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.empty-box p {
  font-size: 1.15rem;
}

/* Details page style */
.details-page {
  padding: 34px 16px 50px;
  background: linear-gradient(180deg, var(--bg-main) 0%, #fffdf9 100%);
}

.details-container {
  max-width: 980px;
  margin: 0 auto;
}

/* Back button */
.back-btn {
  background: transparent;
  border: none;
  color: #556074;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 22px;
}

.back-btn:hover {
  color: var(--primary);
}

/* Details card */
.details-card {
  background: white;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 16px 34px rgba(68, 49, 33, 0.1);
}

.details-hero {
  position: relative;
  min-height: 420px;
  background-size: cover;
  background-position: center;
}

/* Dark overlay on the meal image */
.details-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.58) 100%);
}

.details-hero-content {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 28px;
  z-index: 2;
  color: white;
}

.details-hero-content h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: 14px;
  line-height: 1.15;
}

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

.details-tag {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  color: white;
}

.tag-orange {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.tag-green {
  background: linear-gradient(135deg, #4caf50 0%, #81c784 100%);
}

.details-body {
  padding: 28px 28px 36px;
}

/* Ingredients and instructions sections */
.ingredients-section,
.instructions-section {
  margin-bottom: 30px;
}

.ingredients-section h2,
.instructions-section h2 {
  font-size: 2rem;
  margin-bottom: 18px;
  color: var(--text-main);
}

.ingredients-grid {
  background: #f9f4eb;
  border-radius: 18px;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 26px;
  border: 1px solid #efe2d1;
}

.ingredient-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #4b5568;
  line-height: 1.55;
  font-size: 1rem;
}

.ingredient-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 8px;
  flex-shrink: 0;
}

.instructions-list {
  display: grid;
  gap: 16px;
}

.step-item {
  display: flex;
  gap: 16px;
  background: #f8f9fb;
  border-radius: 18px;
  padding: 18px 20px;
}

.step-number {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.step-text {
  color: #4e596d;
  font-size: 1rem;
  line-height: 1.65;
  padding-top: 5px;
}

/* Video button section */
.video-wrap {
  text-align: center;
  margin-top: 10px;
}

.video-btn {
  display: inline-block;
  text-decoration: none;
  background: linear-gradient(135deg, var(--danger) 0%, #ff5a5f 100%);
  color: white;
  padding: 16px 28px;
  border-radius: 16px;
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(230, 57, 70, 0.2);
}

.video-btn:hover {
  filter: brightness(0.98);
}

/* Tablet screen adjustments */
@media (max-width: 850px) {
  .search-grid {
    grid-template-columns: 1fr;
  }

  .ingredients-grid {
    grid-template-columns: 1fr;
  }

  .details-hero {
    min-height: 320px;
  }
}

/* Mobile screen adjustments */
@media (max-width: 560px) {
  .hero {
    padding: 40px 16px 50px;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .results-head h2,
  .ingredients-section h2,
  .instructions-section h2 {
    font-size: 1.6rem;
  }

  .details-body {
    padding: 22px 18px 28px;
  }

  .details-hero-content {
    left: 18px;
    right: 18px;
    bottom: 18px;
  }
}
