@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #dc2626;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --color-red: #ef4444;
  --color-red-hover: #b91c1c;
  --color-red-glow: rgba(239, 68, 68, 0.15);
  
  --color-rose: #f43f5e;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 20px 0 rgba(239, 68, 68, 0.08);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(239, 68, 68, 0.04) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(220, 38, 38, 0.02) 0px, transparent 50%);
  background-attachment: fixed;
}

.survey-container {
  width: 100%;
  max-width: 540px;
  padding: 1.5rem;
  transition: max-width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Card layout & animations */
.card {
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  transition: var(--transition-normal);
  display: none;
}

.card.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.emoji-header {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  animation: bounce 2s infinite ease-in-out;
}

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

.survey-question {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 2rem;
  color: var(--text-primary);
}

.options-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-normal);
  border: 1px solid var(--border-color);
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-red), var(--color-red-hover));
  color: white;
  border: none;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.btn-choice {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  justify-content: flex-start;
}

.choice-emoji {
  font-size: 1.3rem;
  transition: transform 0.2s ease;
}

.btn-choice:hover {
  transform: translateY(-2px);
  border-color: var(--color-red);
  background-color: rgba(239, 68, 68, 0.02);
  box-shadow: var(--shadow-glow);
}

.btn-choice:hover .choice-emoji {
  transform: scale(1.2);
}

.btn-secondary {
  background-color: rgba(0, 0, 0, 0.02);
  border-color: var(--border-color);
  color: var(--text-primary);
  margin-top: 1.5rem;
}

.btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

/* Follow-up Question styling */
.followup-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  text-align: left;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.followup-panel.active {
  display: flex;
}

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

.followup-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-control {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: var(--transition-fast);
  width: 100%;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-red-glow);
}

.followup-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Success / Results Screen */
.success-icon {
  width: 64px;
  height: 64px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--color-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
}

.success-icon svg {
  width: 32px;
  height: 32px;
}

.results-heading {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.results-subtext {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.results-poll {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-align: left;
}

.poll-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.poll-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.poll-label {
  font-weight: 600;
}

.poll-value {
  font-weight: 700;
  color: var(--text-primary);
}

.poll-track {
  width: 100%;
  height: 10px;
  background-color: rgba(0, 0, 0, 0.04);
  border-radius: 9999px;
  overflow: hidden;
}

.poll-fill {
  height: 100%;
  border-radius: 9999px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.fill-yes {
  background: linear-gradient(to right, var(--color-red), #fca5a5);
}

.fill-no {
  background: linear-gradient(to right, var(--text-secondary), var(--text-muted));
}

/* Earth Illustration styling */
.earth-container {
  width: 100%;
  max-width: 180px;
  margin: 1.75rem auto 1.25rem auto;
  border-radius: 50%;
  overflow: visible;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.25));
}

.earth-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Continents rotation animation simulating slow Earth spin */
.continents-group {
  animation: rotate-earth 24s linear infinite;
  transform-origin: 50px 50px;
}

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

/* Dynamic Admin Page Expansion */
body:has(#screen-admin.active) .survey-container {
  max-width: 900px;
}

body:has(#screen-admin.active) .survey-card {
  padding: 2.5rem;
}

/* Admin Dashboard screen styling */
.admin-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  animation: key-wiggle 1.5s infinite ease-in-out;
}

@keyframes key-wiggle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(15deg); }
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  width: 100%;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.3));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(239, 68, 68, 0.2);
}

.stat-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-count {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-red);
}

.admin-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.admin-actions .btn {
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
  flex: 1;
}

/* Spreadsheet log styling */
.spreadsheet-section {
  width: 100%;
  margin-top: 2rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.spreadsheet-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.btn-export {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-export svg {
  width: 14px;
  height: 14px;
}

.btn-export:hover {
  border-color: var(--color-red);
  color: var(--color-red);
  background-color: rgba(239, 68, 68, 0.02);
  transform: translateY(-1px);
}

.table-wrapper {
  max-height: 350px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: inset 0 2px 4px 0 rgba(0,0,0,0.01);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

th {
  background-color: #f1f5f9;
  color: var(--text-secondary);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: rgba(0, 0, 0, 0.005);
}

/* Badges for table */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-yes {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--color-red);
  border: 1px solid rgba(239, 68, 68, 0.15);
}
.badge-no {
  background-color: rgba(71, 85, 105, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(71, 85, 105, 0.15);
}

/* Custom scrollbars */
.table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 9999px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Toast message notification */
.toast {
  position: fixed;
  bottom: 2rem;
  background-color: var(--bg-secondary);
  border-left: 4px solid var(--color-red);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

.toast svg {
  width: 18px;
  height: 18px;
  stroke: var(--color-red);
}
