/*
 * Spectrum - Future Tech Ideology Survey
 * Custom CSS with dark theme
 */

/* CSS Variables */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #252542;
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0b0;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --success: #00cec9;
  --warning: #fdcb6e;
  --danger: #ff7675;
}

/* Reset and Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.spectrum-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  margin-bottom: 20px;
}

.header-logo {
  text-decoration: none;
}

.header-title {
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.restart-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.restart-link:hover {
  color: var(--danger);
}

/* Language Toggle */
.lang-toggle {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-card);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-toggle:hover {
  background: var(--bg-card);
  border-color: var(--accent);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.alert-danger {
  background: rgba(255, 118, 117, 0.15);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.alert-success {
  background: rgba(0, 206, 201, 0.15);
  color: var(--success);
  border: 1px solid var(--success);
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--accent);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  font-weight: 500;
  pointer-events: none;
  animation: toast-fade-in-out 4s forwards;
  border: 1px solid var(--accent-light);
}

@keyframes toast-fade-in-out {
  0% { opacity: 0; transform: translateY(-20px) scale(0.9); }
  10% { opacity: 1; transform: translateY(0) scale(1); }
  85% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-20px) scale(0.9); visibility: hidden; }
}

/* Start Screen */
.start-screen {
  text-align: center;
  padding: 60px 20px;
}

.start-screen h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--accent-light), var(--success));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.start-screen .subtitle {
  color: var(--text-secondary);
  font-size: 1.2rem;
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.feature-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 40px 0;
  text-align: left;
}

.feature-item {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.feature-title {
  font-weight: 600;
  margin-bottom: 5px;
}

.feature-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.start-btn {
  padding: 18px 50px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
}

.start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(108, 92, 231, 0.4);
}

.question-count {
  color: var(--text-secondary);
  margin-top: 15px;
  font-size: 0.95rem;
}

/* Progress Bar */
.progress-container {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 30px;
  position: sticky;
  top: 10px;
  z-index: 100;
}

.progress-bar {
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 0.3s ease;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Question Card */
.question-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 30px;
  margin-bottom: 20px;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.question-category {
  color: var(--accent-light);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.question-number {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.question-text {
  font-size: 1.3rem;
  line-height: 1.5;
  margin-bottom: 30px;
}

/* Likert Scale */
.likert-scale {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.custom-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--bg-card);
  border-radius: 12px;
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option-btn:hover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.1);
}

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.likert-labels {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.likert-options {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.likert-options.five-options {
  gap: 8px;
}

.likert-option {
  flex: 1;
  aspect-ratio: 1;
  max-width: 60px;
  border: 2px solid var(--bg-card);
  border-radius: 12px;
  background: transparent;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.five-options .likert-option {
  aspect-ratio: auto;
  max-width: none;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.likert-option:hover {
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.1);
}

.likert-option.selected {
  border-color: var(--accent);
  background: var(--accent);
  transform: scale(1.1);
}

.likert-option.strongly-low { --option-color: #e17055; }
.likert-option.low { --option-color: #ff7675; }
.likert-option.mid { --option-color: #fdcb6e; }
.likert-option.high { --option-color: #00cec9; }
.likert-option.strongly-high { --option-color: #00b894; }

.likert-option.selected.strongly-low { background: var(--option-color); border-color: var(--option-color); }
.likert-option.selected.low { background: var(--option-color); border-color: var(--option-color); }
.likert-option.selected.mid { background: var(--option-color); border-color: var(--option-color); }
.likert-option.selected.high { background: var(--option-color); border-color: var(--option-color); }
.likert-option.selected.strongly-high { background: var(--option-color); border-color: var(--option-color); }

/* Navigation */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 15px;
}

.nav-btn {
  flex: 1;
  padding: 15px 30px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
}

.nav-btn.prev {
  background: var(--bg-card);
  color: var(--text-primary);
}

.nav-btn.next {
  background: var(--accent);
  color: white;
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nav-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(108, 92, 231, 0.3);
}

/* Results Page */
.results {
  animation: fadeIn 0.5s ease;
}

/* Analytics */
.analytics {
  animation: fadeIn 0.5s ease;
}

.analytics-header {
  text-align: center;
  padding: 20px 10px 30px;
}

.analytics-subtitle {
  color: var(--text-secondary);
  margin-top: 8px;
}

.analytics-programs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.analytics-card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 20px;
}

.analytics-card-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.analytics-program-name {
  font-size: 1.3rem;
  font-weight: 700;
}

.analytics-program-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.analytics-section h3 {
  text-align: left;
  margin: 10px 0 12px;
}

.analytics-empty {
  color: var(--text-secondary);
  padding: 10px 0;
}

.analytics-clusters {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analytics-cluster-row {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 12px;
}

.analytics-cluster-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.analytics-cluster-name {
  font-weight: 600;
}

.analytics-cluster-right {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.analytics-count {
  color: var(--text-primary);
  font-weight: 700;
}

.analytics-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.analytics-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.result-header {
  text-align: center;
  padding: 40px 20px;
}

.result-header h2 {
  font-size: 2rem;
  margin-bottom: 10px;
}

.cluster-badge {
  display: inline-block;
  padding: 10px 25px;
  border-radius: 30px;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 20px 0;
  color: white;
}

.cluster-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.confidence-meter {
  margin: 30px auto;
  max-width: 300px;
}

.confidence-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.confidence-bar {
  height: 10px;
  background: var(--bg-card);
  border-radius: 5px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--warning), var(--success));
  transition: width 0.5s ease;
}

/* Traits */
.traits {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 30px;
  margin: 30px 0;
}

.traits h3 {
  margin-bottom: 20px;
  text-align: center;
}

.trait-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.trait-tag {
  padding: 8px 16px;
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 0.95rem;
}

/* Radar Chart Section */
.radar-section {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 30px;
  margin: 30px 0;
}

.radar-section h3 {
  margin-bottom: 20px;
  text-align: center;
}

.radar-container {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}

.radar-chart {
  max-width: 100%;
  height: auto;
}

.radar-grid {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 1;
}

.radar-axis {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1;
}

.radar-data {
  fill: rgba(108, 92, 231, 0.35);
  stroke: #6c5ce7;
  stroke-width: 2.5;
}

.radar-point {
  fill: #6c5ce7;
  stroke: #fff;
  stroke-width: 1;
}

.radar-label {
  fill: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
}

.radar-label .radar-score {
  fill: var(--accent-light);
  font-size: 12px;
  font-weight: 700;
}

/* Cluster Comparison */
.cluster-comparison {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 30px;
  margin: 30px 0;
}

.cluster-comparison h3 {
  margin-bottom: 20px;
  text-align: center;
}

.cluster-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cluster-item {
  display: flex;
  align-items: center;
  padding: 12px 15px;
  background: var(--bg-card);
  border-radius: 10px;
  gap: 15px;
}

.cluster-item.active {
  border: 2px solid var(--accent);
}

.cluster-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.cluster-item.active .cluster-rank {
  background: var(--accent);
}

.cluster-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.cluster-info {
  flex: 1;
}

.cluster-name {
  font-weight: 600;
}

.cluster-name-en {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.cluster-distance {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Actions */
.result-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 40px;
}

.action-btn {
  padding: 15px 30px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.action-btn.primary {
  background: var(--accent);
  color: white;
}

.action-btn.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (max-width: 600px) {
  .start-screen h1 {
    font-size: 1.8rem;
  }

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

  .likert-option {
    max-width: 45px;
    font-size: 0.95rem;
  }

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

  .app-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}
