/* ==========================================================================
   ARE YOU HAPPY? - Ultra-Sober Monochrome Design System
   ========================================================================== */

/* Color Tokens & Reset */
:root {
  --bg-main: #f8fafc;        /* Off-White / Soft Light Slate */
  --bg-card: rgba(255, 255, 255, 0.92);
  --border-card: rgba(226, 232, 240, 0.85);
  --text-main: #0f172a;      /* Obsidian Charcoal Slate */
  --text-muted: #64748b;     /* Slate Gray */
  --text-subtle: #94a3b8;    /* Soft Muted Gray */
  
  /* Ultra-Sober Monochrome Palette */
  --btn-dark-bg: #0f172a;
  --btn-dark-hover: #1e293b;
  --btn-dark-text: #ffffff;
  
  --btn-light-bg: #ffffff;
  --btn-light-border: #cbd5e1;
  --btn-light-hover: #f1f5f9;
  --btn-light-text: #0f172a;
  
  --brand-blue: #0f172a;
  
  /* Progress Bar Sober Colors */
  --progress-yes-bg: #0f172a;    /* Primary Dark Slate */
  --progress-no-bg: #cbd5e1;     /* Soft Muted Slate */
  
  /* Discreet Smileys */
  --smiley-green: #059669;       /* Discrete Emerald Green */
  --smiley-red: #e11d48;         /* Discrete Rose Red */
  
  /* Radii & Shadows */
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shadow-glass: 0 20px 45px -10px rgba(15, 23, 42, 0.07), 0 1px 3px rgba(0, 0, 0, 0.03);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Background Soft Minimalist Mesh */
.background-wrapper {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  animation: floatOrb 22s ease-in-out infinite alternate;
}

.orb-1 {
  top: -15%;
  left: 10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #cbd5e1 0%, transparent 70%);
}

.orb-2 {
  bottom: -15%;
  right: 10%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #e2e8f0 0%, transparent 70%);
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(25px, 15px) scale(1.05); }
  100% { transform: translate(-15px, 30px) scale(0.96); }
}

/* App Shell Container */
.app-container {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

/* Top Navigation Bar */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
  user-select: none;
}

/* Language Selector */
.lang-selector-wrapper {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #ffffff;
  border: 1px solid var(--border-card);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition: var(--transition-fast);
}

.lang-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.1);
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  min-width: 170px;
  z-index: 50;
  animation: fadeInDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-dropdown.show {
  display: flex;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.lang-option:hover, .lang-option.active {
  background: #f1f5f9;
  color: var(--text-main);
  font-weight: 600;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Main Content Area */
.main-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-grow: 1;
  padding: 2rem 0;
}

/* Clean Minimal Card */
.glass-card {
  width: 100%;
  max-width: 620px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 3.25rem 2.25rem;
  text-align: center;
  transition: var(--transition-smooth);
  position: relative;
}

/* Global Live Poll Badge */
.global-poll-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  font-size: 0.725rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #0f172a;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Question Title */
.question-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 2.5rem;
  color: var(--text-main);
}

/* Sober Vote Buttons Section */
.vote-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  transition: var(--transition-smooth);
}

@media (min-width: 480px) {
  .vote-section {
    flex-direction: row;
    justify-content: center;
  }
}

.vote-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.25rem 2rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: var(--radius-md);
  cursor: pointer;
  outline: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

/* Solid Obsidian Dark YES Button */
.vote-btn-yes {
  background: var(--btn-dark-bg);
  color: var(--btn-dark-text);
  border: 1px solid var(--btn-dark-bg);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.vote-btn-yes:hover {
  background: var(--btn-dark-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

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

/* Clean Minimal Slate Border NO Button */
.vote-btn-no {
  background: var(--btn-light-bg);
  color: var(--btn-light-text);
  border: 1px solid var(--btn-light-border);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.vote-btn-no:hover {
  background: var(--btn-light-hover);
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

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

/* Tagline Disclaimer */
.tagline {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

/* Pre-Vote Total Counter */
.pre-vote-total {
  margin-top: 0.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Results Section */
.results-section {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.results-section.show {
  display: flex;
}

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

.your-vote-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 1.75rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

/* Percent Grid */
.percentages-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.percent-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.percent-value {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  line-height: 1;
  margin-bottom: 0.25rem;
  color: var(--text-subtle);
}

/* User-Selected Percent Card Highlight */
.percent-card.user-selected-card {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.percent-card.user-selected-card .percent-value {
  font-weight: 900;
  color: var(--text-main);
}

.percent-card.user-selected-card .percent-label {
  font-weight: 700;
  color: var(--text-main);
}

.percent-label-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.smiley-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.green-smiley-icon {
  color: var(--smiley-green);
}

.red-smiley-icon {
  color: var(--smiley-red);
}

.percent-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Sober Dual-Slate Progress Bar */
.progress-bar-outer {
  width: 100%;
  height: 16px;
  background: var(--progress-no-bg);
  border-radius: 9999px;
  overflow: hidden;
  display: flex;
  position: relative;
  margin-bottom: 1.5rem;
}

.progress-bar-yes {
  height: 100%;
  background: var(--progress-yes-bg);
  border-radius: 9999px 0 0 9999px;
  width: 0%;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar-no {
  height: 100%;
  background: var(--progress-no-bg);
  flex-grow: 1;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Voters Count */
.voters-total {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  font-weight: 500;
}

.voters-total span {
  color: var(--text-main);
  font-weight: 700;
}

/* Results Actions Row (Share & Change Vote) */
.results-actions-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 380px;
  align-items: center;
}

@media (min-width: 480px) {
  .results-actions-row {
    flex-direction: row;
    justify-content: center;
  }
}

/* Primary Share Button */
.share-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  background: var(--btn-dark-bg);
  color: var(--btn-dark-text);
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
}

.share-btn:hover {
  background: var(--btn-dark-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

/* Secondary Change Vote Button */
.change-vote-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--btn-light-border);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.change-vote-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-2px);
}

/* Buy Me a Coffee Button */
.coffee-wrapper {
  margin-top: 1.25rem;
}

.coffee-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  background: #fffbebf5;
  border: 1px solid #fef3c7;
  color: #b45309;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 9999px;
  text-decoration: none;
  transition: var(--transition-fast);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.08);
}

.coffee-btn:hover {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
  transform: translateY(-1px);
}

/* Share Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.2);
  position: relative;
  text-align: center;
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: #f1f5f9;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.share-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.social-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: #ffffff;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-fast);
}

.btn-x { background: #000000; }
.btn-x:hover { background: #1a1a1a; }

.btn-whatsapp { background: #25d366; }
.btn-whatsapp:hover { background: #20bd5a; }

.btn-linkedin { background: #0a66c2; }
.btn-linkedin:hover { background: #08529c; }

.btn-copy { background: #f1f5f9; color: var(--text-main); border: 1px solid #cbd5e1; }
.btn-copy:hover { background: #e2e8f0; }

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 200;
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1.5rem 0 0.5rem 0;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

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

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

/* RTL Support for Arabic */
html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

html[dir="rtl"] .modal-close-btn {
  right: auto;
  left: 1.25rem;
}

/* Mobile responsive styles */
@media (max-width: 480px) {
  .app-container {
    padding: 1rem;
  }
  .glass-card {
    padding: 2.25rem 1.25rem;
  }
  .question-title {
    margin-bottom: 1.75rem;
  }
  .share-options-grid {
    grid-template-columns: 1fr;
  }
}
