/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --primary: #6c3fa0;
  --primary-hover: #5a2d8e;
  --primary-light: #ede7f6;
  --accent: #8e44ad;
  --danger: #e74c3c;
  --success: #2ecc71;
  --border: #e5e7eb;
  --shadow: 0 2px 16px rgba(108, 63, 160, 0.08);
  --shadow-lg: 0 8px 32px rgba(108, 63, 160, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--primary-hover); }

button {
  cursor: pointer;
  font-family: var(--font);
}

input {
  font-family: var(--font);
}

/* === Navbar === */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.navbar-brand svg {
  flex-shrink: 0;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.navbar-links .btn-nav {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
}

.navbar-links .btn-nav:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.navbar-links .btn-nav-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.navbar-links .btn-nav-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* === Layout === */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

main {
  flex: 1;
}

/* === Hero === */
.hero {
  text-align: center;
  padding: 80px 24px 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 32px;
}

/* === Forms === */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  max-width: 460px;
  margin: 0 auto;
}

.form-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}

.form-card .form-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  background: var(--bg);
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 63, 160, 0.12);
}

.form-group input.error {
  border-color: var(--danger);
}

.form-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 4px;
  min-height: 1.2em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

/* === Spinner === */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Toast / Alerts === */
.toast {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 200;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.toast-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* === Success State === */
.success-state {
  text-align: center;
  padding: 40px 20px;
}

.success-state .checkmark {
  width: 72px;
  height: 72px;
  background: #ecfdf5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.success-state .checkmark svg {
  color: var(--success);
}

.success-state h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.success-state p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* === Signup Counter === */
.signup-counter {
  text-align: center;
  padding: 40px 24px;
}

.signup-counter h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.signup-counter .count {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
}

/* === App Page === */
.app-page {
  padding: 40px 24px;
}

.app-header {
  text-align: center;
  margin-bottom: 32px;
}

.app-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.app-header p {
  color: var(--text-muted);
}

.search-bar {
  display: flex;
  gap: 12px;
  max-width: 520px;
  margin: 0 auto 20px;
}

.search-bar input {
  flex: 1;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  background: var(--surface);
  transition: border-color 0.2s;
}

.search-bar input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 63, 160, 0.12);
}

.search-bar input::placeholder {
  color: #c0c0c0;
}

.search-bar .btn-primary {
  width: auto;
  white-space: nowrap;
}

/* === Report Card === */
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  max-width: 640px;
  margin: 24px auto 0;
  display: none;
}

.report-card.visible {
  display: block;
  animation: fadeUp 0.4s ease;
}

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

.report-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.report-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.report-user h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.report-user span {
  font-size: 0.85rem;
  opacity: 0.85;
}

.report-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.score-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.score-circle .label {
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.score-low {
  background: #fef2f2;
  color: var(--danger);
}

.score-medium {
  background: #fffbeb;
  color: #d97706;
}

.score-high {
  background: #ecfdf5;
  color: var(--success);
}

.verdict {
  text-align: center;
}

.verdict h4 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.verdict p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.report-details {
  padding: 24px;
}

.report-details h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.detail-item .detail-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.detail-icon.yes {
  background: #ecfdf5;
  color: var(--success);
}

.detail-icon.no {
  background: #f3f4f6;
  color: var(--text-muted);
}

.detail-icon.neutral {
  background: var(--primary-light);
  color: var(--primary);
}

.detail-text strong {
  display: block;
  font-size: 0.85rem;
}

.detail-text span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.report-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === Loading === */
.loading-overlay {
  display: none;
  text-align: center;
  padding: 60px 20px;
}

.loading-overlay.visible {
  display: block;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

.loading-text {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* === Footer === */
.footer {
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === Page === */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* === Responsive === */
@media (max-width: 768px) {
  .navbar {
    padding: 0 16px;
  }

  .hero {
    padding: 48px 16px 32px;
  }

  .form-card {
    padding: 28px 24px;
    margin: 0 16px;
  }

  .search-bar {
    flex-direction: column;
    padding: 0 16px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .report-header {
    padding: 20px;
  }
}
