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

:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #5c5c5c;
  --line: #e1dfda;
  --accent: #e46a4f;
  --accent-soft: #fbe2db;
  --teal: #0c7c74;
  --shadow: 0 14px 30px rgba(0, 0, 0, 0.08);
  --floating-height: 74px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fdf1e7, transparent 60%),
    radial-gradient(circle at 20% 20%, #e6f2f1, transparent 55%),
    var(--bg);
  min-height: 100vh;
}

.app-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding-bottom: calc(var(--floating-height) + 40px);
}

main {
  padding-left: 2vh;
  padding-right: 2vh;
}

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  background-color: var(--ink);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-mark {
  font-size: 3vh;
  font-weight: 600;
  text-decoration: none;
  color: inherit;
  color: var(--surface);
  padding-left: 1vh;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-header h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.panel.muted {
  background: #f8f8f6;
  border-style: dashed;
}

.tabs {
  display: flex;
  margin-bottom: 18px;
}

.topbar-tabs {
  margin-bottom: 0;
}

.tab {
  width: 23vw;
  color: var(--surface);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  background: transparent;
}

.tab.active {
  background: var(--accent);
  color: var(--surface);
}

.mode {
  animation: fadeIn 0.4s ease;
}

.mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

#liquor-form-page .mode-header {
  margin-bottom: 8px;
}

.mode-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.floating-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 2vh 18px;
  z-index: 900;
  pointer-events: none;
}

.floating-row {
  max-width: 1080px;
  margin: 0 auto;
  background: rgba(14, 14, 14, 0.92);
  color: #fff;
  border-radius: 20px;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
  pointer-events: auto;
}

.bottom-tabs {
  margin-bottom: 0;
  gap: 8px;
}

.bottom-tabs .tab {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bottom-tabs .tab.active {
  background: var(--accent);
  border-color: transparent;
}

.floating-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  font-size: 14px;
}

.pill.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.pill.primary {
  background: var(--accent);
  color: #fff;
}

.floating-search {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.floating-search input {
  flex: 1;
  height: 42px;
  outline: none;
}

.floating-search .ghost {
  border: 1px solid var(--line);
  color: var(--ink);
}

.search-open .floating-search {
  opacity: 1;
  pointer-events: auto;
}

.search-open .bottom-tabs,
.search-open .floating-actions {
  opacity: 0;
  pointer-events: none;
}

.search-open .floating-row {
  background: #fff;
  color: var(--ink);
}

body:not(.is-liquor) .floating-actions,
body:not(.is-liquor) .floating-search {
  display: none;
}

.overlay-sheet {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 950;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.overlay-sheet[hidden] {
  display: flex;
}

.overlay-scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 16, 0.55);
  opacity: 0;
  transition: opacity 220ms ease;
}

.sheet {
  position: relative;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 18px 18px 28px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 220ms ease, transform 240ms ease;
}

body.sheet-open .overlay-sheet {
  opacity: 1;
  pointer-events: auto;
}

body.sheet-open .overlay-scrim {
  opacity: 1;
}

body.sheet-open .sheet {
  opacity: 1;
  transform: translateY(0);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 600;
}

.sheet-open {
  overflow: hidden;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.card-image {
  height: 140px;
  background: linear-gradient(120deg, #fde5dc, #f0f6f5);
  background-size: cover;
  background-position: center;
}

.card-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-title {
  font-weight: 600;
  font-size: 16px;
}

.card-meta {
  font-size: 13px;
  color: var(--muted);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.list-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
  align-items: start;
  cursor: pointer;
}

.list-main h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.list-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.list-meta {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.bottle-thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.list-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.list-actions button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 6px 10px;
}

.star-rating {
  display: inline-flex;
  gap: 2px;
  vertical-align: middle;
  align-items: center;
}

.star-rating .star {
  color: #c7c7c7;
  font-size: 14px;
}

.star-rating .star.filled {
  color: #111;
}

.thumb {
  width: 48px;
  height: 64px;
  border-radius: 10px;
  background: #f1f1f1;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  padding: 0;
  cursor: pointer;
  appearance: none;
}

.thumb:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer-img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  background: #111;
}

.image-viewer-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 1;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 0;
  appearance: none;
}

.image-viewer-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.has-image-viewer {
  overflow: hidden;
}

.stack {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

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

.field-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-row .field-control {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.image-upload {
  display: grid;
  gap: 10px;
}

.image-upload-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.image-upload-meta {
  font-size: 13px;
  color: var(--muted);
}

.image-upload-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}


.image-thumb {
  position: relative;
  display: inline-flex;
}

.image-thumb .thumb {
  width: 56px;
  height: 74px;
  display: block;
}

.image-thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}

.image-thumb-remove:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

input,
select {
  min-width: 0px;
  height: 40px;
}

.inline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.owned-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: #9b9b9b;
  display: grid;
  place-items: center;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.owned-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.owned-toggle.is-active {
  color: var(--ink);
  border-color: var(--ink);
}

.owned-toggle:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

button {
  border: none;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

a.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
}

a.button-link.primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

a.button-link.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

button.primary {
  background: var(--accent);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.filters {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.filters label {
  font-size: 13px;
  min-width: 0;
}

.filters input,
.filters select {
  width: 100%;
  min-width: 0;
  height: 40px;
}


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

.form-actions button {
  flex-grow: 1;
}

.stars {
  display: flex;
  gap: 6px;
}

.stars button {
  font-size: 20px;
  background: #f1f1f1;
  color: #b6b6b6;
  border-radius: 8px;
  padding: 6px 6px;
}

.stars button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.owned-badge {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
}

.owned-badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 760px) {
  .app-shell {
    padding: 32px 24px calc(var(--floating-height) + 48px);
  }

  .panel {
    padding: 24px;
  }

  .list-item {
    grid-template-columns: 2fr 1fr;
  }

  .filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
  }
}