/* ==========================================================================
   Component Styles
   ========================================================================== */

/* Segment Selector */
.segment-selector {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
  margin: var(--space-xl) 0;
  padding: var(--space-lg);
  background-color: white;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.segment-btn {
  background-color: var(--bg-muted);
  border: 2px solid transparent;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  min-width: 180px;
  font-family: var(--font-body);
}

.segment-btn:hover {
  border-color: var(--cta-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.segment-btn.active {
  background-color: var(--cta-primary);
  color: white;
  border-color: var(--cta-primary);
}

.segment-btn .icon {
  font-size: 2rem;
}

.segment-btn .label {
  font-weight: 500;
  font-size: 0.95rem;
}

.segment-btn .description {
  font-size: 0.8rem;
  opacity: 0.8;
  text-align: center;
}

/* Segment Content */
.segment-content {
  display: none;
  padding: var(--space-lg);
  background-color: white;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--text-accent);
  margin-bottom: var(--space-lg);
}

.segment-content.active {
  display: block;
}

/* Exercise Cards */
.exercise-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.exercise-card {
  background-color: white;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
}

.exercise-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--cta-primary);
}

.exercise-card h3 {
  margin-top: 0;
  color: var(--text-primary);
}

.exercise-card p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  font-size: 0.95rem;
  flex-grow: 1;
}

.exercise-card .excerpt {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  font-size: 0.95rem;
  flex-grow: 1;
}

.exercise-card .btn-primary {
  width: 100%;
  text-align: center;
  margin-top: auto;
}

/* Callout Boxes */
.callout {
  display: flex;
  gap: 16px;
  padding: 24px;
  border-radius: 8px;
  border-left: 4px solid;
  margin: 24px 0;
}

.callout-tip {
  background: rgba(233, 167, 75, 0.08);
  border-color: var(--highlight-tip);
}

.callout-example {
  background: rgba(58, 140, 132, 0.08);
  border-color: var(--highlight-example);
}

.callout-warning {
  background: rgba(230, 82, 74, 0.08);
  border-color: var(--highlight-warning);
}

.callout-info {
  background: rgba(61, 122, 230, 0.08);
  border-color: var(--highlight-info);
}

.callout__icon {
  font-size: 24px;
  flex-shrink: 0;
}

/* Code Block with Copy Button */
.code-block {
  position: relative;
  background: rgba(61, 122, 230, 0.08); /* Sky Azure 8% */
  border-radius: 8px;
  padding: 24px;
  margin: 24px 0;
}

.code-block pre {
  font-family: var(--font-code);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--cta-primary);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px; /* Touch target */
  min-width: 80px;
  transition: all 0.2s ease;
}

.copy-btn:hover {
  background: var(--cta-hover);
}

.copy-btn.copied {
  background: var(--auto-high);
  color: white;
}

/* Quality Rating Widget */
.quality-rating {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin: var(--space-md) 0;
}

.quality-rating label {
  font-weight: 500;
  margin-right: var(--space-sm);
}

.rating-stars {
  display: flex;
  gap: 0.25rem;
}

.rating-star {
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.2s ease;
}

.rating-star.active,
.rating-star:hover {
  opacity: 1;
}

/* Worksheet Area */
.worksheet {
  background-color: white;
  border: 2px dashed var(--bg-muted);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-md) 0;
}

.worksheet textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-sm);
  border: 1px solid var(--bg-muted);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  resize: vertical;
}

.worksheet textarea:focus {
  outline: none;
  border-color: var(--cta-primary);
}

/* Context Layers */
.context-layers {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.context-layer {
  background-color: white;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  border-left: 4px solid var(--text-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.context-layer h3 {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.layer-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background-color: var(--cta-primary);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: 1rem;
}

/* Progress Bar */
.progress-summary {
  background-color: white;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin: var(--space-xl) 0;
}

.progress-summary table {
  width: 100%;
  border-collapse: collapse;
}

.progress-summary th,
.progress-summary td {
  padding: var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--bg-muted);
}

.progress-summary th {
  font-weight: 600;
  color: var(--text-accent);
}

/* Automation Traffic Lights */
.automation-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
}

.automation-high {
  background-color: rgba(94, 127, 91, 0.15);
  color: var(--auto-high);
}

.automation-medium {
  background-color: rgba(233, 167, 75, 0.15);
  color: var(--auto-medium);
}

.automation-low {
  background-color: rgba(193, 94, 61, 0.15);
  color: var(--auto-low);
}

/* Reflection Section */
.reflection-section {
  background-color: var(--bg-accent);
  padding: var(--space-xl);
  border-radius: var(--radius-md);
  margin: var(--space-xl) 0;
}

.reflection-section h2 {
  margin-top: 0;
}

.reflection-question {
  margin-bottom: var(--space-lg);
}

.reflection-question h4 {
  color: var(--text-accent);
  margin-bottom: var(--space-sm);
}

/* Key Takeaway Box */
.key-takeaway {
  background-color: var(--cta-primary);
  color: white;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  margin: var(--space-xl) 0;
  text-align: center;
  box-shadow: 0 4px 16px rgba(230, 82, 74, 0.3);
}

.key-takeaway h2 {
  color: white;
  margin-top: 0;
  font-size: 2rem;
}

.key-takeaway p {
  font-size: 1.1rem;
  line-height: 1.7;
}

/* Exercise Content Spacing */
.exercise-content {
  line-height: 1.75;
}

.exercise-content h2 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--bg-muted);
}

.exercise-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.exercise-content h3 {
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

.exercise-content ul, .exercise-content ol {
  margin-left: var(--space-4);
  margin-bottom: var(--space-3);
}

.exercise-content li {
  margin-bottom: var(--space-1);
}

.exercise-content p {
  margin-bottom: var(--space-3);
}

.exercise-content hr {
  margin: var(--space-5) 0;
  border: none;
  border-top: 2px solid var(--bg-muted);
}

.exercise-content blockquote {
  margin: var(--space-3) 0;
  padding-left: var(--space-3);
  border-left: 4px solid var(--text-accent);
  color: var(--text-primary);
  font-style: italic;
}

.exercise-content pre {
  background-color: rgba(61, 122, 230, 0.08);
  padding: var(--space-3);
  border-radius: 8px;
  overflow-x: auto;
  margin: var(--space-3) 0;
}

.exercise-content code {
  font-family: var(--font-code);
  font-size: 0.9em;
}

.exercise-content pre code {
  background: none;
  padding: 0;
}

.exercise-content :not(pre) > code {
  background-color: rgba(61, 122, 230, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

.exercise-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-3) 0;
}

.exercise-content th,
.exercise-content td {
  padding: var(--space-2);
  text-align: left;
  border-bottom: 1px solid var(--bg-muted);
}

.exercise-content th {
  font-weight: 600;
  color: var(--text-accent);
}

/* Scenario Cards (for Exercises 5 & 6) */
.scenario-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
  margin: var(--space-5) 0;
}

.scenario-card {
  background-color: white;
  border: 3px solid var(--bg-muted);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.scenario-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(230, 82, 74, 0.2);
  border-color: var(--cta-primary);
}

.scenario-icon {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: var(--space-2);
}

.scenario-card h3 {
  color: var(--text-accent);
  font-size: 1.3rem;
  margin: 0;
  line-height: 1.3;
}

.scenario-card p {
  color: var(--text-primary);
  font-size: 1rem;
  margin: 0;
  flex-grow: 1;
}

.scenario-card .btn {
  margin-top: var(--space-2);
  width: 100%;
  font-size: 1.1rem;
  padding: var(--space-3);
}

.scenario-card .btn:hover {
  transform: scale(1.05);
}

/* Tablet Responsiveness */
@media (max-width: 1024px) {
  .exercise-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .scenario-cards {
    grid-template-columns: 1fr;
  }
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
  .segment-selector {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .segment-btn {
    min-width: 100%;
  }

  .exercise-list {
    grid-template-columns: 1fr;
  }

  .quality-rating {
    flex-direction: column;
    align-items: flex-start;
  }
}
