/* Closet Stylist — soft, elegant, mobile-first */
:root {
  --sage: #9caf94;
  --sage-deep: #7b9374;
  --sage-soft: #e6ede2;
  --cream: #f7f3ec;
  --beige: #e8dfd2;
  --beige-deep: #d9cdb8;
  --grey: #8a8780;
  --grey-soft: #b8b4ac;
  --ink: #494640;
  --ink-soft: #6f6b63;
  --card: #ffffff;
  --danger: #c08267;
  --gold: #c9a86a;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 20px rgba(73, 70, 64, 0.08);
  --shadow-sm: 0 2px 8px rgba(73, 70, 64, 0.06);
  --tabbar-h: 64px;
  --header-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Hiragino Sans",
    "Avenir Next", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 243, 236, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--beige);
  padding-top: env(safe-area-inset-top);
}
.app-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}
.app-header__title {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin: 0;
  color: var(--ink);
}
.icon-btn {
  border: none;
  background: var(--sage-soft);
  color: var(--sage-deep);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.icon-btn:active { transform: scale(0.9); }

/* ---------- View ---------- */
.view {
  padding: 18px 18px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  max-width: 640px;
  margin: 0 auto;
  animation: fade 0.25s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--grey);
  margin: 22px 2px 10px;
  font-weight: 600;
}
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.card + .card { margin-top: 12px; }

/* ---------- Weather card ---------- */
.weather-card {
  background: linear-gradient(135deg, var(--sage) 0%, var(--sage-deep) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.weather-card__top { display: flex; align-items: center; justify-content: space-between; }
.weather-card__temp { font-size: 3rem; font-weight: 600; line-height: 1; }
.weather-card__emoji { font-size: 3rem; }
.weather-card__desc { opacity: 0.95; margin-top: 4px; font-size: 1.05rem; }
.weather-card__loc { opacity: 0.85; font-size: 0.85rem; }
.weather-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.weather-stat {
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  text-align: center;
}
.weather-stat b { display: block; font-size: 1rem; }
.weather-stat span { font-size: 0.68rem; opacity: 0.9; text-transform: uppercase; letter-spacing: 0.5px; }
.weather-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.flag {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
}

/* ---------- Occasion selector ---------- */
.occasions { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.occasions::-webkit-scrollbar { display: none; }
.occasion-pill {
  flex: 0 0 auto;
  border: 1px solid var(--beige-deep);
  background: var(--card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.occasion-pill.active {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 0.98rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--sage); color: #fff; }
.btn--soft { background: var(--sage-soft); color: var(--sage-deep); }
.btn--ghost { background: var(--beige); color: var(--ink); }
.btn--danger { background: #f1e2da; color: var(--danger); }
.btn--block { display: flex; width: 100%; }
.btn--sm { padding: 8px 12px; font-size: 0.85rem; }

/* ---------- Closet grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.item-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
}
.item-card:active { transform: scale(0.98); }
.item-card__img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--sage-soft);
  display: block;
}
.item-card__ph {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  background: var(--sage-soft);
  color: var(--sage-deep);
}
.item-card__body { padding: 9px 11px 11px; }
.item-card__name { font-weight: 600; font-size: 0.9rem; line-height: 1.2; }
.item-card__meta { font-size: 0.74rem; color: var(--grey); margin-top: 2px; text-transform: capitalize; }
.item-card__fav {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-card__care {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  background: rgba(192, 130, 103, 0.92);
  color: #fff;
  border-radius: 999px;
  padding: 2px 7px;
}

/* ---------- Filters / search ---------- */
.search {
  width: 100%;
  border: 1px solid var(--beige-deep);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--card);
  color: var(--ink);
}
.search:focus { outline: 2px solid var(--sage); outline-offset: 0; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto;
  border: 1px solid var(--beige-deep);
  background: var(--card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.82rem;
  cursor: pointer;
  text-transform: capitalize;
}
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 7px; }
.field input[type="text"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--beige-deep);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1rem;
  font-family: var(--font);
  background: var(--card);
  color: var(--ink);
}
.field textarea { min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--sage); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--beige-deep);
  background: var(--card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.86rem;
  cursor: pointer;
  text-transform: capitalize;
  user-select: none;
}
.chip.active { background: var(--sage); color: #fff; border-color: var(--sage); }

.check-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.check-row input { width: 20px; height: 20px; accent-color: var(--sage); }
.check-row label { margin: 0; font-weight: 500; color: var(--ink); }

/* photo picker */
.photo-pick {
  border: 2px dashed var(--beige-deep);
  border-radius: var(--radius);
  aspect-ratio: 3 / 4;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--grey);
  cursor: pointer;
  overflow: hidden;
  background: var(--sage-soft);
}
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Outfit recommendation ---------- */
.outfit-block { margin-top: 14px; }
.outfit-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.outfit-row::-webkit-scrollbar { display: none; }
.outfit-piece {
  flex: 0 0 116px;
  background: var(--card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.outfit-piece img, .outfit-piece .ph {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--sage-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--sage-deep);
}
.outfit-piece__label { padding: 6px 8px; }
.outfit-piece__role { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--grey); }
.outfit-piece__name { font-size: 0.78rem; font-weight: 600; line-height: 1.15; }
.notes-list { list-style: none; padding: 0; margin: 12px 0 0; }
.notes-list li {
  background: var(--sage-soft);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 0.88rem;
  margin-bottom: 7px;
  color: var(--ink);
}
.notes-list li.warn { background: #f3e4dc; color: var(--danger); }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--beige);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 30;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--grey-soft);
  font-size: 0.66rem;
  font-family: var(--font);
  cursor: pointer;
  padding: 6px 0;
}
.tab__icon { font-size: 1.35rem; line-height: 1; }
.tab.active { color: var(--sage-deep); }
.tab--add .tab__icon {
  background: var(--sage);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -14px;
  box-shadow: var(--shadow);
}

/* ---------- Misc ---------- */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--grey);
}
.empty__emoji { font-size: 2.6rem; display: block; margin-bottom: 10px; }
.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 50;
  max-width: 86%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--beige);
  border-top-color: var(--sage);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { background: var(--beige); color: var(--ink-soft); border-radius: 999px; padding: 3px 10px; font-size: 0.74rem; text-transform: capitalize; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stars { color: var(--gold); letter-spacing: 2px; }
.list-card { display: flex; gap: 12px; align-items: center; }
.list-card__thumbs { display: flex; }
.list-card__thumbs img, .list-card__thumbs .ph {
  width: 42px; height: 42px; border-radius: 8px; object-fit: cover; margin-left: -8px;
  border: 2px solid #fff; background: var(--sage-soft);
  display: flex; align-items: center; justify-content: center;
}
.list-card__thumbs :first-child { margin-left: 0; }

.menu-item {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); margin-bottom: 10px; cursor: pointer;
}
.menu-item__icon { font-size: 1.5rem; }
.menu-item__text b { display: block; }
.menu-item__text span { font-size: 0.8rem; color: var(--grey); }
