@import url('fonts.css');

:root {
  --bg: #f0f7f4;
  --bg2: #e4f0ec;
  --card: #ffffff;
  --primary: #4a9e7e;
  --primary-light: #6bbf9e;
  --primary-dark: #367a5f;
  --accent: #7ecdb8;
  --accent2: #b8e6d6;
  --text: #2c3e36;
  --text-light: #5a7a6d;
  --text-muted: #8fa89c;
  --selected: #e0f5ec;
  --selected-border: #4a9e7e;
  --shadow: 0 2px 12px rgba(74,158,126,0.08);
  --shadow-lg: 0 8px 32px rgba(74,158,126,0.12);
  --radius: 12px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 1.5rem 2rem;
  color: white;
  text-align: center;
  box-shadow: 0 4px 20px rgba(74,158,126,0.2);
}

.app-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 600;
}

.app-header p {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.3rem;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 0.35rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 0.6rem 0.3rem;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-light);
  transition: all 0.25s;
  white-space: nowrap;
  text-align: center;
}

.tab:hover { background: var(--bg2); }

.tab.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(74,158,126,0.3);
}

.tab .badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  margin-left: 0.2rem;
  background: rgba(0,0,0,0.1);
  vertical-align: middle;
}

.tab.active .badge { background: rgba(255,255,255,0.25); }

.progress-wrap {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-light);
}

.progress-info strong { color: var(--primary-dark); font-size: 0.95rem; }

.progress-bar { height: 8px; background: var(--bg2); border-radius: 4px; overflow: hidden; }

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.question-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.3s ease;
}

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

.question-number {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  margin-bottom: 1rem;
}

.question-text {
  font-size: 1.1rem;
  line-height: 1.6;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.answers { display: flex; flex-direction: column; gap: 0.6rem; }

.answer-btn {
  display: block;
  width: 100%;
  padding: 0.85rem 1.1rem;
  border: 2px solid var(--bg2);
  background: var(--bg);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: all 0.2s;
}

.answer-btn:hover {
  border-color: var(--accent);
  background: var(--accent2);
  transform: translateX(4px);
}

.answer-btn.selected {
  border-color: var(--selected-border);
  background: var(--selected);
  color: var(--primary-dark);
  box-shadow: 0 0 0 1px var(--selected-border);
}

.answers-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }

.answers-grid .answer-btn {
  text-align: center;
  padding: 1rem 0.4rem;
  font-size: 0.82rem;
  line-height: 1.3;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.2rem;
  gap: 0.6rem;
}

.nav-btn {
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.nav-btn.prev { background: var(--bg2); color: var(--text-light); }
.nav-btn.prev:hover { background: var(--accent2); }

.nav-btn.next {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(74,158,126,0.3);
}

.nav-btn.next:hover { background: var(--primary-dark); }
.nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }

.tool-btn {
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--bg2);
  background: var(--card);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-light);
  transition: all 0.2s;
}

.tool-btn:hover { border-color: var(--primary); color: var(--primary); }

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

.tool-btn.accent:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal h3 {
  margin-bottom: 1rem;
  color: var(--primary-dark);
  font-family: 'Playfair Display', serif;
}

.modal input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 2px solid var(--bg2);
  border-radius: var(--radius);
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}

.modal input:focus { border-color: var(--primary); }
.modal .error { color: #d9534f; font-size: 0.82rem; margin-bottom: 0.5rem; }

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bg2);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg2);
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.dot.answered { background: var(--accent); }
.dot.current { background: var(--primary); transform: scale(1.3); }

.hidden { display: none; }

/* Overview mode */
.overview {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.overview-row {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  box-shadow: var(--shadow);
}

.overview-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.overview-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.overview-row .answers-grid .answer-btn {
  padding: 0.5rem 0.3rem;
  font-size: 0.75rem;
}

.overview-row .answers .answer-btn {
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
}

@media (max-width: 500px) {
  .answers-grid { grid-template-columns: repeat(2, 1fr); }
  .tabs { gap: 0.2rem; padding: 0.25rem; }
  .tab { font-size: 0.75rem; padding: 0.5rem 0.2rem; }
}
