/**
 * Hero Demo Styles
 * Styling for the interactive demo simulation in the hero section
 */

/* Hero Demo Container */
.hero-demo-container {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  max-width: 100%;
  margin: 0 auto;
  position: relative; /* Added for absolute positioning of actions */
}

.demo-header {
  text-align: center;
  margin-bottom: 2rem;
}

.demo-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-gray-900);
  margin: 0 0 0.5rem 0;
}

.demo-subtitle {
  color: var(--color-gray-600);
  margin: 0;
  font-size: 0.95rem;
}

/* Demo Content Layout */
.demo-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  .demo-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Scenario Panel */
.scenario-panel {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.scenario-counter {
  font-size: 0.85rem;
  color: var(--color-primary);
  font-weight: 600;
  background: rgba(0, 124, 186, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

.scenario-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-gray-900);
  margin: 0;
}

.scenario-question {
  font-size: 1rem;
  color: var(--color-gray-700);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

/* Choice Buttons */
.scenario-choices {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative; /* For popover positioning */
}

.choice-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 1rem 1.25rem;
  background: white;
  border: 2px solid var(--color-gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative; /* For popover positioning */
}

.choice-btn:hover {
  border-color: var(--color-primary);
  background: rgba(0, 124, 186, 0.02);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.15);
}

.choice-btn:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.2);
}

.choice-btn.selected {
  border-color: var(--color-primary);
  background: rgba(0, 124, 186, 0.1);
  transform: none;
}

.choice-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.choice-text {
  color: var(--color-gray-800);
  font-weight: 500;
}

.choice-arrow {
  color: var(--color-primary);
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.choice-btn:hover .choice-arrow,
.choice-btn.selected .choice-arrow {
  opacity: 1;
}

/* Feedback Section - Now as Popover */
.scenario-feedback {
  position: absolute;
  top: -1rem;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(59, 130, 246, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  z-index: 1000;
  min-width: 340px;
  max-width: 420px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.scenario-feedback.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-100%) translateY(-0.75rem) scale(1);
}

/* Demo Feedback Popover Styles */
.demo-feedback-popover {
  position: absolute;
  bottom: 100%;
  left: 50%; /* Default center position, will be adjusted by JavaScript */
  transform: translateX(-50%);
  margin-bottom: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 10;
  pointer-events: none;
}

.demo-feedback-popover.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(-5px);
}

.demo-feedback-popover .popover-content {
  background: rgba(255, 255, 255, 0.98);
  color: #2d3748;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  min-width: 280px;
  max-width: 400px;
  position: relative;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.demo-feedback-popover .popover-content h5 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #667eea;
}

.demo-feedback-popover .popover-content p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #4a5568;
}

/* Popover Arrow (pointing downward) */
.demo-feedback-popover .popover-arrow {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid rgba(255, 255, 255, 0.98);
}

/* Arrow shadow effect */
.demo-feedback-popover .popover-arrow::before {
  content: '';
  position: absolute;
  top: -9px;
  left: -9px;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 9px solid rgba(102, 126, 234, 0.2);
  z-index: -1;
}

/* Ensure demo controls container has relative positioning for popover */
.hero-demo-controls {
  position: relative;
  margin-bottom: 2rem;
}

.demo-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  max-width: 700px;
  margin: 0 auto;
  position: relative; /* Added for popover positioning */
}

/* Popover Backdrop for Mobile */
.feedback-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
}

.feedback-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

/* Demo Actions - Positioned in bottom right corner */
.demo-actions {
  position: absolute;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  gap: 0.75rem;
  z-index: 100;
}

.demo-actions .btn {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.demo-actions .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.demo-actions .btn-primary {
  background: var(--color-primary, #3b82f6);
  color: white;
  border: none;
}

.demo-actions .btn-primary:hover {
  background: var(--color-primary-dark, #2563eb);
}

.demo-actions .btn-secondary {
  background: white;
  color: var(--color-gray-700, #374151);
  border: 1px solid var(--color-gray-300, #d1d5db);
}

.demo-actions .btn-secondary:hover {
  background: var(--color-gray-50, #f9fafb);
  border-color: var(--color-gray-400, #9ca3af);
}

/* ====================================
   HERO RADAR DEMO STYLES  
   ================================== */

/* Hero Radar Demo Section */
.hero-radar-demo {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border: 2px solid #cbd5e0;
  border-radius: 16px;
  padding: 2rem;
  margin: 2rem 0 0 0;
  text-align: center;
}

.hero-radar-demo h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 1rem 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-radar-demo p {
  color: #4a5568;
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.6;
}

/* Demo Controls Grid for Better Layout */
.hero-demo-controls {
  margin-bottom: 2rem;
}

.demo-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  max-width: 700px;
  margin: 0 auto;
}

/* Hero Radar Container */
.hero-radar-container {
  position: relative;
  width: 100%;
  max-width: 650px;
  margin: 0 auto 2rem auto;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Accordion Styles for Instructions */
.radar-instructions-accordion {
  max-width: 600px;
  margin: 1.5rem auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.radar-instructions-accordion .accordion-item {
  border: none;
  border-radius: 0;
}

.radar-instructions-accordion .accordion-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  outline: none;
  font-weight: 600;
}

.radar-instructions-accordion .accordion-header:hover {
  background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  transform: translateY(-1px);
}

.radar-instructions-accordion .accordion-header:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: -2px;
}

.radar-instructions-accordion .accordion-icon {
  font-size: 0.875rem;
  transition: transform 0.3s ease;
  min-width: 12px;
}

.radar-instructions-accordion .accordion-icon.expanded {
  transform: rotate(90deg);
}

.radar-instructions-accordion .accordion-title {
  font-size: 1rem;
  margin: 0;
}

.radar-instructions-accordion .accordion-content {
  background: white;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.radar-instructions-accordion .accordion-content.collapsed {
  max-height: 0;
}

.radar-instructions-accordion .accordion-content-inner {
  padding: 1.5rem;
  border-top: 1px solid rgba(102, 126, 234, 0.1);
  text-align: left;
}

.radar-instructions-accordion .accordion-content-inner p {
  color: #4a5568;
  margin: 0 0 1rem 0;
  line-height: 1.6;
  font-size: 0.95rem;
}

.radar-instructions-accordion .accordion-content-inner ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.radar-instructions-accordion .accordion-content-inner li {
  color: #4a5568;
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.9rem;
  line-height: 1.5;
}

.radar-instructions-accordion .accordion-content-inner li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: #667eea;
  font-weight: bold;
}

.radar-instructions-accordion .accordion-content-inner li strong {
  color: #2d3748;
  font-weight: 600;
}

/* Demo Feedback Enhancement */
#hero-demo-feedback {
  background: rgba(102, 126, 234, 0.05);
  border: 1px solid rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1rem;
  text-align: left;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

#hero-demo-feedback.show {
  opacity: 1;
  transform: translateY(0);
}

#hero-demo-feedback h5 {
  color: #667eea;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  font-size: 1.1rem;
}

#hero-demo-feedback p {
  color: #4a5568;
  margin: 0;
  line-height: 1.5;
  font-size: 0.95rem;
}

/* Responsive Design for Hero Radar Demo */
@media (max-width: 768px) {
  .hero-radar-demo {
    padding: 1rem; /* Reduced padding for more chart space */
    margin: 1.5rem 0 0 0;
  }

  .demo-controls-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
  }

  .radar-instructions-accordion .accordion-header {
    padding: 0.875rem 1rem;
  }

  .radar-instructions-accordion .accordion-content-inner {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .hero-radar-demo {
    padding: 0.75rem; /* Minimal padding on small screens */
  }

  .hero-radar-demo h3 {
    font-size: 1.25rem;
  }

  .demo-controls-grid {
    grid-template-columns: 1fr;
    max-width: 300px;
  }

  .radar-instructions-accordion .accordion-title {
    font-size: 0.9rem;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .choice-btn {
    border-width: 3px;
  }

  .choice-btn:focus {
    box-shadow: 0 0 0 4px rgba(0, 124, 186, 0.5);
  }

  .meter-fill {
    border: 2px solid currentColor;
  }

  .scenario-feedback {
    border-width: 2px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .choice-btn,
  .meter-fill,
  .score-change,
  .scenario-feedback,
  .feedback-backdrop {
    transition: none;
    animation: none;
  }

  .choice-btn:hover {
    transform: none;
  }

  .scenario-feedback.visible {
    transform: translateX(-50%) translateY(-100%) translateY(-0.5rem);
  }

  @media (max-width: 768px) {
    .scenario-feedback.visible {
      transform: translateY(-100%) translateY(-0.5rem);
    }
  }
}

/* Import demo button styles from ethics-analysis.css for consistency */
.hero-demo-controls .demo-btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-demo-controls .demo-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transition: left 0.5s ease;
}

.hero-demo-controls .demo-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
  background: linear-gradient(135deg, #4338ca 0%, #5b21b6 100%);
}

.hero-demo-controls .demo-btn:hover::before {
  left: 100%;
}

.hero-demo-controls .demo-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

/* Active/Selected state for demo buttons */
.hero-demo-controls .demo-btn.active {
  background: linear-gradient(135deg, #1e40af 0%, #3730a3 100%);
  box-shadow: 0 4px 16px rgba(30, 64, 175, 0.4);
  transform: translateY(-1px);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.hero-demo-controls .demo-btn.active::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
}

.hero-demo-controls .demo-btn.active:hover {
  background: linear-gradient(135deg, #1e3a8a 0%, #312e81 100%);
  box-shadow: 0 6px 20px rgba(30, 64, 175, 0.45);
}

/* Ethics Glossary Accordion Styles */
.ethics-glossary-accordion {
  max-width: 600px;
  margin: 1.5rem auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ethics-glossary-accordion .accordion-item {
  border: none;
  border-radius: 0;
}

.ethics-glossary-accordion .accordion-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
  outline: none;
  font-weight: 600;
}

.ethics-glossary-accordion .accordion-header:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

.ethics-glossary-accordion .accordion-header:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: -2px;
}

.ethics-glossary-accordion .accordion-icon {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  color: rgba(255, 255, 255, 0.9);
}

.ethics-glossary-accordion.open .accordion-icon {
  transform: rotate(90deg);
}

.ethics-glossary-accordion .accordion-title {
  font-size: 1rem;
  margin: 0;
  flex: 1;
}

.ethics-glossary-accordion .accordion-content {
  background: white;
  overflow: hidden;
  transition: all 0.3s ease;
  max-height: 0;
  opacity: 0;
}

.ethics-glossary-accordion .accordion-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.ethics-glossary-accordion .accordion-content-inner {
  padding: 1.5rem;
}

/* Glossary Grid Styles for Accordion */
.ethics-glossary-accordion .glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.ethics-glossary-accordion .glossary-item {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 8px;
  padding: 1rem;
  border-left: 4px solid #10b981;
}

.ethics-glossary-accordion .glossary-item h4 {
  margin: 0 0 0.5rem 0;
  color: #1a202c;
  font-size: 1rem;
  font-weight: 600;
}

.ethics-glossary-accordion .glossary-item p {
  margin: 0;
  color: #4a5568;
  font-size: 0.9rem;
  line-height: 1.5;
}

.ethics-glossary-accordion .glossary-note {
  background: linear-gradient(135deg, #fef7cd 0%, #fef3c7 100%);
  border-radius: 8px;
  padding: 1rem;
  border-left: 4px solid #f59e0b;
}

.ethics-glossary-accordion .glossary-note p {
  margin: 0;
  color: #78350f;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Mobile responsiveness for glossary accordion */
@media (max-width: 768px) {
  .ethics-glossary-accordion .glossary-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .ethics-glossary-accordion .accordion-content-inner {
    padding: 1rem;
  }
  
  .ethics-glossary-accordion .accordion-title {
    font-size: 0.9rem;
  }
}
