/* ============================================================
   WoreItorWearit — app components · Maison edition
   Squared corners, hairlines, tracked caps, serif display.
   ============================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--ink-900); color: var(--text-on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--text-on-accent); }
.btn-primary:active { background: var(--accent-press); }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--ink-900);
}
.btn-secondary:hover { background: var(--ink-900); color: var(--ivory-50); }

.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-hover); }

.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px var(--border-strong); }
.btn-danger:hover { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }

.btn-sm { height: 40px; padding: 0 20px; font-size: 11px; }
.btn-md { height: 48px; padding: 0 26px; font-size: 12px; }
.btn-lg { height: 56px; padding: 0 34px; font-size: 12.5px; }
.btn-block { display: flex; width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-muted); }
.icon-btn:active { transform: scale(0.92); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
}
.card-elevated { border: 1px solid var(--border-subtle); box-shadow: var(--shadow-md); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: var(--fs-micro);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--text-secondary);
}
.input, .select {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font-family: inherit;
  font-size: var(--fs-body);
  letter-spacing: var(--ls-normal);
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  transition: border-color var(--dur-fast) var(--ease-out);
  appearance: none;
}
.input::placeholder { color: var(--text-tertiary); }
.input:focus, .select:focus { outline: none; border-color: var(--ink-900); box-shadow: none; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236C655C' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-error {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 0;
  padding: 12px 16px;
  font-size: var(--fs-subhead);
}

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--ink-900); color: var(--text-primary); }
.chip.is-active {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: var(--ivory-50);
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chip-row::-webkit-scrollbar { display: none; }

/* ---------- App frame ---------- */
.app-body { background: var(--bg-app); min-height: 100vh; min-height: 100dvh; }

.app-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: calc(var(--safe-top) + 18px) var(--gutter) calc(var(--tabbar-h) + var(--safe-bottom) + 88px);
}

.screen-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 12px 0 18px;
}
.screen-title {
  font-family: var(--font-display);
  font-size: var(--fs-title-1);
  font-weight: 500;
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
  color: var(--text-primary);
  margin: 0;
}
.screen-title-meta {
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--ivory-50) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 64px;
  padding: 7px 0;
  color: var(--text-tertiary);
  font-size: 8.5px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color var(--dur-fast) var(--ease-out);
}
.tabbar a .material-symbols-rounded { font-size: 23px; }
.tabbar a.is-active { color: var(--ink-900); }
.tabbar a.is-active .material-symbols-rounded { font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24; }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: max(18px, calc(50vw - var(--content-max) / 2 + 18px));
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  z-index: 41;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 0;
  background: var(--ink-900);
  color: var(--ivory-50);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-spring);
}
.fab[hidden] { display: none; }
.fab:hover { background: var(--accent-hover); }
.fab:active { transform: scale(0.94); }
.fab .material-symbols-rounded { font-size: 26px; }

/* ---------- Bottom sheet ---------- */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--scrim);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 61;
  width: min(100%, calc(var(--content-max) + 40px));
  max-height: 88dvh;
  overflow-y: auto;
  transform: translate(-50%, 105%);
  background: var(--ivory-50);
  border-top: 1px solid var(--border-subtle);
  border-radius: 0;
  box-shadow: var(--shadow-sheet);
  padding: 10px var(--gutter) calc(26px + var(--safe-bottom));
  transition: transform var(--dur-slow) var(--ease-spring);
}
.sheet-open .sheet { transform: translate(-50%, 0); }
.sheet-open .sheet-scrim { opacity: 1; }
.sheet-grab {
  width: 36px;
  height: 2px;
  background: var(--surface-sunken);
  margin: 6px auto 18px;
}
.sheet h2 {
  font-family: var(--font-display);
  font-size: var(--fs-title-2);
  font-weight: 500;
  letter-spacing: var(--ls-display);
  margin: 0 0 20px;
}

/* ---------- Weather chip ---------- */
.weather-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  margin-bottom: 18px;
}
.weather-chip .material-symbols-rounded { font-size: 27px; color: var(--accent); }
.weather-chip-title { font-size: var(--fs-footnote); font-weight: var(--fw-medium); color: var(--text-primary); letter-spacing: 0.04em; }
.weather-chip-sub { font-size: var(--fs-caption); color: var(--text-tertiary); }

/* ---------- Search ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  margin-bottom: 14px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.search-bar:focus-within { border-color: var(--ink-900); }
.search-bar .material-symbols-rounded { font-size: 19px; color: var(--stone-500); flex: none; }
.search-bar input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--fs-callout);
  letter-spacing: var(--ls-normal);
  color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-tertiary); }
.search-bar input:focus { outline: none; box-shadow: none; }

/* ---------- Item grid & cards ---------- */
.item-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 14px;
  margin-top: 18px;
}
.item-card { display: flex; flex-direction: column; gap: 7px; cursor: pointer; color: inherit; }
.item-card-photo {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 0;
  overflow: hidden;
  background: linear-gradient(165deg, var(--ivory-200), var(--rose-50));
}
.item-card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-card-placeholder .material-symbols-rounded { font-size: 36px; color: var(--stone-400); }
.item-card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 0;
  background: color-mix(in srgb, var(--ivory-50) 82%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring);
}
.item-card-fav:active { transform: scale(0.85); }
.item-card-fav .material-symbols-rounded { font-size: 16px; color: var(--stone-600); }
.item-card-fav.is-fav .material-symbols-rounded {
  color: var(--accent);
  font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
.item-card-name {
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
  letter-spacing: 0.04em;
  color: var(--text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-card-meta {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ---------- Outfit cards ---------- */
.outfit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px; margin-top: 18px; }
.outfit-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 12px;
  cursor: pointer;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.outfit-card:hover { border-color: var(--ink-900); }
.outfit-card-thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.outfit-card-thumb {
  aspect-ratio: 1;
  border-radius: 0;
  overflow: hidden;
  background: linear-gradient(165deg, var(--ivory-200), var(--rose-50));
  display: flex;
  align-items: center;
  justify-content: center;
}
.outfit-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.outfit-card-thumb .material-symbols-rounded { font-size: 21px; color: var(--stone-400); }
.outfit-card-name {
  font-size: var(--fs-footnote);
  font-weight: var(--fw-medium);
  letter-spacing: 0.04em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.outfit-card-meta {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: -5px;
}

/* ---------- Item multi-select (outfit builder) ---------- */
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0;
  overflow: hidden;
  background: linear-gradient(165deg, var(--ivory-200), var(--rose-50));
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.pick-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-tile .material-symbols-rounded { font-size: 24px; color: var(--stone-400); }
.pick-tile.is-picked { border-color: var(--ink-900); }
.pick-tile.is-picked::after {
  content: 'check';
  font-family: 'Material Symbols Rounded';
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  position: absolute;
  top: 0;
  right: 0;
  width: 22px;
  height: 22px;
  background: var(--ink-900);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pick-tile-name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 6px 5px;
  font-size: 9px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(transparent, rgba(20,16,13,0.66));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Calendar ---------- */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 14px;
}
.cal-month {
  font-family: var(--font-display);
  font-size: var(--fs-title-3);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 6px;
}
.cal-dow span {
  text-align: center;
  font-size: 9px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.16em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day {
  position: relative;
  aspect-ratio: 1 / 1.15;
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  background: var(--ivory-50);
  font-family: inherit;
  font-size: var(--fs-caption);
  font-weight: var(--fw-regular);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 7px;
  gap: 3px;
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.cal-day:hover { border-color: var(--ink-900); }
.cal-day.is-empty { background: transparent; border-color: transparent; cursor: default; }
.cal-day.is-today { border-color: var(--ink-900); background: var(--ink-900); color: var(--ivory-50); }
.cal-day.is-past { color: var(--text-tertiary); }

/* Planned day with a photo: the look fills the cell, lookbook-style */
.cal-day.has-photo { overflow: hidden; }
.cal-day-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cal-day.is-past .cal-day-photo { opacity: 0.55; }
.cal-day.has-photo .cal-day-num {
  position: relative;
  z-index: 1;
  color: #fff;
  font-weight: var(--fw-medium);
  text-shadow: 0 1px 6px rgba(20, 16, 13, 0.55);
}
.cal-day.has-photo::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 46%;
  background: linear-gradient(rgba(20, 16, 13, 0.34), transparent);
  z-index: 1;
  pointer-events: none;
}
.cal-day.has-photo .cal-day-num { z-index: 2; }
.cal-day.has-photo.is-today { box-shadow: inset 0 0 0 2px var(--ink-900); }

/* Planned day without a photo: small marker under the number */
.cal-day-thumb {
  width: 22px;
  height: 22px;
  border-radius: 0;
  overflow: hidden;
  background: var(--accent-soft-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day-thumb .material-symbols-rounded { font-size: 13px; color: var(--accent); }

/* Outfit thumbnails in the day sheet */
.sheet-row-thumb {
  width: 38px;
  height: 38px;
  flex: none;
  overflow: hidden;
  background: linear-gradient(165deg, var(--ivory-200), var(--rose-50));
  display: flex;
  align-items: center;
  justify-content: center;
}
.sheet-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sheet-row-thumb .material-symbols-rounded { font-size: 18px; color: var(--stone-400); }

/* ---------- List rows ---------- */
.list-group {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  overflow: hidden;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 13px 16px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  font-family: inherit;
  font-size: var(--fs-callout);
  letter-spacing: var(--ls-normal);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-muted); }
.list-row .material-symbols-rounded { color: var(--text-secondary); font-size: 21px; }
.list-row-label { flex: 1; min-width: 0; }
.list-row-value {
  color: var(--text-tertiary);
  font-size: var(--fs-caption);
  letter-spacing: 0.08em;
}
.list-row .chevron { color: var(--stone-400); font-size: 19px; }

/* ---------- Badges / stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 0;
  padding: 16px 10px;
  text-align: center;
}
.stat-num {
  font-family: var(--font-display);
  font-size: var(--fs-title-2);
  font-weight: 500;
}
.stat-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-size: 9.5px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---------- Empty states ---------- */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-tertiary);
}
.empty-state .material-symbols-rounded { font-size: 40px; color: var(--stone-400); margin-bottom: 14px; }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--fs-title-2);
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0 0 6px;
}
.empty-state p { font-size: var(--fs-subhead); margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  transform: translate(-50%, 20px);
  z-index: 70;
  background: var(--ink-900);
  color: var(--ivory-100);
  font-size: var(--fs-caption);
  font-weight: var(--fw-medium);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 13px 24px;
  border-radius: 0;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  max-width: calc(100vw - 40px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Item detail ---------- */
.detail-photo {
  aspect-ratio: 3 / 4;
  max-height: 46vh;
  width: 100%;
  border-radius: 0;
  overflow: hidden;
  background: linear-gradient(165deg, var(--ivory-200), var(--rose-50));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-photo .material-symbols-rounded { font-size: 52px; color: var(--stone-400); }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px var(--gutter);
}
.auth-card { width: min(100%, 400px); }
.auth-logo { height: 46px; width: auto; display: block; margin: 0 auto 18px; }
.auth-title {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 500;
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
  text-align: center;
  margin: 0 0 8px;
}
.auth-sub { text-align: center; color: var(--text-secondary); font-size: var(--fs-callout); margin: 0 0 30px; }
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-alt { text-align: center; font-size: var(--fs-subhead); color: var(--text-secondary); margin-top: 22px; }
