/* public/viewer.css */

:root {
  --primary-color: #4f46e5;
  --background-color: #f9fafb;
  --card-background: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
}

body {
  font-family: "Noto Sans SC", sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  margin: 0;
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
}

.viewer-container {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  background: var(--card-background);
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05),
    0 4px 6px -4px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
}
.page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  position: relative;
}
.back-link {
  position: absolute;
  top: 0;
  left: 0;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s ease;
}
.back-link:hover {
  color: var(--primary-color);
}
.main-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
}
.view-section.hidden {
  display: none;
}

.prompt-text {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}
.input-form {
  display: flex;
  gap: 1rem;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}
#survey-id-input {
  flex-grow: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#survey-id-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
#submit-id-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}
#submit-id-btn:hover:not(:disabled) {
  background-color: #4338ca;
}
#submit-id-btn:disabled {
  background-color: #a5b4fc;
  cursor: not-allowed;
}

.export-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border-color);
}
#current-id-display {
  color: var(--text-secondary);
  font-size: 0.9rem;
  white-space: nowrap;
}
#current-id-display span {
  font-weight: 600;
  color: var(--text-primary);
  background: #f3f4f6;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
}

.action-buttons-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.search-new-button {
  background-color: #eef2ff;
  color: var(--primary-color);
}
.search-new-button:hover {
  background-color: #e0e7ff;
}
.export-button {
  background-color: #10b981;
  color: white;
}
.export-button:hover {
  background-color: #059669;
}

.export-container {
  position: relative;
}
.export-button .fa-caret-down {
  transition: transform 0.3s ease;
}
.export-container.open .export-button .fa-caret-down {
  transform: rotate(180deg);
}

.export-menu {
  display: flex;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  z-index: 10;
  padding: 0.5rem;
  gap: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
}
.export-container.open .export-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.export-menu a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem;
  width: 60px;
  background-color: #f9fafb;
  border-radius: 0.375rem;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  white-space: nowrap;
  transition: all 0.2s ease;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
  transition-delay: var(--i-delay);
}
.export-container.open .export-menu a {
  opacity: 1;
  transform: scale(1);
}
.export-menu a:hover {
  background-color: white;
  color: var(--primary-color);
  transform: scale(1.05);
}
.export-menu a i {
  font-size: 1.25rem;
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.result-section {
  padding: 1rem 0;
}
.result-section:not(:first-child) {
  border-top: 1px solid var(--border-color);
}
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.result-item {
  padding: 1rem;
  border-radius: 0.5rem;
}
.question {
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}
.answer {
  color: var(--text-secondary);
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.95rem;
}
.answer.no-answer {
  font-style: italic;
  color: #9ca3af;
}
.loading-placeholder,
.error-message {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}
.error-message {
  color: #ef4444;
  background-color: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 0.5rem;
}
.page-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.page-footer a {
  color: var(--primary-color);
  text-decoration: none;
}
.page-footer a:hover {
  text-decoration: underline;
}
.notification-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background-color: #111827;
  color: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transform: translateY(150%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 100;
}
.notification-toast.show {
  transform: translateY(0);
  opacity: 1;
}
.notification-toast .success {
  color: #22c55e;
}
.notification-toast .error {
  color: #ef4444;
}
.animated-line {
  opacity: 0;
  filter: blur(4px);
  transform: translateY(15px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--animation-delay, 0s);
}
.animated-line.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}
.input-feedback-container {
  max-width: 500px;
  margin: 0.75rem auto 0;
  height: 0;
  opacity: 0;
  transform: translateY(-10px);
  transition: height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
  overflow: hidden;
}

.input-feedback-container.visible {
  height: 24px;
  opacity: 1;
  transform: translateY(0);
}

.feedback-text {
  font-size: 0.875rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  border-width: 1px;
  border-style: solid;
}

.feedback-info {
  color: #3b82f6;
  background-color: #eff6ff;
  border-color: #bfdbfe;
}

.feedback-warning {
  color: #f97316;
  background-color: #fff7ed; 
  border-color: #fed7aa;
}

.feedback-success {
  color: #16a34a; 
  background-color: #f0fdf4;
  border-color: #bbf7d0;
}