/* styles.css */

:root {
  --font-main: 'Inter', sans-serif;
  --bg-gradient: linear-gradient(135deg, #f0f4fd 0%, #faeff9 100%);
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(255, 255, 255, 0.6);
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --primary-color: #6366f1; /* Soft Indigo */
  --primary-hover: #4f46e5;
  --secondary-bg: #e0e7ff;
  --secondary-text: #4338ca;
  --accent-color: #f472b6; /* Soft Pink for warmth */
  --border-radius: 18px;
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
  --glow-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
  
  --likert-1: #fb7185; /* Strongly Disagree */
  --likert-2: #fca5a5;
  --likert-3: #d1d5db; /* Neutral */
  --likert-4: #86efac;
  --likert-5: #34d399; /* Strongly Agree */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

/* ==================================
   LAYOUT & CONTAINERS
   ================================== */

.app-container {
  width: 100%;
  max-width: 800px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 2rem 1rem;
}

.view {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  width: 100%;
}

.view.active-view {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  box-shadow: var(--glass-shadow);
  padding: 3rem 2.5rem;
  width: 100%;
  margin: auto;
}

/* ==================================
   BUTTONS & INPUTS
   ================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
}

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

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
  box-shadow: var(--glow-shadow);
  transform: scale(0.98);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.95);
}

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

.btn-secondary:hover:not(:disabled) {
  background-color: #c7d2fe;
}

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

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 1rem 1.2rem;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1rem;
  font-family: var(--font-main);
  background-color: white;
  transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ==================================
   INTRO VIEW
   ================================== */

.intro-card {
  text-align: center;
  max-width: 500px;
}

.intro-header .icon-wrap {
  width: 64px;
  height: 64px;
  background: var(--secondary-bg);
  color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 1.5rem auto;
}

.intro-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.intro-header .subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
}

.input-group {
  text-align: left;
  margin-bottom: 1.2rem;
}

.input-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

#start-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  margin-top: 1rem;
}

.disclaimer-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
  opacity: 0.8;
}

/* ==================================
   TEST VIEW
   ================================== */

#test-view.active-view {
  min-height: 80vh;
  justify-content: center;
}

.test-header {
  margin-bottom: 2rem;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  padding: 1rem 1.5rem;
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary-color);
  width: 0%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.tabs-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tab-dot {
  width: 32px;
  height: 6px;
  background-color: #cbd5e1;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.tab-dot.active {
  background-color: var(--primary-color);
  width: 48px;
}

.tab-dot.completed {
  background-color: var(--primary-color);
  opacity: 0.6;
}

.question-card {
  background: var(--card-bg);
  padding: 3rem 2rem;
  border-radius: var(--border-radius);
  box-shadow: var(--glass-shadow);
  text-align: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.question-card.fade-out {
  opacity: 0;
  transform: translateX(-20px);
}

.question-card.fade-in {
  opacity: 1;
  transform: translateX(0);
}

#question-text {
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 2.5rem;
  line-height: 1.4;
  color: var(--text-main);
}

/* Likert Scale Container */
.likert-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3rem;
  position: relative;
  gap: 1rem;
}

.likert-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  width: 80px;
}

.likert-options {
  display: flex;
  justify-content: space-between;
  flex: 1;
  position: relative;
}

/* Connect line */
.likert-options::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 2px;
  background: #e5e7eb;
  z-index: 0;
  transform: translateY(-50%);
}

.likert-option {
  position: relative;
  z-index: 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.likert-option input {
  display: none;
}

.radio-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  border: 3px solid #e5e7eb;
  transition: all 0.2s ease;
  display: inline-block;
}

.likert-option:hover .radio-btn {
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Colors for specific dots matched to size & meaning */
.likert-option[data-value="1"] .radio-btn { border-color: var(--likert-1); width: 44px; height: 44px; }
.likert-option[data-value="2"] .radio-btn { border-color: var(--likert-2); width: 36px; height: 36px; }
.likert-option[data-value="3"] .radio-btn { border-color: var(--likert-3); width: 30px; height: 30px; }
.likert-option[data-value="4"] .radio-btn { border-color: var(--likert-4); width: 36px; height: 36px; }
.likert-option[data-value="5"] .radio-btn { border-color: var(--likert-5); width: 44px; height: 44px; }

/* Checked State */
.likert-option input:checked + .radio-btn {
  background-color: currentColor;
  transform: scale(1.15);
}

.likert-option[data-value="1"] input:checked + .radio-btn { background-color: var(--likert-1); box-shadow: 0 0 15px rgba(251, 113, 133, 0.4); }
.likert-option[data-value="2"] input:checked + .radio-btn { background-color: var(--likert-2); }
.likert-option[data-value="3"] input:checked + .radio-btn { background-color: var(--likert-3); }
.likert-option[data-value="4"] input:checked + .radio-btn { background-color: var(--likert-4); }
.likert-option[data-value="5"] input:checked + .radio-btn { background-color: var(--likert-5); box-shadow: 0 0 15px rgba(52, 211, 153, 0.4); }


.test-actions {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #f3f4f6;
  padding-top: 1.5rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--primary-color);
  color: white;
  padding: 1rem 2rem;
  border-radius: 30px;
  box-shadow: var(--glow-shadow);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s ease;
  z-index: 100;
  font-weight: 500;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==================================
   RESULT VIEW
   ================================== */

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

.result-header h2 {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.result-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--glass-shadow);
}

.result-card h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-main);
  border-bottom: 2px solid #f3f4f6;
  padding-bottom: 0.5rem;
}

.chart-container {
  width: 100%;
  height: 300px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.score-list {
  list-style: none;
}

.score-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.8rem 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.95rem;
}

.score-list li:last-child {
  border-bottom: none;
}

.score-name {
  font-weight: 500;
}

.score-val {
  color: var(--primary-color);
  font-weight: 600;
}

.insight-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.insight-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  border-left: 4px solid var(--primary-color);
}

.insight-card:nth-child(2) {
  border-left-color: var(--accent-color);
}

.insight-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.insight-card ul {
  list-style: disc inside;
  color: var(--text-muted);
  line-height: 1.6;
}

.summary-section {
  background: var(--secondary-bg);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.summary-section h3 {
  margin-bottom: 0.8rem;
  color: var(--secondary-text);
}

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

.final-disclaimer {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.shadow-btn {
  box-shadow: var(--glow-shadow);
}

/* Responsive */
@media (max-width: 768px) {
  .result-grid, .insight-section {
    grid-template-columns: 1fr;
  }
  
  .likert-scale {
    flex-direction: column;
    gap: 1.5rem;
  }

  .likert-options {
    width: 100%;
  }

  .likert-label {
    width: auto;
  }
  
  .likert-options::before {
    top: 50%;
    transform: translateY(-50%);
  }
}
