/* ==============================================
   Nex Arc Practice Exams - Exam Page Stylesheet
   Version: 2.0.0

   This file contains styles specific to exam pages.
   Requires: styles.css to be loaded first
   Usage: Add data-provider="aws|azure|gcp|cissp" to body
   ============================================== */

/* ==============================================
   1. Breadcrumb
   ============================================== */
.breadcrumb {
  background: var(--white);
  padding: 1rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border-gray);
}

.breadcrumb-item a {
  color: var(--platform-primary);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--text-gray);
}

/* ==============================================
   2. Main Content Layout
   ============================================== */
.main-content {
  margin-top: 70px;
  min-height: calc(100vh - 70px);
}

.exam-container {
  max-width: 1200px;
  margin: 2rem auto;
  display: flex;
  gap: 2rem;
  padding: 0 1rem;
}

.exam-content {
  flex: 1;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

/* ==============================================
   3. Promo Sidebar
   ============================================== */
.promo-sidebar {
  width: 320px;
  position: -webkit-sticky;
  position: sticky;
  top: 90px;
  height: fit-content;
}

.promo-title {
  font-size: 1.25rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: 1rem;
}

.copy-tooltip {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-dark);
  color: var(--white);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  display: none;
}

.copy-tooltip.show {
  display: block;
}

.promo-urgency {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.udemy-btn {
  display: block;
  background: var(--white);
  color: var(--platform-primary);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  text-align: center;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.udemy-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: var(--platform-primary);
}

/* Mid-exam upsell banner */
.mid-exam-banner {
  position: relative;
  background: #f0f7ff;
  border: 1px solid #d0e3f7;
  border-radius: var(--radius-md);
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: #2c5282;
  animation: fadeInBanner 0.3s ease-out;
}

@keyframes fadeInBanner {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mid-exam-banner-text {
  line-height: 1.4;
}

.mid-exam-banner-dismiss {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: #6b9fd4;
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.8rem;
  line-height: 1;
}

.mid-exam-banner-dismiss:hover {
  color: #2c5282;
}

.mid-exam-banner-link {
  color: #2b6cb0;
  font-weight: 600;
  text-decoration: underline;
  margin-left: 0.25rem;
}

/* ==============================================
   5. Info Card (Sidebar)
   ============================================== */
.info-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.info-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.info-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-card li {
  padding: 0.5rem 0;
  color: var(--text-gray);
  font-size: 0.9rem;
  padding-left: 1.5rem;
  position: relative;
}

/* Simple bullet instead of arrow */
.info-card li::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--success-green);
  border-radius: 50%;
  position: absolute;
  left: 0;
  top: 0.85rem;
}

/* ==============================================
   6. Exam Header
   ============================================== */
.exam-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-gray);
}

.exam-title {
  font-size: 2rem;
  font-weight: var(--font-weight-bold);
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.exam-subtitle {
  color: var(--text-gray);
  font-size: 1.1rem;
}

.exam-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.start-screen .info-card {
  background: var(--light-gray);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: none;
}

.start-screen .info-card i {
  font-size: 2rem;
  color: var(--platform-primary);
  margin-bottom: 0.5rem;
}

.info-label {
  font-size: 0.85rem;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 1.25rem;
  font-weight: var(--font-weight-bold);
  color: var(--primary-dark);
}

/* ==============================================
   7. Start Screen
   ============================================== */
.start-screen {
  text-align: center;
}

.start-btn {
  background: var(--platform-primary);
  color: #ffffff;
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: var(--font-weight-semibold);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  margin: 2rem 0;
  min-height: 48px;
}

.start-btn:hover:not(:disabled) {
  background: var(--platform-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--platform-primary-rgb), 0.3);
}

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

/* ==============================================
   8. Question Screen
   ============================================== */
.question-screen {
  display: none;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-gray);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.progress-text {
  font-weight: var(--font-weight-semibold);
  color: var(--primary-dark);
}

.question-text {
  font-size: 1.15rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  color: var(--primary-dark);
}

/* ==============================================
   9. Answer Options
   ============================================== */
.answer-option {
  background: var(--white);
  border: 2px solid var(--border-gray);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  user-select: none;
}

.answer-option.not-selected-incorrect {
  border-color: var(--border-gray);
  background: rgba(108, 117, 125, 0.05);
}

.answer-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  width: 100%;
  pointer-events: none;
}

.answer-input {
  margin-right: 1rem;
  margin-top: 0;
  flex-shrink: 0;
  align-self: flex-start;
  pointer-events: auto;
}

.answer-text {
  flex: 1;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
  user-select: text;
  pointer-events: auto;
}

.answer-text a {
  word-break: break-all;
  overflow-wrap: anywhere;
}

.answer-feedback {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-gray);
}

.answer-option.correct .answer-feedback,
.answer-option.incorrect .answer-feedback,
.answer-option.not-selected-incorrect .answer-feedback {
  display: block;
}

.feedback-icon {
  margin-right: 0.5rem;
}

.answer-option.correct .feedback-icon {
  color: var(--success-green);
}

.answer-option.incorrect .feedback-icon {
  color: var(--danger-red);
}

.answer-option.not-selected-incorrect .feedback-icon {
  color: var(--text-gray);
}

.explanation-text {
  color: var(--text-gray);
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.explanation-text a {
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* ==============================================
   10. Action Buttons
   ============================================== */
.action-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-gray);
}

.submit-btn,
.next-btn {
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: var(--font-weight-semibold);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
}

.submit-btn {
  background: var(--platform-primary);
  color: var(--platform-primary-text);
}

.submit-btn:hover:not(:disabled) {
  background: var(--platform-primary-hover);
  transform: translateY(-1px);
}

.submit-btn:disabled {
  background: var(--text-gray);
  cursor: not-allowed;
  opacity: 0.6;
}

.next-btn {
  background: var(--success-green);
  color: #ffffff;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.next-btn:hover:not(:disabled) {
  background: #157347;
  transform: translateY(-1px);
}

.next-btn:disabled {
  background: var(--text-gray);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ==============================================
   11. Results Screen
   ============================================== */
.results-screen {
  display: none;
  text-align: center;
  padding: 3rem 1rem;
}

.score-circle {
  width: 150px;
  height: 150px;
  margin: 0 auto 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: var(--font-weight-bold);
  color: #ffffff;
}

.score-circle.pass {
  background: var(--success-green);
}

.score-circle.fail {
  background: var(--danger-red);
}

.results-message {
  font-size: 1.5rem;
  font-weight: var(--font-weight-semibold);
  margin-bottom: 1rem;
}

.results-details {
  color: var(--text-gray);
  margin-bottom: 2rem;
}

.results-cta {
  background: linear-gradient(135deg, var(--platform-primary), var(--platform-primary-hover));
  color: #ffffff;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  margin-top: 2rem;
}

.results-cta h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #ffffff;
}

.results-cta p {
  color: rgba(255, 255, 255, 0.9);
}

.retry-btn {
  background: transparent;
  color: var(--primary-dark);
  border: 2px solid var(--primary-dark);
  padding: 0.75rem 2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  margin-top: 1rem;
  font-weight: var(--font-weight-semibold);
  transition: all var(--transition-fast);
  min-height: 44px;
}

.retry-btn:hover {
  background: var(--primary-dark);
  color: var(--white);
  transform: translateY(-1px);
}

/* ==============================================
   12. Loading State
   ============================================== */
.loading {
  text-align: center;
  padding: 3rem;
}

.spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3rem;
  color: var(--platform-primary);
}

/* ==============================================
   13. Info Sections
   ============================================== */
.info-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-top: 2rem;
  box-shadow: var(--shadow-md);
}

.info-section h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.info-section p {
  line-height: 1.6;
  color: var(--text-gray);
}

.info-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-section li {
  padding: 0.5rem 0;
}

/* ==============================================
   14. FAQ Section
   ============================================== */
.faq-item {
  margin-bottom: 1rem;
}

.faq-question {
  background: var(--light-gray);
  padding: 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: var(--font-weight-semibold);
  transition: background var(--transition-fast);
}

.faq-question:hover {
  background: #e9ecef;
}

.faq-answer {
  padding: 1rem;
  display: none;
  color: var(--text-gray);
  line-height: 1.6;
}

.faq-item.active .faq-answer {
  display: block;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-icon {
  transition: transform var(--transition-fast);
}

/* ==============================================
   15. Mobile Purchase CTA
   ============================================== */
.mobile-purchase-cta {
  display: none;
  margin-top: 0.75rem;
}

.mobile-purchase-btn {
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: var(--platform-primary);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}

.mobile-purchase-btn:hover {
  opacity: 0.9;
}

.mobile-purchase-btn strong {
  display: block;
  font-size: 1.05rem;
}

.mobile-purchase-subtitle {
  display: block;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 0.25rem;
}

/* Sticky mobile purchase bar - shown after exam completion on mobile */
.mobile-purchase-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--platform-primary);
  color: white;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px)) 1rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  z-index: 10001; /* Above cookie consent banner (10000) */
  animation: slideUpBar 0.3s ease-out;
}

@keyframes slideUpBar {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.mobile-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-right: 2rem;
}

.mobile-bar-text {
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 1;
}

.mobile-bar-buy-btn {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  background: white;
  color: var(--platform-primary);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
}

.mobile-bar-buy-btn:hover {
  opacity: 0.9;
}

.mobile-bar-dismiss {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.85rem;
  line-height: 1;
}

.mobile-bar-dismiss:hover {
  color: white;
}

/* ==============================================
   16. Responsive Design
   ============================================== */
@media (max-width: 992px) {
  .exam-container {
    flex-direction: column;
  }

  .promo-sidebar {
    width: 100%;
    position: relative;
    top: 0;
  }

  .exam-content {
    margin-bottom: 2rem;
  }

  .mobile-purchase-bar {
    display: block;
  }

  .exam-content > .promo-sidebar {
    width: 100%;
    position: relative;
    top: 0;
    margin-top: 2rem;
    margin-bottom: 1rem;
  }

  /* Collapsible info sections on mobile */
  .info-section-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    margin-bottom: 0;
  }

  .info-section-header .info-section-chevron {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
    color: var(--text-gray);
    margin-left: 0.5rem;
    flex-shrink: 0;
  }

  .info-section-header.expanded .info-section-chevron {
    transform: rotate(180deg);
  }

  .info-section-body {
    transition: max-height 0.3s ease;
    overflow: hidden;
  }

  .info-section-body > *:first-child {
    margin-top: 1rem;
  }
}

@media (max-width: 768px) {
  .exam-container {
    padding: 0 0.5rem;
    gap: 1rem;
  }

  .exam-content {
    padding: 1.5rem;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
  }

  .action-buttons .prev-btn { order: 1; }
  .action-buttons .submit-btn { order: 2; }
  .action-buttons .next-btn { order: 3; }
  .action-buttons .finish-btn {
    order: 4;
    grid-column: 1 / -1;
    max-width: 200px;
    margin: 0 auto;
  }
}

@media (max-width: 576px) {
  .exam-title {
    font-size: 1.5rem;
  }

  .start-btn {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    width: 100%;
  }

  .question-text {
    font-size: 1rem;
  }

  .answer-option {
    padding: 1rem 0.875rem; /* Increased vertical padding for better touch targets */
  }

  .exam-content {
    padding: 1rem;
  }

  .info-section {
    padding: 1.5rem;
  }

  .results-screen {
    padding: 2rem 0.5rem;
  }

  .score-circle {
    width: 120px;
    height: 120px;
    font-size: 2.5rem;
  }

  .submit-btn, .next-btn, .prev-btn, .finish-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    min-height: 44px;
  }
}

/* ==============================================
   17. Manual Dark Mode Support
   ============================================== */
[data-theme="dark"] .breadcrumb {
  background: #202124;
  border-color: var(--border-gray);
}

[data-theme="dark"] .exam-content {
  background: #202124;
}

[data-theme="dark"] .start-screen .info-card {
  background: #2d2e30;
}

[data-theme="dark"] .info-card {
  background: #202124;
}

[data-theme="dark"] .info-section {
  background: #202124;
}

[data-theme="dark"] .faq-question {
  background: #2d2e30;
}

[data-theme="dark"] .faq-question:hover {
  background: #3d3e40;
}

[data-theme="dark"] .results-screen {
  background: transparent;
}

/* Dark mode: Answer and explanation text readability fix */
[data-theme="dark"] .answer-text {
  color: var(--primary-dark);
}

[data-theme="dark"] .explanation-text {
  color: var(--primary-dark);
}

[data-theme="dark"] .answer-option.disabled .answer-text {
  color: var(--primary-dark);
}

/* Additional dark mode text color fixes */
[data-theme="dark"] .start-screen .info-card {
  background: #2d2e30;
  color: #e8eaed;
}

[data-theme="dark"] .start-screen .info-card .info-label {
  color: #9aa0a6;
}

[data-theme="dark"] .start-screen .info-card .info-value {
  color: #e8eaed;
}

[data-theme="dark"] .info-card {
  background: #202124;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color: #e8eaed;
}

[data-theme="dark"] .info-card h3 {
  color: #e8eaed;
}

[data-theme="dark"] .info-card ul li {
  color: #e8eaed;
}

/* Prerequisites box in AWS/Azure/GCP pages */
[data-theme="dark"] div[style*="background: #e7f3ff"],
[data-theme="dark"] div[style*="background: #fff8e6"],
[data-theme="dark"] div[style*="background:#e7f3ff"],
[data-theme="dark"] div[style*="background:#fff8e6"] {
  background: #2d2e30 !important;
  border-left-color: var(--platform-primary);
}

[data-theme="dark"] div[style*="background: #e7f3ff"] p,
[data-theme="dark"] div[style*="background: #fff8e6"] p {
  color: #e8eaed;
}

[data-theme="dark"] div[style*="background: #e7f3ff"] strong,
[data-theme="dark"] div[style*="background: #fff8e6"] strong {
  color: #e8eaed;
}

[data-theme="dark"] div[style*="background: #e7f3ff"] a,
[data-theme="dark"] div[style*="background: #fff8e6"] a {
  color: #8ab4f8;
}

/* Dark mode: Mid-exam banner */
[data-theme="dark"] .mid-exam-banner {
  background: #1a2332;
  border-color: #2d3f54;
  color: #c9d1d9;
}

[data-theme="dark"] .mid-exam-banner-link {
  color: #58a6ff;
}

[data-theme="dark"] .mid-exam-banner-dismiss {
  color: #6e7681;
}

[data-theme="dark"] .mid-exam-banner-dismiss:hover {
  color: #c9d1d9;
}

/* Dark mode: Mobile purchase CTA subtitle readability */
[data-theme="dark"] .mobile-purchase-subtitle {
  color: rgba(255, 255, 255, 0.85);
}

/* Dark mode: Retry button */
[data-theme="dark"] .retry-btn {
  color: #e8eaed;
  border-color: #5a5f65;
}

[data-theme="dark"] .retry-btn:hover {
  background: #5a5f65;
  color: #e8eaed;
}

/* ==============================================
   18. Screen Reader Announcements
   ============================================== */
#sr-announcements {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
