/* View Submission - Advanced Premium Design */

/* CSS Custom Properties for Design System */
:root {
  --primary-50: #fff7ed;
  --primary-100: #ffedd5;
  --primary-200: #fed7aa;
  --primary-400: #fb923c;
  --primary-500: #f21b23;
  --primary-600: #d91820;
  --primary-700: #c2410c;
  
  --neutral-50: #fafafa;
  --neutral-100: #e5e5e5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Main Container */
.view-submission-container {
  padding: 2.5rem 3rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 1.5rem;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Header */
.view-submission-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--neutral-200);
}

.view-submission-title {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--neutral-800) 0%, var(--neutral-600) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 1rem 0;
}

.submission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
}

.meta-item {
  font-size: 0.9375rem;
  color: var(--neutral-600);
}

.meta-item strong {
  color: var(--neutral-800);
  margin-right: 0.5rem;
}

/* Answers distributed by version (Required / Optional) */
.answers-by-version {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.view-submission-version {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 250, 250, 0.95) 100%);
  border: 2px solid var(--neutral-200);
  border-radius: 1rem;
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-md);
}

.view-submission-version-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--neutral-800);
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--primary-400);
  text-transform: capitalize;
}

/* Answers Section (within each version) */
.answers-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 0;
}

.answer-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(250, 250, 250, 0.9) 100%);
  border: 2px solid var(--neutral-200);
  border-radius: 0.875rem;
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.answer-item:hover {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-md);
}

.answer-question {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.question-number {
  font-weight: 700;
  color: var(--primary-600);
  font-size: 1.125rem;
  min-width: 2rem;
}

.question-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--neutral-800);
  line-height: 1.5;
  flex: 1;
}

.answer-content {
  margin-left: 2.75rem;
}

.answer-text {
  background: white;
  border: 1px solid var(--neutral-200);
  border-radius: 0.625rem;
  padding: 1rem 1.25rem;
}

.answer-value {
  margin: 0;
  color: var(--neutral-700);
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Media Section */
.answer-media {
  margin-top: 0.5rem;
}

.media-label {
  font-weight: 600;
  color: var(--neutral-600);
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}

.media-item {
  border: 2px solid var(--neutral-200);
  border-radius: 0.625rem;
  overflow: hidden;
  background: var(--neutral-50);
  transition: all 0.2s ease;
}

.media-item:hover {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-md);
}

.media-image-link {
  display: block;
  line-height: 0;
  cursor: pointer;
}

.media-image-link:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

.media-image {
  width: 100%;
  height: auto;
  display: block;
  max-height: 300px;
  object-fit: contain;
  background: white;
  pointer-events: none; /* click goes to parent <a> */
}

.media-view-in-browser {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary-600);
  text-decoration: none;
  border: 1px solid var(--primary-200);
  border-radius: 0.375rem;
  background: var(--primary-50);
  transition: background 0.2s, border-color 0.2s;
}

.media-view-in-browser:hover {
  background: var(--primary-100);
  border-color: var(--primary-400);
  text-decoration: underline;
}

.media-video {
  width: 100%;
  height: auto;
  display: block;
  max-height: 300px;
  background: black;
}

.media-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--neutral-600);
}

.media-placeholder a {
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 600;
  margin-top: 0.5rem;
  display: inline-block;
}

.media-placeholder a:hover {
  text-decoration: underline;
}

.media-error {
  padding: 1rem;
  text-align: center;
  color: var(--neutral-500);
  font-size: 0.875rem;
}

/* No Answers */
.no-answers {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--neutral-500);
  font-size: 1.125rem;
}

/* Actions */
.view-submission-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--neutral-200);
}

/* Buttons */
.btn {
  padding: 0.875rem 2rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  letter-spacing: 0.03em;
}

.btn-secondary {
  background: linear-gradient(135deg, #ffffff 0%, var(--neutral-50) 100%);
  color: var(--neutral-700);
  border: 2px solid var(--neutral-200);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: linear-gradient(135deg, var(--neutral-50) 0%, var(--neutral-100) 100%);
  border-color: var(--neutral-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Error Message */
.error-message {
  padding: 1.125rem 1.5rem;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #b91c1c;
  border-radius: 0.75rem;
  border: 1px solid #fecaca;
  font-size: 0.875rem;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .view-submission-container {
    padding: 1.5rem;
  }

  .view-submission-title {
    font-size: 1.5rem;
  }

  .view-submission-header {
    flex-direction: column;
    gap: 1rem;
  }

  .view-submission-header .btn {
    width: 100%;
  }

  .submission-meta {
    flex-direction: column;
    gap: 0.75rem;
  }

  .view-submission-version {
    padding: 1rem 1.25rem;
  }

  .view-submission-version-title {
    font-size: 1.1rem;
  }

  .answer-question {
    flex-direction: column;
    gap: 0.5rem;
  }

  .answer-content {
    margin-left: 0;
  }

  .media-gallery {
    grid-template-columns: 1fr;
  }

  .view-submission-actions {
    flex-wrap: wrap;
  }

  .view-submission-actions .btn {
    flex: 1;
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .view-submission-container {
    padding: 1rem;
  }

  .view-submission-title {
    font-size: 1.25rem;
  }

  .view-submission-actions {
    flex-direction: column;
  }

  .view-submission-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .answer-item {
    padding: 1rem;
  }
}

/* ================================ DARK THEME (night mode) ================================ */
body.night-mode .view-submission-container {
  background: rgba(58, 56, 56, 0.95);
  border-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .view-submission-header {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}
body.night-mode .view-submission-title {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.85) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
body.night-mode .meta-item {
  color: rgba(255, 255, 255, 0.85);
}
body.night-mode .meta-item strong {
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .view-submission-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.25);
}
body.night-mode .view-submission-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.5);
}
body.night-mode .answers-section-title {
  color: rgba(255, 255, 255, 0.98);
}
body.night-mode .answer-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}
body.night-mode .answer-question {
  color: rgba(255, 255, 255, 0.95);
}
body.night-mode .answer-value {
  color: rgba(255, 255, 255, 0.9);
}
body.night-mode .view-submission-container .error-message {
  background: rgba(248, 113, 113, 0.15) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.4);
}
body.night-mode .view-submission-loading {
  color: rgba(255, 255, 255, 0.8);
}
