/* ===== Frigo — style.css ===== */

@font-face {
  font-family: "Cream Cake";
  src: url("../fonts/Cream%20Cake.otf") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cream Cake";
  src: url("../fonts/Cream%20Cake%20Bold.otf") format("opentype");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fdf7f5;
  --bg-soft: #f7ebe8;
  --rose: #e3a9a9;
  --rose-deep: #c98686;
  --sage: #c3d9bb;
  --sage-deep: #8fae85;
  --red: #f4cfc9;
  --red-deep: #a45c50;
  --text: #4b3b3b;
  --text-light: #9a8484;
  --white: #ffffff;

  --font-logo: "Cream Cake", cursive;
  --font-body: "Jost", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  touch-action: pan-y;
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text);
  background: radial-gradient(circle at 50% 15%, var(--bg-soft) 0%, var(--bg) 55%);
  background-attachment: fixed;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8vh 6vw 6vh;
  -webkit-font-smoothing: antialiased;
}

body.center {
  justify-content: center;
}

.home {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
}

.page {
  width: 100%;
  max-width: 360px;
}

/* --- Page header (sous-pages) --- */

.page-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 4vh;
}

.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--rose-deep);
  text-decoration: none;
}

.back-link svg {
  width: 18px;
  height: 18px;
  stroke: var(--rose-deep);
}

.page-title {
  font-family: var(--font-logo);
  font-size: 2.2rem;
  color: var(--rose-deep);
  margin: 0;
  line-height: 1;
}

/* --- Logo --- */

.logo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10vh;
}

.logo-bloom {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  background:
    radial-gradient(circle at 38% 30%, rgba(227, 169, 169, 0.4) 0%, rgba(227, 169, 169, 0) 45%),
    radial-gradient(circle at 68% 62%, rgba(195, 217, 187, 0.32) 0%, rgba(195, 217, 187, 0) 45%);
  filter: blur(2px);
  z-index: -1;
  pointer-events: none;
}

.logo {
  position: relative;
  z-index: 1;
  font-family: var(--font-logo);
  font-size: clamp(3.5rem, 18vw, 5rem);
  color: var(--rose-deep);
  line-height: 1;
  margin: 0;
  animation: bloom-in 1.1s ease-out both;
}

@keyframes bloom-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo {
    animation: none;
  }
}

/* --- Navigation buttons --- */

.nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 1rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--rose);
  background: var(--white);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.15s ease, border-color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn svg {
  flex: none;
  width: 20px;
  height: 20px;
  stroke: var(--rose-deep);
}

.nav-btn:hover {
  background: var(--bg-soft);
  border-color: var(--rose-deep);
}

.nav-btn:active {
  transform: scale(0.97);
}

.nav-btn:focus-visible {
  outline: 2px solid var(--rose-deep);
  outline-offset: 3px;
}

/* --- Liste (tableau) --- */

.list-card {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--bg-soft);
  border-radius: 24px;
  padding: 1.6rem 1.4rem;
  box-shadow: 0 12px 30px -20px rgba(75, 59, 59, 0.25);
}

.list-card-title {
  font-family: var(--font-logo);
  font-size: 1.6rem;
  color: var(--rose-deep);
  margin: 0 0 1.2rem;
  text-align: center;
}

.add-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.add-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--rose);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.add-row input[type="text"]:focus {
  outline: none;
  border-color: var(--rose-deep);
}

.add-row input[type="text"]::placeholder {
  color: var(--text-light);
}

.add-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--rose);
  color: var(--white);
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.add-btn:hover {
  background: var(--rose-deep);
}

.add-btn:active {
  transform: scale(0.94);
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.category-group {
  margin-top: 1.1rem;
}

.category-group:first-child {
  margin-top: 0;
}

.category-title {
  font-size: 0.72rem;
  color: var(--sage-deep);
  letter-spacing: 0.03em;
  margin: 0 0 0.3rem 0.2rem;
  font-weight: 400;
}

.item-category {
  flex: none;
  max-width: 92px;
  border: none;
  background: var(--bg-soft);
  color: var(--text-light);
  font-family: var(--font-body);
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
}

.item-category:focus {
  outline: 1px solid var(--rose);
}

.item-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.2rem;
  border-bottom: 1px solid var(--bg-soft);
  font-size: 0.95rem;
  animation: item-in 0.2s ease-out both;
}

.item-row:last-child {
  border-bottom: none;
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.item-check {
  flex: none;
  width: 19px;
  height: 19px;
  accent-color: var(--sage-deep);
  cursor: pointer;
}

.item-text {
  flex: 1;
  min-width: 0;
  padding: 0.2rem 0.1rem;
  cursor: text;
  overflow-wrap: break-word;
  border-bottom: 1px dashed transparent;
  transition: color 0.2s ease;
}

.item-text:hover {
  border-bottom-color: var(--rose);
}

.item-row.checked .item-text {
  color: var(--sage-deep);
  text-decoration: line-through;
  text-decoration-color: var(--sage);
}

.item-edit-input {
  flex: 1;
  min-width: 0;
  padding: 0.2rem 0.1rem;
  border: none;
  border-bottom: 1px solid var(--rose-deep);
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.item-edit-input:focus {
  outline: none;
}

.item-remove {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.item-remove:hover {
  background: var(--bg-soft);
  color: var(--rose-deep);
}

.empty-state {
  text-align: center;
  color: var(--text-light);
  font-size: 0.9rem;
  padding: 1rem 0;
}

.stock-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.8rem 0.2rem;
  border-bottom: 1px solid var(--bg-soft);
  animation: item-in 0.2s ease-out both;
}

.stock-row:last-child {
  border-bottom: none;
}

.stock-row-top {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.stock-row-top .item-text {
  flex: 1;
  font-size: 0.95rem;
}

.stock-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-left: 0.1rem;
  flex-wrap: wrap;
}

.meta-badge {
  font-size: 0.78rem;
  color: var(--text-light);
  background: var(--bg-soft);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  cursor: text;
  border-bottom: 1px dashed transparent;
}

.meta-badge:hover {
  border-bottom-color: var(--rose);
}

.meta-badge.expiry-estimated::after {
  content: " (est.)";
  font-size: 0.7em;
  opacity: 0.75;
}

.meta-badge.expiry-soon {
  background: #f9dfc0;
  color: #92652f;
}

.meta-badge.expiry-expired {
  background: #f4cfc9;
  color: #a45c50;
}

.meta-edit-input {
  border: none;
  border-bottom: 1px solid var(--rose-deep);
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.15rem 0.2rem;
  width: 92px;
}

.meta-edit-input:focus {
  outline: none;
}

/* --- Formulaire d'ajout à deux lignes (stock) --- */

.add-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.add-stack input[type="text"] {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--rose);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.add-stack input[type="text"]:focus {
  outline: none;
  border-color: var(--rose-deep);
}

.add-stack-line2 {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.add-stack-line2 input[type="number"] {
  width: 62px;
  padding: 0.6rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--rose);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: center;
}

.add-stack-line2 input[type="date"] {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--rose);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
}

.add-stack-line2 input:focus {
  outline: none;
  border-color: var(--rose-deep);
}

.form-hint {
  margin: 0.5rem 0.2rem 0;
  font-size: 0.75rem;
  color: var(--text-light);
  text-align: center;
}

.item-row.duplicate .item-text {
  color: var(--red-deep);
  font-weight: 500;
}

/* --- Aperçu du stock (lecture seule) --- */

.stock-preview {
  width: 100%;
  margin-top: 1.4rem;
}

.stock-preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  padding: 0 0.2rem;
}

.stock-preview-title {
  font-family: var(--font-logo);
  font-size: 1.3rem;
  color: var(--sage-deep);
  margin: 0;
}

.stock-preview-link {
  font-size: 0.78rem;
  color: var(--text-light);
  text-decoration: none;
  border-bottom: 1px dashed var(--text-light);
}

.stock-preview-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stock-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--bg-soft);
  font-size: 0.88rem;
  color: var(--text);
}

.stock-preview-row:last-child {
  border-bottom: none;
}

.stock-preview-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-preview-qty {
  flex: none;
  font-size: 0.78rem;
  color: var(--text-light);
}

/* --- Footer note --- */

.tagline {
  margin-top: 6vh;
  font-size: 0.78rem;
  color: var(--text-light);
  letter-spacing: 0.03em;
  text-align: center;
}
