/* "Utgå från ditt kök": upload dialog, interpretation panel, the "Ditt kök"
   pill and the photo viewer. Dialog chrome comes from the account dialogs. */
:root {
  --kp-ink: #2b2520;
  --kp-muted: #6f6459;
  --kp-line: rgba(105, 91, 74, 0.18);
  --kp-soft: #f6f2ec;
  --kp-brown: #5c4a37;
  --kp-radius: 5px;
  --kp-panel-top: calc(var(--material-ui-scene-top-offset, 12px) + 66px);
}

/* ---- Dialog ---- */
.kitchen-photo-modal .kitchen-photo-dialog { width: min(620px, calc(100vw - 32px)); }
.kitchen-photo-content { padding: 0 22px 22px; display: grid; gap: 16px; }
.kitchen-photo-dialog .user-account-primary,
.kitchen-photo-dialog .user-account-secondary,
.kitchen-photo-summary .user-account-primary {
  min-height: 42px;
  padding: 9px 18px;
  border-radius: var(--kp-radius);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.2;
  box-shadow: none;
}
.kitchen-photo-dialog .user-account-primary,
.kitchen-photo-summary .user-account-primary { border-color: #5c4a37f5; background: #5c4a37f5; color: #fff; }
.kitchen-photo-dialog .user-account-secondary { border-color: rgba(91, 75, 58, 0.35); background: transparent; color: var(--kp-brown); }

.kitchen-photo-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  counter-reset: none;
}
.kitchen-photo-step {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--kp-muted);
  font-size: 13px;
  line-height: 1.2;
}
.kitchen-photo-step::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  min-width: 6px;
  background: var(--kp-line);
}
.kitchen-photo-step:last-child::after { display: none; }
.kitchen-photo-step__number {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(105, 91, 74, 0.35);
  font-size: 12px;
}
.kitchen-photo-step__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kitchen-photo-step.is-current { color: var(--kp-ink); font-weight: 600; }
.kitchen-photo-step.is-current .kitchen-photo-step__number { border-color: var(--kp-brown); background: var(--kp-brown); color: #fff; }
.kitchen-photo-step.is-done .kitchen-photo-step__number { border-color: var(--kp-brown); color: var(--kp-brown); }

.kitchen-photo-view[hidden] { display: none; }
.kitchen-photo-view { display: grid; gap: 14px; }
.kitchen-photo-lead { margin: 0; color: var(--kp-muted); font-size: 15px; line-height: 1.5; }

.kitchen-photo-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 18px;
  border: 1.5px dashed rgba(105, 91, 74, 0.4);
  border-radius: var(--kp-radius);
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.kitchen-photo-drop:hover,
.kitchen-photo-drop.is-over { border-color: var(--kp-brown); background: var(--kp-soft); }
.kitchen-photo-drop:focus-within { outline: 2px solid var(--kp-brown); outline-offset: 2px; }
.kitchen-photo-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.kitchen-photo-drop__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--kp-soft);
  color: var(--kp-brown);
  font-size: 20px;
}
.kitchen-photo-drop__title { font-size: 16px; font-weight: 600; color: var(--kp-ink); }
.kitchen-photo-drop__hint { max-width: 380px; font-size: 13px; line-height: 1.45; color: var(--kp-muted); }

.kitchen-photo-tips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kitchen-photo-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: var(--kp-radius);
  background: var(--kp-soft);
  font-size: 13px;
  line-height: 1.35;
  color: var(--kp-ink);
}
.kitchen-photo-tip i { margin-top: 2px; color: var(--kp-brown); }
.kitchen-photo-privacy { display: flex; gap: 8px; margin: 0; font-size: 12px; line-height: 1.45; color: var(--kp-muted); }
.kitchen-photo-privacy i { margin-top: 2px; }

.kitchen-photo-preview {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--kp-radius);
  background: #1f1a15;
}
.kitchen-photo-preview__img { display: block; width: 100%; max-height: min(46vh, 420px); object-fit: contain; transition: opacity 260ms ease, filter 260ms ease; }
.kitchen-photo-preview.is-busy .kitchen-photo-preview__img { opacity: 0.35; filter: blur(2px) saturate(0.7); }
.kitchen-photo-progress { display: none; }
.kitchen-photo-preview.is-busy .kitchen-photo-progress {
  position: absolute;
  inset: auto 16px 16px;
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--kp-radius);
  background: rgba(251, 250, 247, 0.96);
  box-shadow: 0 10px 30px rgba(18, 12, 8, 0.25);
}
.kitchen-photo-progress__bar { height: 4px; border-radius: 999px; background: rgba(91, 71, 52, 0.14); overflow: hidden; }
.kitchen-photo-progress__bar > span {
  display: block;
  width: calc(var(--kitchen-photo-progress, 0.1) * 100%);
  height: 100%;
  border-radius: inherit;
  background: var(--kp-brown);
  transition: width 560ms cubic-bezier(0.22, 1, 0.36, 1);
}
.kitchen-photo-progress__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.kitchen-photo-progress__row { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 10px; font-size: 14px; color: var(--kp-ink); opacity: 0.42; }
.kitchen-photo-progress__row.is-current { opacity: 1; font-weight: 600; }
.kitchen-photo-progress__row.is-done { opacity: 0.72; }
.kitchen-photo-progress__icon { position: relative; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(91, 71, 52, 0.3); box-sizing: border-box; }
.kitchen-photo-progress__row.is-current .kitchen-photo-progress__icon { border-color: var(--kp-brown); border-top-color: transparent; animation: kitchen-photo-spin 0.9s linear infinite; }
.kitchen-photo-progress__row.is-done .kitchen-photo-progress__icon { border-color: var(--kp-brown); background: var(--kp-brown); }
.kitchen-photo-progress__row.is-done .kitchen-photo-progress__icon::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
@keyframes kitchen-photo-spin { to { transform: rotate(360deg); } }

.kitchen-photo-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; }
.kitchen-photo-actions [hidden] { display: none; }
.kitchen-photo-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 8px 4px;
  color: var(--kp-brown);
  font: inherit;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.kitchen-photo-error {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--kp-radius);
  background: #fbefed;
  color: #8a2a1f;
  font-size: 14px;
  line-height: 1.4;
}
.kitchen-photo-error[hidden] { display: none; }
.kitchen-photo-error i { margin-top: 2px; }

/* ---- Interpretation panel (beside the scene like the AI assistant) ---- */
.kitchen-photo-summary {
  position: fixed;
  top: var(--kp-panel-top);
  left: calc(12px + env(safe-area-inset-left));
  z-index: 10050;
  width: min(392px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--kp-panel-top) - 92px);
  display: flex;
  flex-direction: column;
  color: var(--kp-ink);
  background: rgba(255, 255, 255, 0.97);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--kp-line);
  border-radius: var(--kp-radius);
  box-shadow: 0 18px 48px rgba(43, 37, 32, 0.18), 0 2px 6px rgba(43, 37, 32, 0.08);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}
.kitchen-photo-summary[hidden] { display: none; }
.kitchen-photo-summary.is-open { opacity: 1; transform: none; }
.kitchen-photo-summary.is-busy .kitchen-photo-summary__body { opacity: 0.6; pointer-events: none; }
.kitchen-photo-summary__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 10px 10px 16px;
  border-bottom: 1px solid var(--kp-line);
}
.kitchen-photo-summary__title { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.25; }
.kitchen-photo-icon-button {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--kp-radius);
  background: transparent;
  color: var(--kp-muted);
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.kitchen-photo-icon-button:hover { background: var(--kp-soft); color: var(--kp-ink); }
.kitchen-photo-summary__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 6px; display: grid; gap: 12px; align-content: start; }
.kitchen-photo-summary__top { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: start; }
.kitchen-photo-thumb {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: var(--kp-radius);
  overflow: hidden;
  background: #1f1a15;
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
}
.kitchen-photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kitchen-photo-thumb__zoom {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--kp-brown);
  font-size: 12px;
}
.kitchen-photo-facts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; font-size: 13px; line-height: 1.35; }
.kitchen-photo-facts dt { color: var(--kp-muted); }
.kitchen-photo-facts dd { margin: 0; font-weight: 600; }
.kitchen-photo-summary__heading { margin: 4px 0 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #8a7d6d; }
.kitchen-photo-items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kitchen-photo-item { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kitchen-photo-item__swatch {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--kp-radius);
  border: 1px solid var(--kp-line);
  background: var(--kp-soft);
  color: var(--kp-brown);
}
.kitchen-photo-item__swatch img { width: 100%; height: 100%; object-fit: cover; }
.kitchen-photo-item__text { display: flex; flex-direction: column; min-width: 0; }
.kitchen-photo-item__text small { font-size: 11px; color: var(--kp-muted); line-height: 1.2; }
.kitchen-photo-item__text strong { font-size: 13px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kitchen-photo-seen { margin: 0; font-size: 12px; line-height: 1.45; color: var(--kp-muted); }
.kitchen-photo-seen span { font-weight: 600; }
.kitchen-photo-notice {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--kp-radius);
  background: #fbf3e6;
  color: #6b4a1f;
  font-size: 13px;
  line-height: 1.4;
}
.kitchen-photo-notice.is-error { background: #fbefed; color: #8a2a1f; }
.kitchen-photo-notice i { margin-top: 2px; }
.kitchen-photo-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.kitchen-photo-chip-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--kp-line);
  border-radius: var(--kp-radius);
  background: #fff;
  color: var(--kp-ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  padding: 8px 12px;
  cursor: pointer;
}
.kitchen-photo-chip-button i { color: var(--kp-brown); }
.kitchen-photo-chip-button:hover { background: var(--kp-soft); border-color: rgba(105, 91, 74, 0.32); }
.kitchen-photo-chip-button:disabled { opacity: 0.6; cursor: progress; }
.kitchen-photo-summary__footer { display: grid; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--kp-line); }
.kitchen-photo-summary__footer .user-account-primary { width: 100%; }
.kitchen-photo-summary__note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--kp-muted); text-align: center; }

/* ---- "Ditt kök" pill ---- */
.kitchen-photo-pill {
  position: fixed;
  top: var(--kp-panel-top);
  left: calc(12px + env(safe-area-inset-left));
  z-index: 10030;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 6px;
  border: 1px solid rgba(105, 91, 74, 0.22);
  border-radius: var(--kp-radius);
  background: #fff;
  box-shadow: var(--mui-shadow-lg, 0 8px 24px rgba(43, 37, 32, 0.14));
  color: var(--kp-ink);
}
.kitchen-photo-pill[hidden] { display: none; }
.kitchen-photo-pill__thumb {
  flex: none;
  width: 52px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #1f1a15;
  cursor: pointer;
}
.kitchen-photo-pill__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kitchen-photo-pill__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.kitchen-photo-pill__text strong { font-size: 14px; font-weight: 600; }
.kitchen-photo-pill__text small { font-size: 12px; color: var(--kp-muted); }
.kitchen-photo-pill__create {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--kp-radius);
  background: #5c4a37f5;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
  cursor: pointer;
}
.kitchen-photo-pill__create:hover { background: #4e3e2d; }
.kitchen-photo-pill__more { width: 34px; height: 38px; }
.kitchen-photo-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--kp-line);
  border-radius: var(--kp-radius);
  background: #fff;
  box-shadow: 0 14px 36px rgba(43, 37, 32, 0.18);
}
.kitchen-photo-menu[hidden] { display: none; }
.kitchen-photo-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--kp-ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.kitchen-photo-menu__item i { width: 16px; color: var(--kp-brown); }
.kitchen-photo-menu__item:hover { background: var(--kp-soft); }

/* ---- Photo viewer ---- */
.kitchen-photo-viewer { flex-direction: column; gap: 12px; }
.kitchen-photo-viewer__img { max-width: min(1200px, 100%); max-height: calc(100dvh - 120px); object-fit: contain; background: #fff; padding: 8px; box-sizing: border-box; }
.kitchen-photo-viewer__close {
  appearance: none;
  border: 0;
  background: none;
  color: #fff;
  font: inherit;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

@media (max-width: 680px) {
  .kitchen-photo-content { padding: 0 16px 20px; }
  .kitchen-photo-step__label { display: none; }
  .kitchen-photo-step.is-current .kitchen-photo-step__label { display: inline; }
  .kitchen-photo-steps { grid-template-columns: auto auto auto auto; justify-content: start; }
  .kitchen-photo-tips { grid-template-columns: 1fr; }
  .kitchen-photo-tip { padding: 8px 10px; }
  .kitchen-photo-actions .user-account-primary { flex: 1 1 auto; }
  .kitchen-photo-summary {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: min(78dvh, calc(100dvh - var(--kp-panel-top)));
    border-radius: 5px 5px 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(24px);
    box-shadow: 0 -12px 40px rgba(43, 37, 32, 0.2);
    background: #fff;
  }
  .kitchen-photo-items { grid-template-columns: 1fr; }
  .kitchen-photo-pill { top: auto; bottom: calc(72px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
  .kitchen-photo-pill__text small { display: none; }
  .kitchen-photo-pill__create { flex: 1 1 auto; justify-content: center; padding: 8px 10px; }
  .kitchen-photo-menu { top: auto; bottom: calc(100% + 6px); }
}

@media (prefers-reduced-motion: reduce) {
  .kitchen-photo-summary { transition: none; }
  .kitchen-photo-progress__row.is-current .kitchen-photo-progress__icon { animation: none; }
}
