/* ========================================
   Local Business Audit — Styles
   Colors: #f0fdf4 (bg), #16a34a (green), #dc2626 (red), #2563eb (blue)
   ======================================== */

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

:root {
  --bg: #f0fdf4;
  --bg-white: #ffffff;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --yellow-500: #eab308;
  --orange-500: #f97316;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  padding: 24px 0 16px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green-800);
  line-height: 1.2;
}

.logo-tagline {
  font-size: 0.875rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* Input Section */
.input-section {
  margin: 16px 0 32px;
}

.input-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--green-200);
}

.input-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.input-subtitle {
  color: var(--gray-500);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.audit-form .form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.form-group {
  flex: 1;
}

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

.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
  background: var(--bg-white);
}

.form-group input::placeholder {
  color: var(--gray-400);
}

.submit-btn {
  width: 100%;
  padding: 14px 24px;
  background: var(--green-600);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.submit-btn:hover {
  background: var(--green-700);
}

.submit-btn:active {
  transform: scale(0.98);
}

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

.btn-spinner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.spinner {
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

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

.hidden {
  display: none !important;
}

/* Results Section */
.results-section {
  margin-bottom: 32px;
  animation: fadeIn 0.4s ease;
}

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

/* Overall Score Header */
.score-header {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 40px;
  margin-bottom: 20px;
  border: 1px solid var(--green-100);
}

.score-chart-area {
  position: relative;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
}

.score-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-number {
  display: block;
  font-size: 3rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.score-grade {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-top: 4px;
}

.score-info {
  flex: 1;
}

.report-business {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.report-city {
  color: var(--gray-500);
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.comparison-badges {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.badge {
  display: flex;
  flex-direction: column;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  min-width: 120px;
}

.badge-city {
  background: var(--green-50);
  border: 1px solid var(--green-200);
}

.badge-industry {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.badge-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-800);
}

.export-btn {
  padding: 8px 20px;
  background: var(--bg-white);
  color: var(--green-600);
  border: 1.5px solid var(--green-600);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.export-btn:hover {
  background: var(--green-600);
  color: white;
}

/* Categories Card */
.categories-card,
.recommendations-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
  border: 1px solid var(--green-100);
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 20px;
}

/* Category Item */
.category-item {
  margin-bottom: 24px;
}

.category-item:last-child {
  margin-bottom: 0;
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.category-name {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.95rem;
}

.category-score-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.category-score {
  font-weight: 700;
  font-size: 1rem;
}

.category-grade {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  color: white;
}

.grade-a { background: var(--green-600); }
.grade-b { background: var(--green-500); }
.grade-c { background: var(--yellow-500); color: var(--gray-800); }
.grade-d { background: var(--orange-500); }
.grade-f { background: var(--red-600); }

.progress-bar-track {
  width: 100%;
  height: 10px;
  background: var(--gray-100);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s ease;
}

.findings-list {
  list-style: none;
  padding: 0;
}

.findings-list li {
  font-size: 0.85rem;
  color: var(--gray-600);
  padding: 3px 0 3px 18px;
  position: relative;
}

.findings-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-300);
}

/* Recommendations */
.recommendation-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--gray-100);
}

.recommendation-item:last-child {
  margin-bottom: 0;
}

.rec-priority {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green-600);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.rec-content {
  flex: 1;
}

.rec-action {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.rec-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rec-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.impact-high { background: #fef2f2; color: var(--red-600); border: 1px solid #fecaca; }
.impact-medium { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.impact-low { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-200); }
.effort-low { background: #eff6ff; color: var(--blue-600); border: 1px solid #bfdbfe; }
.effort-medium { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.effort-high { background: #fef2f2; color: var(--red-600); border: 1px solid #fecaca; }

.rec-category {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 4px;
}

/* History Section */
.history-section {
  margin-bottom: 32px;
}

.history-list {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--green-100);
  overflow: hidden;
}

.history-empty {
  padding: 24px;
  text-align: center;
  color: var(--gray-400);
  font-size: 0.9rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.15s;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background: var(--green-50);
}

.history-info {
  display: flex;
  flex-direction: column;
}

.history-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 0.95rem;
}

.history-city {
  font-size: 0.8rem;
  color: var(--gray-400);
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-score {
  font-weight: 700;
  font-size: 1.1rem;
}

.history-date {
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* Signup Section */
.signup-section {
  margin-bottom: 40px;
}

.signup-card {
  background: var(--green-800);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: white;
}

.signup-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.signup-subtitle {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 20px;
}

.signup-form {
  display: flex;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}

.signup-form input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: rgba(255,255,255,0.15);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
}

.signup-form input::placeholder {
  color: rgba(255,255,255,0.5);
}

.signup-form input:focus {
  outline: none;
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
}

.signup-btn {
  padding: 12px 24px;
  background: white;
  color: var(--green-800);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.signup-btn:hover {
  opacity: 0.9;
}

.signup-message {
  margin-top: 12px;
  font-size: 0.85rem;
}

.signup-message.success { color: var(--green-200); }
.signup-message.error { color: #fca5a5; }

/* Footer */
.footer {
  text-align: center;
  padding: 24px 0;
  color: var(--gray-400);
  font-size: 0.8rem;
  border-top: 1px solid var(--green-100);
}

/* Score colors */
.score-excellent { color: var(--green-600); }
.score-good { color: var(--green-500); }
.score-average { color: var(--yellow-500); }
.score-poor { color: var(--orange-500); }
.score-critical { color: var(--red-600); }

.bar-excellent { background: var(--green-600); }
.bar-good { background: var(--green-500); }
.bar-average { background: var(--yellow-500); }
.bar-poor { background: var(--orange-500); }
.bar-critical { background: var(--red-600); }

/* Error state */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  color: var(--red-600);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error-message svg {
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 680px) {
  .container {
    padding: 0 16px;
  }

  .audit-form .form-row {
    flex-direction: column;
    gap: 12px;
  }

  .input-card {
    padding: 24px 20px;
  }

  .score-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 24px;
    padding: 24px 20px;
  }

  .score-chart-area {
    width: 180px;
    height: 180px;
  }

  .score-number {
    font-size: 2.5rem;
  }

  .comparison-badges {
    justify-content: center;
  }

  .categories-card,
  .recommendations-card {
    padding: 20px;
  }

  .recommendation-item {
    flex-direction: column;
    gap: 10px;
  }

  .signup-form {
    flex-direction: column;
  }

  .history-item {
    padding: 12px 16px;
  }
}

@media (max-width: 400px) {
  .logo-text {
    font-size: 1.2rem;
  }

  .input-title {
    font-size: 1.25rem;
  }

  .comparison-badges {
    flex-direction: column;
  }
}
