/* ============================
   SONDAGE VACANCES FAMILLE 2025
   style.css
   ============================ */

/* --- Variables & Reset --- */
:root {
  --papa:   #3B82F6;
  --maman:  #EC4899;
  --clem:   #10B981;
  --margot: #F59E0B;

  --bg-start: #FFF8F0;
  --bg-end:   #FFE4B5;
  --card-bg:  #FFFFFF;
  --text:     #2D3748;
  --text-light: #718096;
  --border:   #E2E8F0;
  --shadow:   0 4px 20px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.15);
  --radius:   16px;
  --radius-sm: 10px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Nunito', 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-start) 0%, var(--bg-end) 100%);
  min-height: 100vh;
  color: var(--text);
  overflow-x: hidden;
}

/* --- App Shell --- */
#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
  position: relative;
}

/* --- Screen transitions --- */
.screen {
  display: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition), transform var(--transition);
}

.screen.active {
  display: block;
  animation: fadeIn 0.35s var(--transition) forwards;
}

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

/* --- Logo/Header --- */
.app-header {
  text-align: center;
  padding: 24px 0 20px;
}

.app-logo {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

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

.app-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.app-subtitle {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* --- Progress dots (voters status) --- */
.voters-progress {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.voter-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.35;
  transition: opacity var(--transition), transform var(--transition);
}

.voter-dot.voted {
  opacity: 1;
}

.voter-dot.voted .dot-avatar {
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.5); }
  to   { transform: scale(1); }
}

.dot-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 800;
  color: white;
  position: relative;
}

.dot-avatar .checkmark {
  display: none;
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #22C55E;
  border-radius: 50%;
  font-size: 0.6rem;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.voter-dot.voted .checkmark {
  display: flex;
}

.dot-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
}

.voter-dot.voted .dot-name {
  color: var(--text);
}

/* --- Cards --- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), opacity var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-primary {
  background: linear-gradient(135deg, #667EEA, #764BA2);
  color: white;
  box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.btn-voter {
  color: white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  width: 100%;
  font-size: 1.1rem;
  padding: 18px 24px;
  border-radius: var(--radius);
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
}

.btn-voter::after {
  content: '→';
  position: absolute;
  right: 20px;
  transition: transform var(--transition);
}

.btn-voter:hover::after {
  transform: translateX(4px);
}

.btn-voter .voter-emoji {
  font-size: 1.5rem;
  min-width: 36px;
}

.btn-voter .voter-info {
  flex: 1;
  text-align: left;
}

.btn-voter .voter-status {
  font-size: 0.8rem;
  opacity: 0.85;
  font-weight: 400;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  border-color: currentColor;
  background: rgba(0,0,0,0.03);
}

.btn-danger {
  background: #FEE2E2;
  color: #DC2626;
  font-size: 0.8rem;
  padding: 8px 16px;
}

.btn-lg {
  font-size: 1.15rem;
  padding: 18px 36px;
}

.btn-full {
  width: 100%;
}

.btn-results {
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: white;
  box-shadow: 0 4px 20px rgba(245,158,11,0.4);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 20px rgba(245,158,11,0.4); }
  50%       { box-shadow: 0 4px 30px rgba(245,158,11,0.7); transform: translateY(-1px); }
}

/* --- Screen: Landing --- */
#screen-landing {
  text-align: center;
  padding-top: 20px;
}

.landing-hero {
  font-size: 5rem;
  margin: 20px 0;
  animation: float 3s ease-in-out infinite;
}

.landing-description {
  color: var(--text-light);
  line-height: 1.6;
  margin: 16px 0 32px;
  font-size: 1rem;
}

.landing-description strong {
  color: var(--text);
}

/* --- Screen: Voter Select --- */
.screen-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.screen-subtitle {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 24px;
  line-height: 1.5;
}

.voter-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --- Progress bar (steps) --- */
.step-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--transition), transform var(--transition);
}

.step-dot.active {
  background: currentColor;
  transform: scale(1.3);
}

.step-dot.done {
  background: #22C55E;
}

.step-label {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 600;
}

/* --- Destination inputs --- */
.voter-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(255,255,255,0.4));
  backdrop-filter: blur(4px);
}

.voter-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.voter-header-text h2 {
  font-size: 1.2rem;
  font-weight: 800;
}

.voter-header-text p {
  font-size: 0.85rem;
  color: var(--text-light);
}

.destinations-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.destination-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dest-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
  opacity: 0.7;
}

.destination-row.filled .dest-number {
  opacity: 1;
}

.destination-input-wrap {
  flex: 1;
  position: relative;
}

.destination-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.destination-input:focus {
  border-color: var(--voter-color, #667EEA);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
  transform: none;
}

.destination-input::placeholder {
  color: #CBD5E0;
}

.dest-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9);
  border: 2px solid;
  animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  flex: 1;
}

.dest-chip.visible {
  display: flex;
}

@keyframes slideIn {
  from { opacity: 0; transform: scale(0.95) translateX(-10px); }
  to   { opacity: 1; transform: scale(1) translateX(0); }
}

.dest-chip-flag {
  font-size: 1.2rem;
}

.dest-chip-name {
  font-weight: 700;
  font-size: 0.95rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dest-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text-light);
  padding: 0 4px;
  transition: color var(--transition);
}

.dest-chip-remove:hover {
  color: #EF4444;
}

.dest-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 20px;
}

/* --- Accommodation grid --- */
.accommodation-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.accom-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition), background var(--transition);
  position: relative;
  overflow: hidden;
}

.accom-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.accom-card.selected {
  border-color: var(--voter-color, #667EEA);
  background: color-mix(in srgb, var(--voter-color, #667EEA) 8%, white);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Order badge for multi-select (replaces ✓ with 1/2) */
.accom-card .accom-order-badge {
  display: none;
  position: absolute;
  top: 5px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--voter-color, #667EEA);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.accom-card.selected .accom-order-badge {
  display: flex;
}

.accom-emoji {
  font-size: 2rem;
  margin-bottom: 6px;
  display: block;
}

.accom-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

/* --- Confirmation screen --- */
#screen-confirmation {
  text-align: center;
}

.confirm-hero {
  font-size: 4rem;
  margin: 16px 0;
  animation: bounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce {
  0%   { transform: scale(0) rotate(-10deg); }
  70%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}

.confirm-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.confirm-subtitle {
  color: var(--text-light);
  font-size: 1rem;
  margin-bottom: 28px;
}

.vote-count {
  font-size: 2rem;
  font-weight: 800;
  margin: 20px 0 8px;
  color: var(--text);
}

.vote-count span {
  background: linear-gradient(135deg, var(--papa), var(--maman));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pending-voters {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* --- Confetti --- */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* --- Results status banner --- */
.results-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}

.results-banner--partial {
  background: #FFF7ED;
  color: #C2410C;
  border: 1.5px solid #FED7AA;
}

.results-banner--complete {
  background: #F0FDF4;
  color: #15803D;
  border: 1.5px solid #BBF7D0;
}

/* --- Results screen --- */
.results-header {
  text-align: center;
  margin-bottom: 20px;
}

.results-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}

.results-title {
  font-size: 1.5rem;
  font-weight: 800;
}

.results-subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* --- Export section --- */
.results-export {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* --- Tabs --- */
.tabs {
  display: flex;
  background: white;
  border-radius: 50px;
  padding: 4px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: transparent;
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-light);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.tab-btn.active {
  background: linear-gradient(135deg, #667EEA, #764BA2);
  color: white;
  box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}

.tab-btn.tab-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  position: relative;
}

.tab-btn.tab-disabled::after {
  content: '🔒';
  font-size: 0.7rem;
  margin-left: 3px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease forwards;
}

/* Map tab */
#results-map {
  width: 100%;
  height: 380px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 12px;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Ranking tab */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-item {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease forwards;
}

.rank-medal {
  font-size: 1.4rem;
  min-width: 32px;
  text-align: center;
}

.rank-info {
  flex: 1;
}

.rank-name {
  font-weight: 800;
  font-size: 1rem;
}

.rank-country {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 2px;
}

.rank-cities {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 2px;
  font-style: italic;
}

.rank-voters {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.voter-chip {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
}

.rank-score {
  text-align: center;
}

.rank-score-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.rank-score-label {
  font-size: 0.65rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Accommodation type chips (used in result rows for multi-select display) */
.accom-result-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.accom-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #EFF6FF;
  color: #3B82F6;
  border: 1.5px solid #BFDBFE;
}

/* Accommodation tab */
.accom-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.accom-result-item {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}

.accom-result-voter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 90px;
}

.mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: white;
}

.accom-result-type {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  flex: 1;
}

.accom-result-type .accom-emoji {
  font-size: 1.4rem;
  margin: 0;
}

/* Locked accommodation tab content */
.accom-locked {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.accom-locked-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.accom-locked-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.accom-locked-subtitle {
  font-size: 0.9rem;
  line-height: 1.5;
}

.accom-summary-chart {
  background: white;
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
}

.accom-chart-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.accom-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.accom-bar-label {
  min-width: 90px;
  font-size: 0.85rem;
  font-weight: 600;
}

.accom-bar-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.accom-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #667EEA, #764BA2);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.accom-bar-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  min-width: 20px;
}

/* --- Toast --- */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1A202C;
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  white-space: nowrap;
}

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

/* --- Admin reset button --- */
.admin-reset {
  text-align: center;
  margin-top: 32px;
}

/* --- Accommodation hint --- */
.accom-hint {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 14px;
  text-align: center;
}

/* --- Navigation actions --- */
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.form-actions .btn {
  flex: 1;
}

/* --- Google Maps autocomplete override --- */
.pac-container {
  border-radius: 12px !important;
  border: 2px solid var(--border) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
  font-family: 'Nunito', sans-serif !important;
  margin-top: 4px !important;
  overflow: hidden;
}

.pac-item {
  padding: 10px 16px !important;
  font-size: 0.9rem !important;
  cursor: pointer !important;
  border-top: 1px solid var(--border) !important;
}

.pac-item:first-child {
  border-top: none !important;
}

.pac-item:hover, .pac-item-selected {
  background: #F7FAFC !important;
}

.pac-item-query {
  font-weight: 700 !important;
  color: var(--text) !important;
}

.pac-icon {
  margin-right: 8px !important;
}

/* --- Responsive --- */
@media (max-width: 380px) {
  .accommodation-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .accom-card {
    padding: 12px 8px;
  }

  .accom-emoji {
    font-size: 1.6rem;
  }

  .tab-btn {
    font-size: 0.75rem;
    padding: 8px 2px;
  }
}

@media (max-width: 480px) {
  #app {
    padding: 12px 12px 32px;
  }

  .app-title {
    font-size: 1.35rem;
  }

  #results-map {
    height: 300px;
  }
}

/* --- Utility --- */
.text-center { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.hidden { display: none !important; }

/* Section divider */
.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
  margin-bottom: 12px;
}
