/* GWC Knowledge Hub Ingestion UI — layout and visual styles */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1a1a1a;
  background: linear-gradient(180deg, #b8e4e8 0%, #9fd4d9 40%, #8ec9cf 100%);
  background-attachment: fixed;
}

/* Decorative wave pattern at bottom of viewport */
body::after {
  content: "";
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath fill='%237ab8be' fill-opacity='0.35' d='M0,60 C200,100 400,20 600,60 C800,100 1000,20 1200,60 L1200,120 L0,120 Z'/%3E%3Cpath fill='%236aabaf' fill-opacity='0.25' d='M0,80 C300,40 500,100 800,70 C950,55 1100,90 1200,75 L1200,120 L0,120 Z'/%3E%3C/svg%3E")
    no-repeat bottom center;
  background-size: 100% 100%;
  pointer-events: none;
  z-index: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

.card {
  width: 100%;
  max-width: 640px;
  background: #fff;
  padding: 2rem 2.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* View visibility — only one active at a time */
.view {
  display: none;
}

.view.active {
  display: block;
}

h1 {
  margin: 0 0 1rem;
  font-size: 1.75rem;
  font-weight: 700;
}

h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.intro p {
  margin: 0 0 0.75rem;
}

/* Form fields */
.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.field label .required,
.required {
  color: #c0392b;
}

.intro .mandatory-note {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #444;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  font: inherit;
  background: #f5f5f5;
}

.field select[multiple] {
  min-height: 6rem;
}

.field textarea {
  min-height: 5rem;
  resize: vertical;
}

.field .hint {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: #555;
}

.field.readonly .value {
  padding: 0.35rem 0;
  color: #333;
}

.field.error input,
.field.error select,
.field.error textarea,
.field.error .upload-zone {
  border-color: #c0392b;
}

.file-upload-error {
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.field-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.field-hint-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.field-hint-text.visible-tooltip {
  position: absolute;
  z-index: 30;
  width: auto;
  height: auto;
  max-width: 280px;
  margin: 0;
  padding: 0.5rem 0.65rem;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  font-size: 0.85rem;
  font-weight: 400;
  color: #333;
}

.field-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.25rem;
  padding: 0;
  border: none;
  background: none;
  color: #6b7280;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
}

.field-info-btn:hover,
.field-info-btn:focus-visible {
  color: #4b5563;
}

.field-info-btn .field-info-icon {
  display: block;
  width: 1rem;
  height: 1rem;
}

.field {
  position: relative;
}

/* File upload drop zone */
.upload-zone {
  border: 2px dashed #4a90a4;
  border-radius: 4px;
  padding: 2rem 1.5rem;
  text-align: center;
  background: #fafafa;
  transition: background 0.15s, border-color 0.15s;
}

.upload-zone-label {
  display: block;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  background: #eef7f8;
  border-color: #2d7a8a;
}

.upload-zone .icon {
  font-size: 2.5rem;
  color: #888;
  margin-bottom: 0.5rem;
}

.upload-zone-prompt p {
  margin: 0 0 1rem;
  color: #444;
}

.upload-zone.has-files .upload-zone-label {
  padding-bottom: 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #e0e0e0;
}

.upload-constraints {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #333;
}

.upload-constraints strong {
  display: block;
  margin-top: 0.5rem;
}

.upload-constraints strong:first-child {
  margin-top: 0;
}

.upload-constraints ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.upload-zone .file-list {
  margin: 0;
  list-style: none;
  padding: 0;
  text-align: left;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.file-list li:last-child {
  border-bottom: none;
}

.file-list li span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-action,
.file-list .remove-file {
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
  white-space: nowrap;
  font: inherit;
}

.remove-action {
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  font: inherit;
  font-size: 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #333;
  background: #fff;
  color: #1a1a1a;
}

.btn-primary {
  background: #80ced6;
  color: #1a1a1a;
  border-color: #333;
}

.btn-primary:hover:not(:disabled) {
  background: #6bbfc8;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-danger {
  background: #fff;
  color: #c0392b;
  border-color: #c0392b;
}

.btn-danger:hover:not(:disabled) {
  background: #fdf2f2;
}

.btn-block {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 1.5rem auto 0;
  padding: 0.65rem 1.5rem;
  font-size: 1rem;
}

.btn:focus-visible,
.link-btn:focus-visible,
.checkbox-select-trigger:focus-visible,
.field-info-btn:focus-visible,
.remove-action:focus-visible,
.toast-close:focus-visible {
  outline: 2px solid #2d7a8a;
  outline-offset: 2px;
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.raw-tag-input:focus-visible {
  outline: 2px solid #2d7a8a;
  outline-offset: 1px;
}

.actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
}

.link-btn {
  background: none;
  border: none;
  color: #2d7a8a;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: none;
}

.link-btn:hover:not(:disabled) {
  text-decoration: underline;
}

.link-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Review page header */
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.review-header .doc-progress {
  font-size: 0.95rem;
  color: #444;
  white-space: nowrap;
}

.review-intro {
  margin-bottom: 1rem;
}

.review-intro p {
  margin: 0;
  color: #444;
}

.doc-filename-block {
  margin-bottom: 1.25rem;
}

.doc-filename-label {
  margin: 0 0 0.35rem;
  color: #444;
  font-size: 1.05rem;
  font-weight: 400;
}

.doc-filename-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.doc-filename-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 1.05rem;
}

.doc-filename-name:focus {
  outline: none;
}

.doc-filename-name:focus-visible {
  outline: 2px solid #2d7a8a;
  outline-offset: 2px;
}

.section-title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.manual-verification-note {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #444;
}

.field-description {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: #555;
}

.checkbox-select {
  position: relative;
}

.checkbox-select-trigger {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  font: inherit;
  background: #f5f5f5;
  text-align: left;
  cursor: pointer;
  color: #1a1a1a;
}

.checkbox-select-trigger::after {
  content: "▾";
  float: right;
  color: #666;
}

.checkbox-select-panel {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  max-height: 12rem;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.checkbox-select-option {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.checkbox-select-option:hover {
  background: #f3f8f9;
}

.checkbox-select-option input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.checkbox-select-option span {
  flex: 1;
}

.field.error .checkbox-select-trigger {
  border-color: #c0392b;
}

.approve-all-section {
  margin-bottom: 1.25rem;
}

.approve-all-note {
  margin-top: 0.5rem;
}

.summary-textarea {
  min-height: 8rem;
}

.summary-footer {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 0.35rem;
}

.word-count {
  font-size: 0.85rem;
  color: #555;
  white-space: nowrap;
}

.word-count.over-limit {
  color: #c0392b;
  font-weight: 600;
}

.raw-tags-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.raw-tag-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.raw-tag-input {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 2px;
  font: inherit;
  background: #f5f5f5;
}

.raw-tag-add,
.raw-tag-remove {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: none;
  color: #2d7a8a;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.raw-tag-add:disabled,
.raw-tag-remove:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.field.error .raw-tag-input {
  border-color: #c0392b;
}

/* Loading overlay */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: 100;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
}

.loading-overlay.visible {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #ddd;
  border-top-color: #80ced6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.alert {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
}

.alert-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #664d03;
}

.alert-error {
  background: #f8d7da;
  border: 1px solid #f5c2c7;
  color: #842029;
}

.hidden-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.final-submit-text {
  margin-bottom: 0.5rem;
}

.error-code {
  margin-top: 0.5rem;
  font-family: monospace;
}

.turnstile-status {
  color: #555;
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.turnstile-status.field-error {
  color: #c0392b;
}

/* Toast notification */
.toast {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 90%;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  font-size: 0.95rem;
}

.toast[hidden] {
  display: none !important;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 0 0.25rem;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-overlay.visible {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  padding: 2rem 2.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.modal-card h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

.modal-card p {
  margin: 0 0 1.25rem;
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.welcome-step p {
  margin: 0 0 0.75rem;
}

.welcome-step ul {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.25rem;
}

.welcome-step li {
  margin-bottom: 0.35rem;
}

#turnstile-container {
  margin: 1rem 0;
}

.dedupe-wait-status {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: #5a4a00;
}

.dedupe-debug-panel {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border: 1px dashed #7ab8be;
  background: #f4fbfc;
  font-size: 0.9rem;
}

.dedupe-debug-panel h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.dedupe-debug-section {
  margin: 0.75rem 0;
}

.dedupe-debug-query {
  word-break: break-word;
}

@media (max-width: 480px) {
  .doc-filename-row {
    flex-wrap: wrap;
  }

  .modal-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal-actions .btn {
    width: 100%;
    text-align: center;
  }
}


