/* Base, app shell and shared view layout */
/* Base */

:root {
  color-scheme: light;
  --bg: #f7fbfd;
  --surface: #ffffff;
  --surface-blue: #eefbff;
  --text: #07314b;
  --muted: #637b92;
  --border: #cfe0ea;
  --accent: #0a9db7;
  --accent-dark: #075d73;
  --green: #14924a;
  --orange: #f59b00;
  --red: #ff4747;
  --shadow: 0 14px 34px rgba(3, 56, 87, 0.12);
  --motion-fast: 0.16s ease;
  --motion-soft: 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  --bottom-nav-height: 68px;
  --bottom-content-gap: 30px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overscroll-behavior-y: none;
  background:
    radial-gradient(circle at 10% 14%, rgba(37, 192, 214, 0.12), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    background-color var(--motion-fast),
    border-color var(--motion-fast),
    box-shadow var(--motion-fast),
    color var(--motion-fast),
    opacity var(--motion-fast),
    transform var(--motion-fast);
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.985);
}

.hidden {
  display: none !important;
}

[data-app-context="fridge"] .freezer-only {
  display: none !important;
}

/* App shell */

.app-body {
  min-height: 100vh;
}

.mobile-shell {
  position: relative;
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 18px)
    18px
    calc(env(safe-area-inset-bottom) + var(--bottom-nav-height) + var(--bottom-content-gap));
  scroll-padding-bottom: calc(env(safe-area-inset-bottom) + var(--bottom-nav-height) + var(--bottom-content-gap));
  background: rgba(255, 255, 255, 0.72);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  margin: -18px -18px 12px;
  padding: calc(env(safe-area-inset-top) + 6px) 18px 12px;
  background: transparent;
  isolation: isolate;
  transform: translateZ(0);
  transition:
    min-height var(--motion-soft),
    padding var(--motion-soft),
    box-shadow var(--motion-soft);
}

.app-header::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-bottom: 1px solid rgba(207, 224, 234, 0.72);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  content: "";
  pointer-events: none;
  transform: translateZ(0);
  transition:
    height var(--motion-soft),
    box-shadow var(--motion-soft);
}

.app-body.header-condensed .app-header {
  min-height: 48px;
  padding: calc(env(safe-area-inset-top) + 4px) 18px 8px;
  box-shadow: 0 8px 22px rgba(3, 56, 87, 0.08);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  min-width: 0;
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 900;
  backface-visibility: hidden;
  transform: translateZ(0);
  transition: font-size var(--motion-soft), gap var(--motion-soft), transform var(--motion-soft);
}

.brand-mark img {
  width: 32px;
  height: 32px;
  transition: width var(--motion-soft), height var(--motion-soft);
}

.app-body.header-condensed .brand-mark {
  gap: 6px;
  font-size: 1.08rem;
}

.app-body.header-condensed .brand-mark img {
  width: 26px;
  height: 26px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  position: relative;
  z-index: 1;
  backface-visibility: hidden;
  transform: translateZ(0);
  transition: transform var(--motion-soft);
}

.icon-only {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.7rem;
  font-weight: 500;
}

.icon-only img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  transition: transform var(--motion-fast), opacity var(--motion-fast);
}

.app-body.header-condensed .app-header .icon-only {
  width: 34px;
  height: 34px;
}

.app-body.header-condensed .app-header .icon-only img {
  width: 23px;
  height: 23px;
}

.view-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  margin: 8px 0 10px;
}

.view-title-row h1 {
  margin: 0;
  width: 100%;
  padding-right: 122px;
}

.view-title-actions {
  position: absolute;
  right: 0;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 4px;
  transform: translateY(-50%);
}

.title-action {
  width: 36px;
  height: 36px;
  color: var(--accent-dark);
}

.title-action img {
  width: 23px;
  height: 23px;
}

.title-action.desc img {
  transform: rotate(180deg);
}

.title-action.active {
  border-color: transparent;
  background: #e6f7fb;
}

.notify-button {
  position: relative;
}

.notify-button span {
  position: absolute;
  top: 1px;
  right: 0;
  display: grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
}

.notify-button span.status-caution {
  background: #f4a000;
}

.notify-button span.status-warning {
  background: var(--red);
}

.avatar {
  padding: 0;
  border: 0;
  display: grid;
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #10bad2, #0488a7);
  box-shadow: 0 8px 18px rgba(22, 111, 122, 0.18);
  color: #fff;
  font-weight: 900;
  overflow: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
  transition: width var(--motion-soft), height var(--motion-soft), box-shadow var(--motion-soft);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-body.header-condensed .avatar {
  width: 38px;
  height: 38px;
  box-shadow: 0 6px 14px rgba(22, 111, 122, 0.14);
}

@media (hover: none) and (pointer: coarse) {
  .mobile-shell {
    padding-top: calc(env(safe-area-inset-top) + 80px);
  }

  .app-header {
    position: fixed;
    top: 0;
    left: 50%;
    width: min(100%, 430px);
    box-shadow: none;
    margin: 0;
    transform: translateX(-50%) translateZ(0);
  }

  .app-body.header-condensed .app-header {
    box-shadow: none;
    min-height: 48px;
    margin: 0;
    padding: calc(env(safe-area-inset-top) + 4px) 18px 8px;
    transform: translateX(-50%) translateZ(0);
  }

  .app-body.header-condensed .app-header::before {
    bottom: auto;
    height: calc(env(safe-area-inset-top) + 48px);
    box-shadow: 0 8px 22px rgba(3, 56, 87, 0.08);
  }

  .app-body.header-condensed .brand-mark,
  .app-body.header-condensed .header-actions {
    transform: translateY(-5px) translateZ(0);
  }
}

/* Shared view layout */

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-enter 0.24s ease-out both;
}

h1 {
  margin: 8px 0 10px;
  color: #051f3e;
  font-size: 1.62rem;
  line-height: 1.12;
  letter-spacing: 0;
}

[data-view="add"] > h1 {
  margin: 4px 0 8px;
  font-size: 1.44rem;
}

h2,
h3,
p {
  margin-top: 0;
}
