@import url(corporate_colors.css);

/* Top layout after the first search replaces the hero image. */
#search-container:not(.image-container) {
  width: 98vw;
  margin: clamp(26px, 2.4vw, 40px) auto 0;
}

#search-container:not(.image-container) > div {
  width: 100%;
}

#search-container:not(.image-container) .grid-2x2 {
  gap: clamp(14px, 1.4vw, 22px) clamp(18px, 1.8vw, 28px);
}

#search-container:not(.image-container) #search-bar {
  flex-wrap: nowrap;
}

/* Shared section shells used by AI overview, search results, and feedback. */
.overlay-box-blue,
.overlay-box-gray {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 98vw;
  margin-top: clamp(16px, 1.4vw, 24px);
  padding-block: clamp(16px, 1.3vw, 22px);
  gap: clamp(14px, 1.2vw, 20px);
}

.overlay-box-blue {
  background: linear-gradient(180deg, #d6e3f4 0%, var(--light-blue) 100%);
}

.overlay-box-gray {
  background: linear-gradient(180deg, #f2f4f7 0%, var(--grey) 100%);
}

.overlay-box-white {
  width: calc(100% - 36px);
  padding: clamp(16px, 1.3vw, 22px);
  background-color: #f7faff;
  border: 1px solid #edf1f6;
  border-radius: 8px;
}

#all-content > .overlay-box-blue:last-of-type {
  background: linear-gradient(180deg, #dff0b1 0%, var(--green) 100%);
}

#ai-header,
#search-header,
#feedback-header {
  margin: 0 auto;
  font-size: clamp(1.45rem, 1.8vw, 2rem);
  font-weight: 600;
  text-align: center;
  color: var(--dark-blue);
}

/* Search controls */
#search-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: clamp(10px, 1vw, 16px);
  margin: 0;
  padding: 0;
  grid-area: search;
}

#store-dropdown,
.search-engine-button {
  flex: 0 0 auto;
}

#store-select {
  min-width: 180px;
  margin: 0;
}

.search-engine-button {
  font-size: clamp(0.92rem, 1vw, 1.08rem);
}

/* AI overview */
#AI-answer {
  width: 100%;
  box-sizing: border-box;
  font-size: clamp(1.05rem, 1.08vw, 1.18rem);
  line-height: 1.7;
}

#AI-disclamer {
  font-size: clamp(0.9rem, 0.9vw, 1rem);
  font-style: italic;
}

#ai-helpful-question {
  font-size: clamp(1.05rem, 1.1vw, 1.22rem);
}

.scale-button {
  flex: 1 1 auto;
  margin: 0;
  padding: clamp(5px, 0.5vw, 8px) clamp(10px, 0.9vw, 14px);
  font-size: clamp(0.82rem, 0.7vw, 0.92rem);
  background-color: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.scale-button.active {
  color: var(--text);
  background-color: var(--light-blue);
  border-color: #9fb3d8;
}

#rating-scale {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  width: calc(100% - 20px);
  margin: 0 auto;
  gap: 8px;
}

.black-line {
  width: 90%;
  height: 1px;
  background-color: #d7dce4;
}

/* Search results */
#search-results {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: clamp(16px, 1.4vw, 22px);
  padding: 0 0 clamp(16px, 1.4vw, 24px);
  gap: clamp(14px, 1.3vw, 22px);
  box-sizing: border-box;
}

.chunkbox {
  width: calc(100% - 36px);
  max-width: calc(100% - 36px);
  border: 1px solid lightgray;
  border-radius: var(--radius);
  background-color: #fbfcfe;
  overflow: hidden;
}

.chunk-box-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  padding: clamp(10px, 0.9vw, 14px) clamp(14px, 1.2vw, 20px);
  gap: clamp(10px, 1vw, 16px);
  text-align: left;
  color: white;
  background-color: var(--dark-blue);
  border-bottom: 1px solid #022f55;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  box-sizing: border-box;
  cursor: pointer;
}

/* Keeps chunk text fully collapsed until a result is opened. */
.chunk-text-box {
  width: 100%;
  max-height: 0;
  padding-inline: clamp(16px, 1.4vw, 24px);
  overflow: hidden;
  color: var(--text);
  background-color: white;
  box-sizing: border-box;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

/* Adds bottom spacing only while the chunk body is expanded. */
.chunk-text-box.is-open {
  padding-bottom: clamp(14px, 1.2vw, 20px);
}

.chunk-metadata-box {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: 100%;
  min-height: clamp(64px, 5vw, 88px);
  gap: clamp(10px, 1vw, 16px);
  text-align: left;
}

.left {
  min-width: 0;
  padding-left: clamp(16px, 1.4vw, 24px);
  overflow-wrap: anywhere;
}

.right {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  text-align: center;
}

.arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  color: white;
  background-color: transparent;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.feedback-button-container {
  display: flex;
  gap: 8px;
  margin-top: 7px;
  padding-right: clamp(8px, 1vw, 14px);
}

.vote-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 0.9vw, 14px);
  color: white;
  background: var(--dark-blue);
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.voteup.active,
.voteneutral.active,
.votedown.active {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35) inset;
  transform: scale(1.08);
}

.voteup.active {
  background: #b9d25f;
}

.voteneutral.active {
  background: #939304;
}

.votedown.active {
  background: #c93434;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.chunkbox.citation-highlight {
  box-shadow: 0 0 0 3px #b9d25f, 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

.citation-link {
  color: var(--dark-blue);
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.citation-link:hover {
  color: #045a9a;
  text-decoration: underline;
}

/* Shared two-column content layout for overview and feedback rows. */
.grid-1x2 {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  width: 100%;
  min-height: clamp(70px, 6vw, 100px);
  gap: clamp(10px, 1vw, 16px);
  text-align: left;
}

/* Feedback form */
#feedback-content {
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.45fr);
  align-items: stretch;
  gap: clamp(18px, 1.8vw, 30px);
}

#feedback-questions {
  align-self: center;
  padding-left: 20px;
  padding-right: 10px;
  font-size: clamp(1rem, 1vw, 1.12rem);
}

#feedback-questions ul {
  margin: 0;
  padding-left: clamp(18px, 1.6vw, 28px);
}

#feedback-questions li + li {
  margin-top: 10px;
}

/* Ensures the comment column can grow instead of being constrained by content width. */
#feedback-comment-column {
  display: flex;
  min-width: 0;
  align-items: stretch;
}

/* Lets the feedback textarea use the full width of its grid column. */
#ai-summary-feedback-box {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-height: 100%;
}

#ai-summary-feedback-input {
  display: block;
  width: 100%;
  min-height: clamp(120px, 14vw, 180px);
  box-sizing: border-box;
  line-height: 1.6;
  resize: vertical;
}

/* Keeps the submit button centered without forcing it full-width. */
#submit-feedback-box {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 0;
  padding-top: 0;
}

#submit-feedback {
  min-width: 0;
  justify-content: center;
  flex: 0 0 auto;
}

#submit-feedback:disabled {
  background-color: #ccc;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Utility areas */
[id="debug box"] {
  width: 98vw;
  margin-top: clamp(18px, 1.6vw, 26px);
  gap: 8px;
}

[id="debug box"] h3,
[id="debug box"] p {
  margin: 0;
}

[id="debug box"] p + p {
  margin-top: 4px;
}

#page-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  background-color: rgba(0, 0, 0, 0.8);
}

#page-overlay.hidden {
  display: none;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--dark-blue);
}

@media (max-width: 900px) {
  #search-bar {
    flex-direction: column;
    align-items: stretch;
  }

  #search-container:not(.image-container),
  .overlay-box-blue,
  .overlay-box-gray {
    width: calc(100vw - 16px);
  }

  .overlay-box-white {
    width: calc(100% - 24px);
  }

  .chunkbox {
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
  }

  #feedback-content {
    grid-template-columns: 1fr;
  }

  #ai-summary-feedback-input {
    min-height: 140px;
  }
}
