/* Design Tokens */
:root {
  --bg-gradient: linear-gradient(180deg, #09090b 0%, #111115 100%);
  --panel-bg: rgba(25, 25, 35, 0.65);
  --panel-border: rgba(255, 255, 255, 0.08);
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-glow: rgba(124, 58, 237, 0.3);
  --accent: #2563eb;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  width: 380px;
  overflow-x: hidden;
  font-size: 13px;
  line-height: 1.5;
}

/* Scrollbar styling */
.scrollable::-webkit-scrollbar {
  width: 4px;
}
.scrollable::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 4px;
}
.scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
.scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Layout */
.popup-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 480px;
  max-height: 580px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
  margin-bottom: 16px;
}

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

.logo-icon {
  width: 24px;
  height: 24px;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge {
  background: rgba(124, 58, 237, 0.15);
  color: #c084fc;
  border: 1px solid rgba(124, 58, 237, 0.3);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Forms & UI Elements */
.intro-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #fff;
}

.description {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 16px;
}

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

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.input-wrapper input,
select {
  width: 100%;
  background: rgba(20, 20, 25, 0.8);
  border: 1px solid var(--panel-border);
  color: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s ease;
}

.input-wrapper input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
  background: rgba(25, 25, 30, 0.9);
}

/* Buttons */
.btn {
  width: 100%;
  padding: 11px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 0;
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-back:hover {
  color: #fff;
}

/* Footer Link */
.footer-note {
  text-align: center;
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-muted);
}

.footer-note a {
  color: var(--primary);
  text-decoration: none;
}

.footer-note a:hover {
  text-decoration: underline;
}

/* Loading View */
.loading-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 10px;
}

.loader-container {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 24px;
}

.pulse-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: pulse 1.8s infinite ease-in-out;
  opacity: 0;
}

.loader-core {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 80px;
  height: 80px;
  background: rgba(20, 20, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.spinning-logo {
  width: 48px;
  height: 48px;
  animation: float 3s infinite ease-in-out;
}

.loading-view h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.loading-view p {
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 20px;
}

.progress-bar-container {
  width: 180px;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}

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

/* Results View */
.results-view {
  animation: fadeIn 0.4s ease;
}

.score-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}

.score-ring-container {
  position: relative;
  width: 58px;
  height: 58px;
}

.score-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 3.5;
}

.ring-fill {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.8s ease;
}

.score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

#score-percent {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.score-label {
  font-size: 7px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.score-summary h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.score-summary p {
  font-size: 11px;
  color: var(--text-muted);
}

/* Lists */
.lists-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.list-section {
  background: rgba(20, 20, 25, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.list-section h5 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--success);
}

.list-section h5.warning-header {
  color: var(--warning);
}

.town-list {
  height: 110px;
  overflow-y: auto;
  font-size: 11px;
}

.town-item {
  padding: 4px 6px;
  border-radius: 4px;
  margin-bottom: 3px;
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.town-item.found-item {
  border-left: 2px solid var(--success);
}

.town-item.missed-item {
  border-left: 2px solid var(--warning);
}

/* Lead Capture CTA Card */
.cta-card {
  background: rgba(124, 58, 237, 0.06);
  border: 1px dashed rgba(124, 58, 237, 0.3);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
}

.cta-card h5 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
  color: #c084fc;
}

.cta-card p {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.lead-form-inline {
  display: flex;
  gap: 6px;
}

.lead-form-inline input {
  flex: 1;
  background: rgba(10, 10, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  outline: none;
}

.lead-form-inline button {
  padding: 6px 12px;
  font-size: 11px;
  white-space: nowrap;
  background: var(--primary);
  border: none;
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

.success-message {
  font-size: 11px;
  color: var(--success);
  font-weight: 500;
  margin-top: 4px;
}

/* Action Footer */
.action-footer {
  margin-top: auto;
}

.btn-pulse {
  animation: buttonGlow 2.5s infinite;
}

/* Animations */
@keyframes pulse {
  0% {
    transform: scale(0.85);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

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

@keyframes buttonGlow {
  0%, 100% {
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  }
  50% {
    box-shadow: 0 4px 24px rgba(124, 58, 237, 0.7);
  }
}

/* Spin animation for spinner */
.icon-spin {
  animation: spin 1s linear infinite;
}

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