/* 
 * Design System - Aar Askaan Chatbot
 * Thème bilingue moderne, glassmorphism, thèmes clair/sombre et animations fluides.
 */

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

:root {
  /* Thème Clair par défaut */
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --bg-glass-active: rgba(255, 255, 255, 0.9);
  --border-color: rgba(13, 110, 110, 0.15);
  
  --primary: #0a6b66;
  --primary-light: #14b8a6;
  --primary-dark: #074e4a;
  --secondary: #eab308;
  --accent: #ef4444;
  --success: #22c55e;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-white: #ffffff;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(10, 107, 102, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(10, 107, 102, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
  /* Thème Sombre */
  --bg-primary: #090f13;
  --bg-secondary: #131c24;
  --bg-glass: rgba(19, 28, 36, 0.7);
  --bg-glass-active: rgba(19, 28, 36, 0.9);
  --border-color: rgba(20, 184, 166, 0.2);
  
  --primary: #14b8a6;
  --primary-light: #2dd4bf;
  --primary-dark: #0f766e;
  --secondary: #fbbf24;
  --accent: #f87171;
  --success: #4ade80;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  transition: background-color 0.4s ease;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* App Wrapper - Premium Layout */
.app-container {
  width: 100vw;
  height: 100vh;
  max-width: 1200px;
  max-height: 850px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: var(--transition);
  animation: appAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes appAppear {
  0% {
    opacity: 0;
    transform: scale(0.96) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Responsive constraints on mobile */
@media (max-width: 768px) {
  .app-container {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
}

/* Header Section */
header {
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  font-size: 2.2rem;
  animation: pulseLogo 3s ease-in-out infinite;
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.brand-details h1 {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-details p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Language Toggle Switch */
.lang-selector {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: 30px;
  display: flex;
  gap: 0.25rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.lang-btn {
  background: transparent;
  border: none;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn.active {
  background: var(--primary);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.1rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  transform: rotate(15deg) scale(1.05);
  background: var(--border-color);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.nav-tabs::-webkit-scrollbar {
  display: none; /* Safari & Chrome */
}

.tab-btn {
  flex: 1;
  min-width: 100px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.9rem 0.5rem;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
}

.tab-btn span.tab-icon {
  font-size: 1.25rem;
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(20, 184, 166, 0.05);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Content Area - Holds the SPA Views */
.main-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.view-panel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  flex-direction: column;
  padding: 1.5rem;
  overflow-y: auto;
}

.view-panel.active {
  display: flex;
  animation: slideInPanel 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* -------------------------------------- */
/* CHAT VIEW PANELS & DESIGN              */
/* -------------------------------------- */

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

.chat-history {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Bubble Design */
.message {
  display: flex;
  max-width: 80%;
  animation: msgAppear 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
}

@keyframes msgAppear {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.message.bot {
  align-self: flex-start;
  flex-direction: row;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin: 0 0.5rem;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: var(--secondary);
}

.message-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 0.95rem;
  position: relative;
}

.message.bot .message-content {
  border-top-left-radius: 2px;
}

.message.user .message-content {
  background: var(--primary);
  color: var(--text-white);
  border: none;
  border-top-right-radius: 2px;
}

/* Custom cards inside bot replies */
.response-card h4 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.message.user .response-card h4 {
  color: var(--text-white);
}

.response-card p {
  margin-bottom: 0.75rem;
}

.response-card ul {
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.response-card li {
  margin-bottom: 0.35rem;
}

.highlight-box {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  margin: 0.75rem 0;
  font-size: 0.88rem;
  border-left: 4px solid transparent;
}

.alert-warning {
  background: rgba(234, 179, 8, 0.1);
  border-left-color: var(--secondary);
  color: var(--text-main);
}
.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: var(--accent);
  color: var(--text-main);
}
.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-left-color: var(--success);
  color: var(--text-main);
}

/* Suggestion pills */
.suggestions-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.suggestion-pill {
  background: rgba(20, 184, 166, 0.1);
  color: var(--primary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.suggestion-pill:hover {
  background: var(--primary);
  color: var(--text-white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Audio Controls Inside Bot Bubbles */
.audio-controls {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
}

.audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  transition: var(--transition);
}

.audio-btn:hover {
  color: var(--primary-light);
}

/* Welcome Grid Cards */
.welcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  width: 100%;
}

.welcome-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.welcome-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
}

.welcome-card .card-icon {
  font-size: 1.8rem;
}

.welcome-card h5 {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.welcome-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Chat Input Bar */
.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  border-radius: 40px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-main);
}

.chat-input:focus {
  outline: none;
}

.input-action-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.voice-input-btn {
  color: var(--text-muted);
  font-size: 1.25rem;
}

.voice-input-btn.listening {
  background: var(--accent);
  color: var(--text-white);
  animation: listeningPulse 1.2s infinite;
}

@keyframes listeningPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-input-btn:hover:not(.listening) {
  background: var(--bg-primary);
  color: var(--primary);
}

.send-message-btn {
  background: var(--primary);
  color: var(--text-white);
  font-size: 1.1rem;
}

.send-message-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

/* -------------------------------------- */
/* GUIDE/EXPLORE PANEL                    */
/* -------------------------------------- */

.guide-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.guide-search {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.guide-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.4rem;
  font-family: var(--font-body);
  color: var(--text-main);
  font-size: 0.95rem;
}

.guide-search input:focus {
  outline: none;
}

.guide-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.accordion-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.accordion-header {
  padding: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  background: var(--bg-secondary);
  transition: var(--transition);
}

.accordion-header:hover {
  background: rgba(20, 184, 166, 0.03);
}

.accordion-arrow {
  transition: transform 0.3s ease;
  font-size: 0.85rem;
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 1.2rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  line-height: 1.6;
}

.accordion-item.open .accordion-content {
  display: block;
}

/* -------------------------------------- */
/* VACCINATION PEV PANEL                  */
/* -------------------------------------- */

.tracker-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tracker-setup {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tracker-setup h3 {
  font-family: var(--font-title);
  color: var(--primary);
  font-size: 1.15rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.15);
}

.form-btn {
  background: var(--primary);
  color: var(--text-white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-title);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  align-self: flex-end;
}

.form-btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

/* Timeline Layout */
.timeline {
  position: relative;
  padding-left: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--border-color);
}

.timeline-node {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.timeline-node::before {
  content: "";
  position: absolute;
  left: -2rem;
  left: calc(-2rem + 3px);
  top: 1.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  border: 3px solid var(--bg-primary);
  transition: var(--transition);
}

/* Status variants for nodes */
.timeline-node.overdue::before {
  background: var(--accent);
}
.timeline-node.today::before {
  background: var(--secondary);
  animation: pulseTodayNode 1.5s infinite;
}
.timeline-node.completed::before {
  background: var(--success);
}

@keyframes pulseTodayNode {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.4); }
  70% { transform: scale(1.3); box-shadow: 0 0 0 6px rgba(234, 179, 8, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(234, 179, 8, 0); }
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timeline-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
}

.timeline-date {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 0.25rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.timeline-node.overdue .timeline-date {
  background: rgba(239, 68, 68, 0.08);
  color: var(--accent);
  border-color: rgba(239, 68, 68, 0.2);
}

.timeline-node.completed {
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.02);
}

.vaccine-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.vaccine-item {
  padding: 0.6rem 0.8rem;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.vaccine-item strong {
  color: var(--primary-dark);
}

[data-theme="dark"] .vaccine-item strong {
  color: var(--primary-light);
}

.vaccine-item p {
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.4;
}

/* Complete Checkbox */
.done-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.8rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.done-checkbox-wrapper input {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--success);
}

/* -------------------------------------- */
/* QUIZ INTERACTIF PANEL                  */
/* -------------------------------------- */

.quiz-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: var(--transition);
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.quiz-progress {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.quiz-score-badge {
  background: var(--primary-light);
  color: var(--text-white);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
}

.quiz-question-box h3 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quiz-option {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.95rem 1.2rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-option:hover:not(.disabled) {
  border-color: var(--primary);
  background: rgba(20, 184, 166, 0.05);
  transform: translateX(3px);
}

.quiz-option.correct {
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
  font-weight: 600;
}

.quiz-option.wrong {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.quiz-option.disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.quiz-feedback {
  background: rgba(20, 184, 166, 0.05);
  border: 1px dashed var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
}

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

.quiz-action-btn {
  background: var(--primary);
  color: var(--text-white);
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-title);
  font-weight: 700;
  cursor: pointer;
  align-self: flex-end;
  transition: var(--transition);
}

.quiz-action-btn:hover {
  background: var(--primary-dark);
}

.quiz-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem 1rem;
  gap: 1rem;
}

.quiz-results-icon {
  font-size: 4rem;
  animation: bounceResults 2s ease infinite;
}

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

.quiz-results h3 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
}

.quiz-results-score {
  font-size: 2.2rem;
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--secondary);
}

/* -------------------------------------- */
/* EMERGENCY GRID & ANNUAIRE              */
/* -------------------------------------- */

.emergency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
  width: 100%;
}

.emergency-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-main);
  text-align: center;
  transition: var(--transition);
}

.emergency-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--text-white);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(239, 68, 68, 0.2);
}

.emergency-btn .num {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
}

.emergency-btn:hover .num {
  color: var(--text-white);
}

.emergency-btn .label {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.25rem;
  opacity: 0.9;
}

/* Helpers */
.text-muted {
  color: var(--text-muted);
}
.mt-2 {
  margin-top: 0.5rem;
}
.d-none {
  display: none !important;
}

/* Modal Window styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  animation: fadeInModal 0.25s ease forwards;
}

.modal-card {
  width: 90%;
  max-width: 450px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: scaleUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.modal-header h3 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: var(--primary);
  font-weight: 700;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.close-btn:hover {
  color: var(--accent);
}

.modal-body select {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.92rem;
  transition: var(--transition);
  cursor: pointer;
}

.modal-body select:focus {
  outline: none;
  border-color: var(--primary-light);
}

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

@keyframes scaleUpModal {
  from { transform: scale(0.9) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ==========================================================================
   WHATSAPP VOICE RECORDING BAR & VOICE BUBBLES
   ========================================================================== */

#voice-record-bar {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  gap: 1rem;
  border-radius: 40px;
}

.record-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.record-dot {
  width: 10px;
  height: 10px;
  background-color: var(--accent);
  border-radius: 50%;
  animation: recPulse 1s infinite alternate;
}

@keyframes recPulse {
  from { opacity: 0.3; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.1); }
}

#record-timer {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.record-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.wave-bar {
  width: 3px;
  height: 8px;
  background-color: var(--text-muted);
  border-radius: 3px;
  animation: waveMotion 1s infinite alternate;
}

.wave-bar:nth-child(2) { height: 16px; animation-delay: 0.2s; }
.wave-bar:nth-child(3) { height: 12px; animation-delay: 0.4s; }
.wave-bar:nth-child(4) { height: 20px; animation-delay: 0.1s; }

@keyframes waveMotion {
  from { transform: scaleY(0.5); }
  to { transform: scaleY(1.3); }
}

.cancel-btn {
  color: var(--text-muted);
  font-size: 1.25rem;
}

.cancel-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent) !important;
}

/* Custom Playable Voice Message Bubble */
.voice-message-bubble {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 180px;
  max-width: 250px;
  padding: 0.25rem 0;
}

.voice-play-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--text-white);
  font-size: 0.9rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.voice-play-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

.voice-progress-container {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.voice-progress-bar {
  height: 100%;
  background: var(--text-white);
  width: 0%;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.voice-duration {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  white-space: nowrap;
}


