/* CSS Custom Properties for theming */
:root {
  --primary-color: #0ea5e9;
  --primary-hover: #0284c7;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --error-color: #f59e0b;
  --border-radius: 8px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Container */
.container {
  width: 100%;
  max-width: 480px;
  background-color: var(--bg-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Header */
.header {
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
}

.headline-with-explainer {
  justify-content: center;
}

.logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: block;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 12px;
}

.business-name {
  font-size: 1.1rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 1rem;
  color: rgba(255, 255, 255, 0.8);
  font-style: italic;
}

.headline {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
}

.subhead {
  margin: 0;
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 400;
}

/* Main content */
.main {
  padding: 2rem 1.5rem;
}

/* Form styles */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.input,
.textarea {
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background-color: var(--bg-primary);
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

/* Star rating */
.star-rating {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  margin: 0.5rem 0;
}

.star {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.2s ease;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.star:hover,
.star:focus {
  background-color: rgba(14, 165, 233, 0.1);
  outline: none;
  transform: scale(1.1);
}

.star.filled {
  color: #fbbf24;
}

.star-icon {
  width: 32px;
  height: 32px;
  transition: all 0.2s ease;
}

/* Buttons */
.btn {
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

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

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

.btn-primary:disabled {
  background-color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-primary.enabled {
  animation: pulse 2s infinite;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

/* Links */
.link {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* User info display */
.user-info {
  background-color: var(--bg-secondary);
  padding: 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--primary-color);
}

.user-greeting {
  margin: 0 0 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

.rating-display {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Success messages */
.success-message {
  background-color: #ecfdf5;
  color: #065f46;
  padding: 1rem;
  border-radius: var(--border-radius);
  border: 1px solid #a7f3d0;
  text-align: center;
}

.success-message p {
  margin: 0;
  font-weight: 500;
}

/* Redirect message */
.redirect-message {
  text-align: center;
  padding: 1rem;
  color: var(--text-secondary);
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0.5rem auto 0;
}

/* Actions */
.actions {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Success toast */
.success-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: var(--success-color);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

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

/* Mobile optimizations */
@media (max-width: 640px) {
  body {
    padding: 0.5rem;
    align-items: flex-start;
    padding-top: 2rem;
  }
  
  .container {
    margin: 0;
  }
  
  .header {
    padding: 1.5rem 1rem 1rem;
  }
  
  .main {
    padding: 1.5rem 1rem;
  }
  
  .business-name {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }
  
  .headline {
    font-size: 1.25rem;
  }
  
  .star-icon {
    width: 28px;
    height: 28px;
  }
  
  .star {
    padding: 0.375rem;
  }
  
  .btn {
    min-height: 44px;
    padding: 0.75rem 1.25rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-secondary: #000000;
  }
  
  .input,
  .textarea {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Explainer buttons and tooltips */
.headline-with-explainer,
.label-with-explainer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.explainer-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header .explainer-btn {
  color: rgba(255, 255, 255, 0.7);
}

.main .explainer-btn {
  color: var(--text-secondary);
}

.explainer-btn:hover,
.explainer-btn:focus {
  background-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 1);
  outline: none;
  transform: scale(1.1);
}

.main .explainer-btn:hover,
.main .explainer-btn:focus {
  background-color: rgba(14, 165, 233, 0.1);
  color: var(--primary-color);
}

.explainer-icon {
  width: 16px;
  height: 16px;
}

.tooltip {
  position: fixed;
  z-index: 1000;
  background-color: var(--text-primary);
  color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition: all 0.2s ease;
  max-width: 280px;
  pointer-events: none;
}

.tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  pointer-events: auto;
}

.tooltip-content {
  padding: 1rem;
  position: relative;
}

.tooltip-content p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.tooltip-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.tooltip-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

/* Checkbox styles */
.checkbox-container {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  position: relative;
}

.checkbox {
  opacity: 0;
  position: absolute;
  cursor: pointer;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
  margin-top: 0.125rem;
}

.checkbox:checked + .checkmark {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.checkbox:checked + .checkmark::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox:focus + .checkmark {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.checkbox-label {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* CTA Panel */
.cta-panel {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 2rem 1.5rem;
  margin-top: 2rem;
}

.cta-content {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.cta-headline {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.cta-subhead {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  opacity: 0.9;
  line-height: 1.4;
}

.btn-cta {
  background-color: white;
  color: var(--primary-color);
  font-weight: 600;
  padding: 1rem 2rem;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.btn-cta:hover {
  background-color: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Mobile optimizations for new components */
@media (max-width: 640px) {
  .tooltip {
    max-width: calc(100vw - 2rem);
    left: 1rem !important;
    right: 1rem;
    width: auto;
  }
  
  .cta-panel {
    padding: 1.5rem 1rem;
  }
  
  .cta-headline {
    font-size: 1.1rem;
  }
  
  .cta-subhead {
    font-size: 0.9rem;
  }
  
  .btn-cta {
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
  }
  
  .explainer-icon {
    width: 14px;
    height: 14px;
  }
  
  .checkbox-label {
    font-size: 0.85rem;
  }
}

/* FTC Compliance Panels */
.rr-panel {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 2rem;
  background-color: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
  margin-top: 2rem;
}

.rr-apology-panel,
.rr-success-panel {
  display: none;
}

.panel-heading {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

.panel-text {
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.5;
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.redirect-notice {
  background-color: #f0f9ff;
  color: #0369a1;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  border: 1px solid #bae6fd;
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.btn-secondary {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-secondary);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.btn-success {
  background-color: var(--success-color) !important;
  color: white !important;
}

.demo-redirect-message {
  text-align: center;
  padding: 1rem;
}

.demo-redirect-message .panel-heading {
  color: var(--success-color);
  margin-bottom: 1.5rem;
}

.demo-redirect-message .panel-text {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

/* Mobile optimizations for panels */
@media (max-width: 640px) {
  .rr-panel {
    padding: 1.5rem 1rem;
    margin-top: 1.5rem;
  }
  
  .panel-heading {
    font-size: 1.2rem;
  }
  
  .panel-actions {
    gap: 0.5rem;
  }
  
  .panel-actions .btn {
    width: 100%;
    max-width: 280px;
  }
}

/* Focus indicators for accessibility */
.star:focus-visible,
.btn:focus-visible,
.input:focus-visible,
.textarea:focus-visible,
.explainer-btn:focus-visible,
.checkbox:focus-visible + .checkmark {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}
