/* Document AI UI shell */
.document-ai-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1rem);
  width: var(--shopping-composer-width);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.5rem) 0;
  border: 0.0625rem solid #bfdbfe;
  border-radius: clamp(1rem, 3vw, 1.5rem);
  background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 58%, #ffffff 100%);
  box-shadow: 0 clamp(0.5rem, 2vw, 1rem) clamp(1.5rem, 5vw, 2.5rem) rgba(37, 99, 235, 0.08);
}

.ai-mode-eyebrow {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(0.28rem, 1vw, 0.4rem);
  margin: 0;
  margin-inline-start: clamp(0.85rem, 2.6vw, 1.35rem);
  padding: clamp(0.28rem, 1vw, 0.38rem) clamp(0.58rem, 1.8vw, 0.78rem);
  border: 0.0625rem solid var(--ai-mode-eyebrow-border, #dbeafe);
  border-radius: 999rem;
  background: var(--ai-mode-eyebrow-bg, #eff6ff);
  color: var(--ai-mode-eyebrow-text, #1d4ed8);
  font-size: clamp(0.78rem, 1.8vw, 0.88rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
  font-family: inherit;
  appearance: none;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.ai-mode-eyebrow:hover {
  border-color: color-mix(in srgb, var(--ai-mode-eyebrow-text, #1d4ed8) 34%, var(--ai-mode-eyebrow-border, #dbeafe));
  box-shadow: 0 clamp(0.16rem, 0.7vw, 0.25rem) clamp(0.5rem, 1.5vw, 0.75rem) color-mix(in srgb, var(--ai-mode-eyebrow-text, #1d4ed8) 12%, transparent);
}

.ai-mode-eyebrow:focus-visible {
  outline: clamp(0.12rem, 0.4vw, 0.16rem) solid color-mix(in srgb, var(--ai-mode-eyebrow-text, #1d4ed8) 46%, transparent);
  outline-offset: clamp(0.12rem, 0.4vw, 0.18rem);
}

.ai-mode-eyebrow:active {
  transform: translateY(clamp(0.03rem, 0.2vw, 0.06rem));
}

.ai-mode-eyebrow-world-icon {
  flex: 0 0 auto;
  inline-size: 0.875rem;
  block-size: 0.875rem;
  color: currentColor;
  opacity: 0.72;
  stroke: currentColor;
}

.ai-mode-eyebrow-document-ai {
  --ai-mode-eyebrow-border: #bfdbfe;
  --ai-mode-eyebrow-bg: #eff6ff;
  --ai-mode-eyebrow-text: #1d4ed8;
}

.ai-mode-eyebrow-instant-answer {
  --ai-mode-eyebrow-border: #fde68a;
  --ai-mode-eyebrow-bg: #fffbeb;
  --ai-mode-eyebrow-text: #92400e;
}

.ai-mode-eyebrow-web-search {
  --ai-mode-eyebrow-border: #bae6fd;
  --ai-mode-eyebrow-bg: #f0f9ff;
  --ai-mode-eyebrow-text: #0369a1;
}

.ai-mode-eyebrow-loveme {
  --ai-mode-eyebrow-border: #fbcfe8;
  --ai-mode-eyebrow-bg: #fdf2f8;
  --ai-mode-eyebrow-text: #be185d;
}

.ai-mode-eyebrow-home-meal {
  --ai-mode-eyebrow-border: #bbf7d0;
  --ai-mode-eyebrow-bg: #f0fdf4;
  --ai-mode-eyebrow-text: #15803d;
}

.ai-mode-eyebrow-babsim {
  --ai-mode-eyebrow-border: #fed7aa;
  --ai-mode-eyebrow-bg: #fff7ed;
  --ai-mode-eyebrow-text: #ea580c;
}

.document-ai-copy {
  display: flex;
  flex-direction: column;
  gap: clamp(0.35rem, 1vw, 0.5rem);
}

.document-ai-composer-shell,
.document-ai-scroll-pane {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 2vw, 1rem);
}

.document-ai-main-copy,
.document-ai-sub-copy {
  margin: 0;
  color: #475569;
  line-height: 1.65;
}

.document-ai-main-copy {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 600;
}

.document-ai-sub-copy,
.document-ai-privacy p,
.document-ai-upload-copy,
.document-ai-question-label,
.document-ai-placeholder {
  font-size: clamp(0.88rem, 2vw, 1rem);
}

.document-ai-composer {
  display: flex;
  flex-direction: column;
  gap: var(--shopping-composer-row-gap);
  width: 100%;
  padding: var(--shopping-composer-padding-block) var(--shopping-composer-padding-inline);
  border: 0.09375rem solid #bfdbfe;
  border-radius: var(--shopping-composer-radius);
  background: #ffffff;
  box-shadow: var(--composer-focus-shadow);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.document-ai-composer.is-drag-over {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.14);
  transform: translateY(-0.125rem);
}

.document-ai-supported-hint {
  font-size: clamp(0.75rem, 1.8vw, 0.8125rem);
  color: #64748b;
  line-height: 1.4;
  width: 100%;
  margin-top: max(-0.2rem, -0.6vw);
  padding: 0 var(--shopping-composer-padding-inline);
}

.document-ai-composer-top {
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.5vw, 0.7rem);
}

.document-ai-composer-bottom,
.document-ai-composer-left-actions,
.document-ai-composer-right-actions {
  display: flex;
  align-items: center;
  gap: var(--shopping-composer-control-gap);
}

.document-ai-composer-bottom {
  justify-content: space-between;
  width: 100%;
  flex-wrap: nowrap;
}

.document-ai-composer-left-actions,
.document-ai-composer-right-actions {
  min-width: 0;
  flex-wrap: nowrap;
}

.document-ai-composer-left-actions {
  flex: 1 1 auto;
  justify-content: flex-start;
}

.document-ai-composer-right-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.document-ai-upload-title {
  color: #1e3a8a;
  font-size: clamp(0.95rem, 2.2vw, 1.05rem);
  font-weight: 700;
}

.document-ai-upload-copy {
  max-width: min(100%, clamp(18rem, 60vw, 32rem));
  color: #475569;
  line-height: 1.55;
}

.document-ai-upload-action,
.document-ai-help-button,
.document-ai-submit {
  border: 0;
  border-radius: 999rem;
  font-size: clamp(0.88rem, 2vw, 1rem);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.document-ai-upload-action,
.document-ai-help-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: var(--shopping-composer-left-button-size);
  block-size: var(--shopping-composer-left-button-size);
  padding: 0;
  border: 0.0625rem solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  line-height: 1;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.document-ai-help-button {
  background: #ffffff;
  color: #2563eb;
}

.document-ai-upload-action:hover,
.document-ai-upload-action:focus-visible,
.document-ai-help-button:hover,
.document-ai-help-button:focus-visible {
  border-color: #60a5fa;
  background: #dbeafe;
  box-shadow: 0 0 0 clamp(0.12rem, 0.5vw, 0.2rem) rgba(37, 99, 235, 0.12);
  outline: none;
}


.document-ai-help-button,
.instant-answer-help-button,
.web-search-help-button,
.loveme-help-button,
.home-meal-help-button {
  margin-left: auto;
  inline-size: var(--shopping-composer-right-button-size);
  block-size: var(--shopping-composer-right-button-size);
}

.document-ai-privacy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.35rem, 1vw, 0.5rem);
  padding: clamp(0.85rem, 2.5vw, 1.1rem);
  border-radius: clamp(0.8rem, 2vw, 1rem);
  background: #ffffff;
  color: #475569;
  text-align: center;
}

.document-ai-privacy strong,
.document-ai-privacy p {
  max-width: min(100%, clamp(18rem, 72vw, 36rem));
}

.document-ai-privacy strong {
  color: #2563eb;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
}

.document-ai-privacy p {
  margin: 0;
  line-height: 1.6;
}

.document-ai-question-label {
  color: #334155;
  font-weight: 700;
}

.document-ai-question {
  width: 100%;
  min-height: auto;
  block-size: auto;
  padding: clamp(0.7rem, 2vw, 0.9rem) 0;
  border: 0;
  background: transparent;
  color: #1e293b;
  font: inherit;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  line-height: 1.55;
  resize: none;
  overflow: hidden;
}

.document-ai-question:focus {
  outline: none;
}

.document-ai-submit {
  align-self: flex-end;
  padding: clamp(0.75rem, 2vw, 0.95rem) clamp(1.25rem, 4vw, 1.75rem);
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.document-ai-placeholder {
  margin: 0;
  padding: clamp(0.8rem, 2vw, 1rem);
  border-radius: clamp(0.8rem, 2vw, 1rem);
  background: #e0f2fe;
  color: #0f172a;
  line-height: 1.65;
  white-space: pre-line;
}

.document-ai-help-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.4vw, 0.75rem);
  padding: clamp(0.75rem, 2vw, 1rem);
  border: 0.0625rem solid #dbeafe;
  border-radius: clamp(0.85rem, 2vw, 1rem);
  background: #ffffff;
}

.document-ai-help-panel[hidden] {
  display: none;
}

.document-ai-help-title {
  margin: 0;
  color: #1d4ed8;
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-weight: 800;
}

.document-ai-help-examples {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.45rem, 1.2vw, 0.65rem);
}

.document-ai-help-examples button {
  padding: clamp(0.5rem, 1.4vw, 0.65rem) clamp(0.7rem, 2vw, 0.9rem);
  border: max(0.0625rem, 0.06vw) solid #bfdbfe;
  border-radius: 50vw;
  background: #eff6ff;
  color: #1d4ed8;
  font-family: inherit;
  font-size: clamp(0.82rem, 1.8vw, 0.95rem);
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  text-align: left;
}

.document-ai-help-examples button:hover,
.document-ai-help-examples button:focus-visible {
  border-color: #60a5fa;
  background: #dbeafe;
  outline: none;
}

@media (max-width: 640px) {
  .document-ai-panel {
    width: 95%;
    padding: clamp(0.9rem, 4vw, 1.15rem) 0;
  }

  .document-ai-composer {
    padding: var(--shopping-composer-padding-block) var(--shopping-composer-padding-inline);
  }

  .document-ai-composer-bottom {
    gap: var(--shopping-composer-control-gap);
  }

  .document-ai-submit {
    align-self: auto;
  }
}

/* Document AI entry toolbar */
.document-ai-entry-wrap {
  display: flex;
  justify-content: flex-start;
  width: min(90%, clamp(20rem, 50vw, 56.25rem));
  margin: clamp(0.75rem, 2vw, 1rem) auto 0;
  padding-bottom: clamp(0.65rem, 1.5vw, 0.9rem);
  border-bottom: 0.0625rem solid #e2e8f0;
}

.document-ai-entry-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.4rem, 1vw, 0.65rem);
  width: auto;
  padding: clamp(0.6rem, 1.5vw, 0.75rem) clamp(0.85rem, 2.5vw, 1.1rem);
  border: 0.0625rem solid #bfdbfe;
  border-radius: clamp(0.65rem, 1vw, 0.75rem);
  background: #eff6ff;
  color: #1e3a8a;
  box-shadow: 0 clamp(0.25rem, 1vw, 0.5rem) clamp(0.75rem, 2vw, 1rem) rgba(37, 99, 235, 0.08);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.document-ai-entry-chip:hover,
.document-ai-entry-chip:focus-visible {
  border-color: #60a5fa;
  box-shadow: 0 clamp(0.35rem, 1.5vw, 0.65rem) clamp(1rem, 3vw, 1.5rem) rgba(37, 99, 235, 0.12);
  transform: translateY(-0.0625rem);
  outline: none;
}

.document-ai-entry-label {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 700;
  white-space: nowrap;
}


body.search-mode .document-ai-entry-wrap {
  display: none !important;
}

@media (max-width: 640px) {
  .landing-view {
    display: flex;
    flex-direction: column;
  }

  .welcome-section {
    display: none;
  }

  .shopping-home-container .welcome-section {
    display: block;
  }

  body:not(.search-mode):not(.ai-tool-mode) .shopping-home-container .rounded-headline {
    margin-block-start: clamp(0.75rem, 2.5vh, 1.125rem);
  }

  body:not(.search-mode):not(.ai-tool-mode) .shopping-home-container .welcome-sub-headline {
    margin-block-end: clamp(0.6rem, 1.75vh, 0.9rem);
  }

  .document-ai-entry-wrap {
    display: none;
  }

  .search-wrap {
    order: 2;
  }

  .trending-section {
    order: 3;
    margin-top: clamp(0.75rem, 3vw, 1rem);
  }

  body:not(.search-mode):not(.ai-tool-mode) .shopping-home-container .trending-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: clamp(0.38rem, 1.8vw, 0.58rem);
    inline-size: min(100%, clamp(20rem, 96vw, 25rem));
    margin-inline: auto;
  }

  body:not(.search-mode):not(.ai-tool-mode) .shopping-home-container .trending-list .chip {
    flex: 0 1 clamp(6.2rem, 28vw, 7.5rem);
    max-inline-size: 100%;
    justify-content: center;
    text-align: center;
    padding: clamp(0.5rem, 2.2vw, 0.62rem) clamp(0.55rem, 2.4vw, 0.78rem) !important;
    font-size: clamp(0.78rem, 3.1vw, 0.88rem) !important;
    gap: clamp(0.24rem, 1vw, 0.38rem) !important;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .document-ai-entry-chip {
    flex: 1 1 calc((100% - clamp(0.45rem, 2vw, 0.7rem) * 2) / 3);
    min-inline-size: max(28%, 5.75rem);
    min-block-size: clamp(2.5rem, 11vw, 3rem);
    width: auto;
    padding: clamp(0.55rem, 2.4vw, 0.7rem) clamp(0.72rem, 3vw, 0.95rem);
  }
}

