@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap");

:root {
  --bg: #fff0e3;
  --bg-accent: #ffe4cf;
  --panel: #fffefd;
  --panel-dark: #1f1820;
  --border: rgba(53, 27, 5, 0.14);
  --text: #2b1f16;
  --muted: #7e6a5d;
  --muted-2: #a08979;
  --primary: #ff8a4c;
  --primary-dark: #d76a2e;
  --danger: #d94a4a;
  --success: #1f9d55;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow-soft: 0 25px 60px rgba(63, 36, 9, 0.12);
}

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

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, var(--bg) 0%, var(--bg-accent) 45%, #fff 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1200px, 100% - 3rem);
  margin: 0 auto;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 5rem;
}

.app-hero {
  color: var(--panel);
  background: linear-gradient(135deg, #1f1820 0%, #33202a 50%, #47241b 100%);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  padding: 3rem 0 2.5rem;
  margin-bottom: 2rem;
}

.hero-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2.5rem;
  align-items: center;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.74);
}

.hero-desc {
  margin: 1rem 0 1.5rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 520px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.hero-btn {
  min-width: 180px;
  justify-content: center;
}

.app-hero .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.app-hero .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.hero-sidecar {
  justify-self: stretch;
}

.stat-card {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.stat-label {
  margin: 0 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
}

.stat-list {
  margin: 0;
  padding-left: 0;
  display: grid;
  gap: 0.7rem;
  color: rgba(255, 255, 255, 0.9);
  list-style: none;
}

.main-grid {
  display: grid;
  gap: 1.7rem;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  grid-template-areas:
    "ad-top ad-top"
    "saved saved"
    "form list"
    "ad-middle ad-middle"
    "summary prices"
    "ad-bottom ad-bottom";
}

[data-area="form"] {
  grid-area: form;
}
[data-area="list"] {
  grid-area: list;
}
[data-area="summary"] {
  grid-area: summary;
}
[data-area="prices"] {
  grid-area: prices;
}
[data-area="saved"] {
  grid-area: saved;
}
[data-area="ad-top"] {
  grid-area: ad-top;
}
[data-area="ad-middle"] {
  grid-area: ad-middle;
}
[data-area="ad-bottom"] {
  grid-area: ad-bottom;
}

@media (max-width: 960px) {
  .main-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "ad-top"
      "saved"
      "form"
      "list"
      "summary"
      "prices"
      "ad-middle"
      "ad-bottom";
  }
}

.card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.ad-slot {
  padding: 0.85rem;
}

.ad-box {
  min-height: 86px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.95rem;
}

.panel {
  padding: 1.5rem;
}

.panel-prices {
  padding: 1.2rem;
}

.panel-prices .panel-header {
  margin-bottom: 0.9rem;
}

.panel-prices .entry-form {
  gap: 0.75rem;
}

.panel-prices input {
  padding: 0.8rem 0.95rem;
}

.panel-prices .btn {
  min-height: 42px;
  padding: 0.75rem 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.panel-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.status-pill {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(255, 138, 76, 0.15);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.85rem;
}

.entry-form {
  display: grid;
  gap: 1rem;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.field-group {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.field-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 0.95rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font: inherit;
  background: #fffdfb;
  color: var(--text);
}

textarea {
  min-height: 170px;
  resize: vertical;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  min-height: 46px;
  padding: 0.85rem 1.3rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  margin-bottom: 5px;
  box-shadow: 0 12px 30px rgba(255, 138, 76, 0.35);
}

.btn-ghost,
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-danger {
  background: rgba(217, 74, 74, 0.1);
  color: var(--danger);
  border-color: rgba(217, 74, 74, 0.2);
}

.grocery-list {
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 720px) {
  .grocery-list {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}

.grocery-item {
  position: relative;
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #fffdfa 0%, #fff5ec 100%);
  box-shadow: var(--shadow-soft);
}

.grocery-item.checked {
  background: linear-gradient(135deg, #f7fbf7 0%, #eef6ee 100%);
  border-color: rgba(17, 112, 56, 0.3);
}

.grocery-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border);
}

.check-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  background: #fff;
  font-weight: 600;
}

.check-wrap input {
  width: 20px;
  height: 20px;
}

.line-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  text-align: right;
  flex-shrink: 0;
}

.line-total-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.line-total-value {
  font-size: 1.1rem;
  color: var(--success);
}

.grocery-item.checked .line-total-value {
  color: var(--muted-2);
}

.grocery-body {
  display: grid;
  gap: 0.7rem;
}

.grocery-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.field-span {
  grid-column: 1 / -1;
}

.grocery-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.15rem;
  border-top: 1px solid rgba(53, 27, 5, 0.08);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.summary-box {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fffdfb;
  padding: 1rem;
}

.summary-label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-box strong {
  font-size: 1.4rem;
}

.saved-controls {
  margin-bottom: 1rem;
}

.saved-entries {
  display: grid;
  gap: 1.2rem;
}

.saved-item {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.25rem;
  background: linear-gradient(135deg, rgba(255, 138, 76, 0.08), rgba(255, 255, 255, 0.8));
  display: grid;
  gap: 0.9rem;
}

.saved-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.saved-type {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary-dark);
}

.saved-date {
  font-size: 0.85rem;
  color: var(--muted);
}

.saved-title {
  margin: 0;
  font-size: 1.2rem;
}

.ingredient-chips {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ingredient-chip {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(43, 31, 22, 0.08);
  font-size: 0.9rem;
}

.ingredient-chip-empty {
  background: rgba(43, 31, 22, 0.05);
  color: var(--muted);
  font-style: italic;
}

.saved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.search-input {
  position: relative;
}

.search-input input {
  padding-left: 2.6rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.empty-state {
  padding: 1.2rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
}

.footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--muted);
}

.sticky-summary {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.3rem;
  border-radius: var(--radius-lg);
  background: rgba(31, 24, 32, 0.94);
  color: #fff;
  box-shadow: 0 25px 40px rgba(19, 13, 17, 0.35);
  font-weight: 600;
}

@media (max-width: 600px) {
  .panel,
  .app-hero {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }

  .btn {
    width: 100%;
  }

  .panel-actions {
    width: 100%;
  }

  .panel-prices {
    padding: 1rem;
  }

  .panel-prices .panel-header h2 {
    font-size: 1.2rem;
  }

  .panel-prices .panel-eyebrow {
    font-size: 0.72rem;
  }

  .panel-prices .entry-form {
    gap: 0.65rem;
  }

  .panel-prices input {
    padding: 0.72rem 0.9rem;
  }
}

@media (max-width: 640px) {
  .grocery-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .line-total {
    align-items: flex-start;
    text-align: left;
  }

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

  .grocery-actions {
    justify-content: stretch;
  }
}
