/* Preview Actions Container */
.preview-actions {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding: 0;
  width: 100%;
  flex-wrap: wrap;
  visibility: visible;
  opacity: 1;
  position: relative;
  z-index: 10;
}

/* Back Button */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, #ffffff 0%, #e5e5e5 100%);
  color: #333;
  border: 1px solid #e5e5e5;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.btn-back:hover {
  background: linear-gradient(135deg, #f9f9f9 0%, #eeeeee 100%);
  border-color: #d0d0d0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.btn-back:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-back:focus {
  outline: 2px solid rgba(255, 152, 0, 0.5);
  outline-offset: 2px;
}

/* SVG Icon */
.btn-back svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn-back:hover svg {
  transform: translateX(-2px);
}

/* Button Text */
.btn-back .btn-text,
.btn-print .btn-text {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.01em;
  visibility: visible;
  opacity: 1;
}

/* Print Button */
.btn-print {
  display: inline-flex !important;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, #f21b23 0%, #d91820 100%);
  color: white !important;
  border: 1px solid #e65100;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(255, 152, 0, 0.3);
  min-height: 44px;
  min-width: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 152, 0, 0.3);
  margin-left: auto;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

.btn-print:hover {
  background: linear-gradient(135deg, #fb8c00 0%, #ef6c00 100%);
  border-color: #e65100;
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
  transform: translateY(-1px);
}

.btn-print:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(255, 152, 0, 0.3);
}

.btn-print:focus {
  outline: 2px solid rgba(255, 152, 0, 0.5);
  outline-offset: 2px;
}

/* Print Button SVG Icon */
.btn-print svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  display: block;
  visibility: visible;
  opacity: 1;
}

.btn-print:hover svg {
  transform: scale(1.1);
}

/* Print Styles */
@media print {
  /* Hide everything outside form-details-view-container */
  body > *:not(.form-details-view-container),
  .preview-actions {
    display: none !important;
  }

  .form-details-view-container {
    display: block !important;
    position: relative;
    width: 100%;
    max-width: 100%;
    background: white !important;
    box-shadow: none !important;
    padding: 1rem !important;
    margin: 0 !important;
    page-break-inside: avoid;
  }

  /* Ensure proper colors for print */
  .form-details-view-container * {
    color: #000 !important;
  }

  .form-details-view-container h1,
  .form-details-view-container h2,
  .form-details-view-container h3 {
    page-break-after: avoid;
    page-break-inside: avoid;
    color: #000 !important;
  }

  .question-card {
    page-break-inside: avoid;
    break-inside: avoid;
    background: #ededed !important;
    border: 1px solid #e5e5e5 !important;
  }

  .questions-list {
    page-break-inside: auto;
  }
}

/* Tablet and below (768px) */
@media (max-width: 48rem) {
  .preview-actions {
    margin-bottom: 1.25rem;
    gap: 0.625rem;
  }

  .btn-back,
  .btn-print {
    padding: 0.6875rem 1.125rem;
    font-size: 0.8125rem;
    gap: 0.5rem;
  }

  .btn-back svg,
  .btn-print svg {
    width: 1rem;
    height: 1rem;
  }
}

/* Mobile (640px and below) */
@media (max-width: 40rem) {
  .preview-actions {
    margin-bottom: 1rem;
    gap: 0.5rem;
  }

  .btn-back,
  .btn-print {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    gap: 0.5rem;
    min-height: 40px;
  }

  .btn-back svg,
  .btn-print svg {
    width: 1rem;
    height: 1rem;
  }
}

/* Small Mobile (480px and below) */
@media (max-width: 30rem) {
  .preview-actions {
    margin-bottom: 0.875rem;
    gap: 0.5rem;
  }

  .btn-back,
  .btn-print {
    padding: 0.5625rem 0.875rem;
    font-size: 0.75rem;
    gap: 0.4375rem;
    min-height: 38px;
  }

  .btn-back svg,
  .btn-print svg {
    width: 0.9375rem;
    height: 0.9375rem;
  }

  .btn-back .btn-text,
  .btn-print .btn-text {
    font-size: 0.75rem;
  }
}

/* Extra Small Mobile (360px and below) */
@media (max-width: 22.5rem) {
  .preview-actions {
    gap: 0.375rem;
  }

  .btn-back,
  .btn-print {
    padding: 0.5rem 0.75rem;
    font-size: 0.6875rem;
    gap: 0.375rem;
  }

  .btn-back svg,
  .btn-print svg {
    width: 0.875rem;
    height: 0.875rem;
  }
}

/* Landscape orientation adjustments */
@media (max-width: 48rem) and (orientation: landscape) {
  .preview-actions {
    margin-bottom: 1rem;
  }

  .btn-back,
  .btn-print {
    padding: 0.5rem 1rem;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .btn-back,
  .btn-print {
    border-width: 0.5px;
  }
}

/* Form Details View Container */
.form-details-view-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ========== Dark mode (night-mode) ========== */
body.night-mode .form-details-view-container {
  background: #3a3838;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

body.night-mode .form-header-info {
  border-top-color: rgba(255, 255, 255, 0.15);
}

body.night-mode .form-id-label,
body.night-mode .form-creator-label {
  color: rgba(255, 255, 255, 0.7);
}

body.night-mode .form-id-value,
body.night-mode .form-creator-value {
  color: rgba(255, 255, 255, 0.95);
}

body.night-mode .form-name-title {
  color: rgba(255, 255, 255, 0.98);
}

body.night-mode .form-name-description {
  color: rgba(255, 255, 255, 0.75);
}

body.night-mode .form-info-label {
  color: rgba(255, 255, 255, 0.7);
}

body.night-mode .form-info-value {
  color: rgba(255, 255, 255, 0.95);
}

body.night-mode .form-detail-item {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

body.night-mode .form-detail-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

body.night-mode .detail-label {
  color: rgba(255, 255, 255, 0.7);
}

body.night-mode .detail-value {
  color: rgba(255, 255, 255, 0.95);
}

body.night-mode .questions-section {
  background: transparent;
}

body.night-mode .questions-list {
  background: transparent;
}

body.night-mode .questions-heading {
  color: rgba(255, 255, 255, 0.98);
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

body.night-mode .question-card {
  background: #2e2c2c;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
}

body.night-mode .question-card:hover {
  background: #363434;
  border-color: rgba(242, 27, 35, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.night-mode .question-text,
body.night-mode .question-card .question-text,
body.night-mode .form-details-view-container .question-card p {
  color: rgba(255, 255, 255, 0.92) !important;
}

body.night-mode .required-asterisk {
  color: #f87171;
}

body.night-mode .empty-questions-state {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

body.night-mode .empty-questions-state h3 {
  color: rgba(255, 255, 255, 0.9);
}

body.night-mode .empty-questions-state p {
  color: rgba(255, 255, 255, 0.7);
}

body.night-mode .btn-back {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.2);
}

body.night-mode .btn-back:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.98);
}

body.night-mode .btn-print {
  background: linear-gradient(135deg, #f21b23 0%, #d91820 100%);
  color: #ffffff !important;
  border-color: rgba(242, 27, 35, 0.5);
}

body.night-mode .btn-print:hover {
  background: linear-gradient(135deg, #f87171 0%, #f21b23 100%);
  border-color: rgba(242, 27, 35, 0.6);
}

/* Form Header Info / Footer Info */
.form-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e8e8e8;
}

.form-id-info,
.form-creator-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-id-label,
.form-creator-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6c757d;
}

.form-id-value,
.form-creator-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #212529;
}

/* Form Name Section */
.form-name-section {
  padding-bottom: 1.5rem;
  text-align: center;
}

.form-name-title {
  font-size: 1.875rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
  text-align: center;
  margin-top: 1rem;
}

.form-name-description {
  font-size: 1rem;
  color: #666;
  line-height: 1.6;
  margin: 0 auto;
  max-width: 800px;
  text-align: center;
}

/* Form Info Row - Type, Location, Office */
.form-info-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  padding-bottom: 1.5rem;
  flex-wrap: wrap;
}

.form-info-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-info-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6c757d;
}

.form-info-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #212529;
}

/* Form Details Section */
.form-details-section {
  margin-bottom: 3rem;
}

.form-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.form-detail-item {
  padding: 1rem 1.25rem;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  transition: all 0.2s ease;
}

.form-detail-item:hover {
  background: #f1f3f5;
  border-color: #dee2e6;
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 1rem;
  font-weight: 500;
  color: #212529;
  line-height: 1.4;
  word-wrap: break-word;
}

/* Questions Section */
.questions-section {
  margin-bottom: 2.5rem;
}

.questions-heading {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 1.5rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #e5e5e5;
  display: inline-block;
  width: 100%;
}

/* Questions List */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.question-card {
  background: #ededed;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 1.25rem;
  transition: all 0.2s ease;
}

.question-card:hover {
  border-color: #f21b23;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.question-text {
  font-size: 1rem;
  color: #333;
  line-height: 1.6;
  margin: 0;
  font-weight: 400;
}

.required-asterisk {
  color: #c62828;
  font-weight: 600;
}

/* Empty Questions State */
.empty-questions-state {
  text-align: center;
  padding: 3rem 2rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.empty-questions-state h3 {
  font-size: 1.25rem;
  color: #495057;
  margin: 0 0 0.5rem 0;
  font-weight: 600;
}

.empty-questions-state p {
  font-size: 0.9375rem;
  color: #6c757d;
  margin: 0;
}

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

  .form-header-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
  }

  .form-name-title {
    font-size: 1.75rem;
  }

  .form-info-row {
    gap: 1.5rem;
    flex-direction: column;
    align-items: center;
  }

  .form-details-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .questions-heading {
    font-size: 1.25rem;
  }

  .question-card {
    padding: 1.25rem;
  }
}

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

  .form-header-info {
    margin-top: 1.5rem;
    padding-top: 1rem;
  }

  .form-name-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
  }

  .form-name-title {
    font-size: 1.5rem;
  }

  .form-info-row {
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
  }

  .form-details-section {
    margin-bottom: 2rem;
  }

  .form-detail-item {
    padding: 1rem;
  }

  .questions-section {
    margin-bottom: 2rem;
  }

  .question-card {
    padding: 1rem;
  }
}
