:root {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color-scheme: dark;
  /* Palette violet/magenta - démarquée d'Instagram */
  --bg-dark: #0a0a12;
  --bg-card: rgba(22, 18, 32, 0.95);
  --bg-elevated: rgba(32, 26, 48, 0.98);
  --text-primary: #f5f5f5;
  --text-secondary: rgba(245, 245, 245, 0.7);
  --text-muted: rgba(245, 245, 245, 0.5);
  
  /* Dégradés violet/magenta/cyan */
  --gradient-primary: linear-gradient(135deg, #6b21a8 0%, #a855f7 50%, #c084fc 100%);
  --gradient-secondary: linear-gradient(135deg, #4c1d95 0%, #7c3aed 25%, #a855f7 50%, #c026d3 75%, #e879f9 100%);
  --gradient-accent: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #c026d3 100%);
  --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
  --gradient-danger: linear-gradient(135deg, #be123c 0%, #f43f5e 100%);
  
  /* Ombres */
  --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px rgba(168, 85, 247, 0.4);
  
  /* Messages */
  --message-own-bg: rgba(16, 185, 129, 0.2);
  --message-reply-bg: rgba(168, 85, 247, 0.25);
  
  /* Safe area */
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  padding: 2.5rem 1.5rem;
  color: var(--text-primary);
  background: linear-gradient(180deg, #0a0a12 0%, #16102a 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

body:has(.chat-view:not(.hidden)) {
  padding: 0;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: -webkit-fill-available;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  width: min(1220px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
}

.app:has(.chat-view:not(.hidden)) {
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  height: -webkit-fill-available;
  gap: 0;
  margin: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.notification {
  animation: slideIn 0.3s ease-out;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  background: var(--bg-elevated);
  border-radius: 26px;
  box-shadow: var(--shadow-strong);
  border: 1px solid rgba(168, 85, 247, 0.3);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.app:has(.chat-view:not(.hidden)) .topbar {
  display: none;
}

.topbar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-secondary);
  opacity: 0.08;
  pointer-events: none;
}

.back-arrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 16px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 2;
}

.back-arrow:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(168, 85, 247, 0.5);
}

.back-arrow:active {
  transform: translateY(0);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.brand-badge {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #ffffff;
  background: var(--gradient-accent);
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.brand-copy h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--text-primary);
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-copy p {
  margin: 0.1rem 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.9rem;
  background: var(--bg-card);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: var(--text-primary);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid rgba(168, 85, 247, 0.3);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(168, 85, 247, 0.4);
  background: var(--bg-elevated);
}

.chip.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.chip.danger {
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.4);
}

button {
  padding: 0.8rem 1.1rem;
  border-radius: 16px;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  background: var(--gradient-accent);
  color: #ffffff;
  box-shadow: var(--shadow-glow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(168, 85, 247, 0.5);
}

button:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

button.secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: none;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

button.secondary:hover {
  background: var(--bg-card);
  border-color: rgba(168, 85, 247, 0.5);
}

button.danger {
  background: var(--gradient-danger);
  box-shadow: 0 8px 25px rgba(244, 63, 94, 0.4);
}

button.chip {
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  background: var(--bg-card);
  box-shadow: none;
  color: var(--text-primary);
}

button.chip:hover {
  background: var(--bg-elevated);
}

button.chip.active {
  background: var(--gradient-primary);
  color: white;
}

.main-layout {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  align-items: stretch;
}

.app:has(.chat-view:not(.hidden)) .main-layout {
  gap: 0;
  height: 100%;
  height: 100dvh;
  height: -webkit-fill-available;
}

#debate-detail-section:not(.hidden) {
  max-width: 100%;
  width: 100%;
}

.main-layout > section:not(.hidden) {
  width: 100%;
}

#create-debate-section:not(.hidden) ~ #feed-section:not(.hidden) {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(400px, 2fr);
  gap: 1.8rem;
}

#favorites-section:not(.hidden),
#account-section:not(.hidden),
#auth-section:not(.hidden) {
  grid-column: 1 / -1;
  width: 100%;
}

.main-layout.admin-layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: min-content;
  grid-auto-flow: row dense;
  gap: 1.8rem;
  max-width: 100%;
  overflow-x: hidden;
}

.admin-card {
  grid-column: span 6;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-overview {
  grid-column: 1 / -1;
}

.admin-users {
  grid-column: 1 / span 7;
}

.admin-debates {
  grid-column: span 5;
}

.admin-banwords {
  grid-column: 1 / span 6;
}

.admin-audit {
  grid-column: span 6;
}

.admin-reports {
  grid-column: span 6;
}

.admin-poll-reports {
  grid-column: span 6;
}

.admin-debate-of-day {
  grid-column: span 6;
}

.admin-admins {
  grid-column: span 6;
}

/* ===== NAVIGATION ADMIN MOBILE ===== */

.admin-tabs {
  display: none;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border-radius: 16px;
  border: 1px solid rgba(168, 85, 247, 0.3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
  margin-bottom: 1rem;
}

.admin-tabs::-webkit-scrollbar {
  display: none;
}

.admin-tab {
  padding: 0.6rem 1rem;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: none;
  transform: none;
}

.admin-tab:hover {
  background: rgba(168, 85, 247, 0.1);
  color: var(--text-primary);
  transform: none;
  box-shadow: none;
}

.admin-tab.active {
  background: var(--gradient-accent);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.admin-tab .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(244, 63, 94, 0.9);
  color: white;
  border-radius: 999px;
}

.admin-tab.active .tab-badge {
  background: rgba(255, 255, 255, 0.3);
}

/* ===== INTERFACE CHAT - CORRIGÉE POUR MOBILE ===== */

.chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  height: -webkit-fill-available;
  background: var(--bg-dark);
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  padding-top: calc(1rem + var(--safe-area-top));
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(168, 85, 247, 0.3);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  min-height: 60px;
}

.chat-back-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #a855f7;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  padding: 0;
  flex-shrink: 0;
  box-shadow: none;
  transform: none;
}

.chat-back-arrow:hover {
  background: rgba(168, 85, 247, 0.15);
  transform: none;
  box-shadow: none;
}

.chat-header-content {
  flex: 1;
  min-width: 0;
}

.chat-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-meta {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.description-toggle-btn {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #c084fc;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: none;
  transform: none;
}

.description-toggle-btn:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: #c084fc;
  transform: none;
  box-shadow: none;
}

.description-toggle-btn.active {
  background: var(--gradient-accent);
  color: white;
  border-color: transparent;
}

.debate-description-panel {
  padding: 1rem 1.5rem;
  background: rgba(168, 85, 247, 0.1);
  border-bottom: 1px solid rgba(168, 85, 247, 0.3);
  max-height: 200px;
  overflow-y: auto;
  flex-shrink: 0;
  animation: slideDown 0.3s ease-out;
  backdrop-filter: blur(10px);
}

@keyframes slideDown {
  from {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
  }
  to {
    max-height: 200px;
    padding-top: 1rem;
    padding-bottom: 1rem;
    opacity: 1;
  }
}

.debate-description-panel p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
  background: var(--bg-dark);
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.5);
  border-radius: 999px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages .message {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-soft);
  max-width: 85%;
  transition: background 0.2s ease;
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.chat-messages .message.message-own {
  background: var(--message-own-bg);
  align-self: flex-end;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.chat-messages .message.message-reply-to-me {
  background: var(--message-reply-bg);
  border: 1px solid rgba(168, 85, 247, 0.4);
}

/* Formulaire de création de sondage - CORRIGÉE */
.chat-form-container {
  padding: 1rem 1.5rem;
  padding-bottom: calc(1rem + var(--safe-area-bottom));
  background: var(--bg-elevated);
  border-top: 1px solid rgba(168, 85, 247, 0.3);
  flex-shrink: 0;
  max-height: 60%;
  overflow-y: auto;
  overflow-x: hidden;
  backdrop-filter: blur(20px);
  z-index: 50;
}

.chat-form-container::-webkit-scrollbar {
  width: 6px;
}

.chat-form-container::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.5);
  border-radius: 999px;
}

.chat-form-scroll {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-form-container h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

/* Formulaire de message - CORRIGÉ POUR MOBILE */
.chat-message-form {
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + var(--safe-area-bottom));
  background: var(--bg-elevated);
  border-top: 1px solid rgba(168, 85, 247, 0.3);
  flex-shrink: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
}

.chat-input-wrapper {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 0.5rem;
}

.chat-message-form textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 0.75rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 12px;
  font-size: 16px; /* Important: empêche le zoom sur iOS */
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  resize: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.4;
}

.chat-message-form textarea:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
  background: var(--bg-elevated);
}

.chat-message-actions {
  display: flex;
  flex-direction: row;
  gap: 0.4rem;
  align-items: center;
  flex-shrink: 0;
}

.chat-message-actions button {
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  flex-shrink: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-message-actions .poll-button {
  padding: 0.6rem 0.7rem;
}

.panel {
  position: relative;
  background: var(--bg-card);
  border-radius: 26px;
  padding: 1.75rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(168, 85, 247, 0.3);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  overflow: hidden;
  min-height: 0;
  backdrop-filter: blur(20px);
}

.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--gradient-secondary);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.panel:hover::before {
  opacity: 0.05;
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel.accent {
  background: var(--bg-elevated);
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--text-primary);
}

.panel-header p {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.panel-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  overflow: hidden;
  flex: 1;
}

.split-form {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ===== NOUVEAU SYSTÈME D'AUTHENTIFICATION ===== */

.auth-form-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.auth-form {
  animation: fadeIn 0.3s ease-out;
}

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

.auth-switch {
  text-align: center;
  padding-top: 0.5rem;
}

.auth-toggle-button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow: none;
  transform: none;
}

.auth-toggle-button:hover {
  color: var(--text-primary);
  background: rgba(168, 85, 247, 0.1);
  transform: none;
  box-shadow: none;
}

.auth-toggle-button strong {
  color: #c084fc;
  font-weight: 700;
}

/* ===== MENU PRINCIPAL (UTILISATEUR CONNECTÉ) ===== */

.main-menu-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.menu-block {
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 1rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.menu-action-btn {
  width: 100%;
  padding: 1.2rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 16px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s ease;
}

.menu-action-btn.primary-action {
  background: var(--gradient-accent);
  color: white;
  box-shadow: var(--shadow-glow);
  justify-content: center;
  text-align: center;
}

.menu-action-btn.primary-action:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(168, 85, 247, 0.5);
}

.create-debate-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
}

/* ===== HEADER DE LA LISTE DES DÉBATS ===== */

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

.feed-back-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #a855f7;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  padding: 0;
  flex-shrink: 0;
  box-shadow: none;
  transform: none;
}

.feed-back-arrow:hover {
  background: rgba(168, 85, 247, 0.15);
  transform: none;
  box-shadow: none;
}

/* ===== MENU DES SONDAGES ===== */

.poll-menu-container {
  position: relative;
  margin-left: auto;
}

.poll-menu-btn {
  background: transparent;
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease, background 0.2s ease;
  border-radius: 8px;
  box-shadow: none;
  transform: none;
  font-weight: bold;
  line-height: 1;
}

.poll-menu-btn:hover {
  color: var(--text-primary);
  background: rgba(168, 85, 247, 0.15);
  transform: none;
  box-shadow: none;
}

.poll-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-elevated);
  border-radius: 12px;
  box-shadow: var(--shadow-strong);
  padding: 0.5rem;
  min-width: 150px;
  z-index: 100;
  margin-top: 0.25rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.poll-menu button {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.8rem;
  background: transparent;
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  box-shadow: none;
  transform: none;
}

.poll-menu button:hover {
  background: rgba(168, 85, 247, 0.2);
  transform: none;
  box-shadow: none;
}

/* ===== STYLES POUR LES ACTIONS DE SUPPRESSION ===== */

.message-menu button.delete-action,
.poll-menu button.delete-action {
  color: #f43f5e;
}

.message-menu button.delete-action:hover,
.poll-menu button.delete-action:hover {
  background: rgba(244, 63, 94, 0.2);
}

.message-menu button.admin-action,
.poll-menu button.admin-action {
  color: #f59e0b;
}

.message-menu button.admin-action:hover,
.poll-menu button.admin-action:hover {
  background: rgba(245, 158, 11, 0.2);
}

/* ===== POLL HEADER AVEC MENU ===== */

.poll-header {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.poll-question-container {
  flex: 1;
  min-width: 0;
}

.card-block {
  background: var(--bg-elevated);
  border-radius: 22px;
  padding: 1.25rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-soft);
}

.card-block h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 14px;
  font-size: 16px; /* Important: empêche le zoom sur iOS */
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.2);
}

textarea {
  resize: vertical;
  min-height: 140px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.note {
  display: block;
  font-size: 0.82rem;
}

/* Feed principal - Desktop avec scroll interne */
.feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: clamp(500px, 75vh, 900px);
  overflow-y: auto;
  padding-right: 0.35rem;
  scroll-behavior: smooth;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: clamp(500px, 75vh, 900px);
  overflow-y: auto;
  padding-right: 0.35rem;
  scroll-behavior: smooth;
}

.admin-feed {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.35rem;
  scroll-behavior: smooth;
  flex: 1;
  min-height: 0;
  max-height: clamp(300px, 50vh, 600px);
}

.admin-feed > * {
  flex-shrink: 0;
}

.feed::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.admin-feed::-webkit-scrollbar {
  width: 8px;
}

.feed::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.admin-feed::-webkit-scrollbar-thumb {
  background: var(--gradient-accent);
  border-radius: 999px;
}

.feed::-webkit-scrollbar-track,
.messages::-webkit-scrollbar-track,
.admin-feed::-webkit-scrollbar-track {
  background: rgba(168, 85, 247, 0.1);
  border-radius: 999px;
}

.card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 1.25rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
  min-height: fit-content;
}

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

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-left: 4px solid transparent;
  border-image: var(--gradient-accent) 1;
  opacity: 0.8;
  pointer-events: none;
}

.card h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text-primary);
}

.card p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.admin-banwords .card {
  min-height: auto;
  padding: 0.9rem 1.2rem;
}

.messages .message {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(168, 85, 247, 0.2);
  transition: background 0.2s ease;
}

/* Animation douce pour les nouveaux messages */
.messages .message.message-new {
  animation: messageSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.messages .message.message-own {
  background: var(--message-own-bg);
  border-color: rgba(16, 185, 129, 0.5);
  border-width: 2px;
}

.messages .message.message-reply-to-me {
  background: var(--message-reply-bg);
  border-color: rgba(168, 85, 247, 0.5);
  border-width: 2px;
}

.message-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.message-header strong {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.message-content {
  line-height: 1.5;
  word-wrap: break-word;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.message-menu-container {
  position: relative;
  margin-left: auto;
}

.message-menu-btn {
  background: transparent;
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease, background 0.2s ease;
  border-radius: 8px;
  box-shadow: none;
  transform: none;
  font-weight: bold;
  line-height: 1;
}

.message-menu-btn:hover {
  color: var(--text-primary);
  background: rgba(168, 85, 247, 0.15);
  transform: none;
  box-shadow: none;
}

.message-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-elevated);
  border-radius: 12px;
  box-shadow: var(--shadow-strong);
  padding: 0.5rem;
  min-width: 150px;
  z-index: 100;
  margin-top: 0.25rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.message-menu button {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.8rem;
  background: transparent;
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
  box-shadow: none;
  transform: none;
}

.message-menu button:hover {
  background: rgba(168, 85, 247, 0.2);
  transform: none;
  box-shadow: none;
}

.reply-indicator-inline {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-style: italic;
  font-weight: 600;
}

.reply-indicator-inline span {
  font-weight: 700;
}

.reply-indicator {
  background: rgba(168, 85, 247, 0.2);
  border-left: 3px solid #a855f7;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.message-form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
}

.status {
  padding: 0.8rem 1rem;
  border-radius: 14px;
  font-size: 0.92rem;
  background: rgba(168, 85, 247, 0.15);
  color: var(--text-primary);
  border: 1px solid rgba(168, 85, 247, 0.3);
  flex-shrink: 0;
}

.card-status {
  background: rgba(168, 85, 247, 0.1);
  border-color: rgba(168, 85, 247, 0.25);
}

.empty-state {
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: 18px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px dashed rgba(168, 85, 247, 0.3);
  color: var(--text-muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--gradient-accent);
  color: white;
  font-weight: 600;
}

.panel-description {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.6;
  color: var(--text-secondary);
  padding: 0.75rem 0;
}

.inline-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.inline-form .grow {
  flex: 1 1 240px;
}

.metrics-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0;
}

.metrics-grid li {
  background: var(--bg-elevated);
  border-radius: 18px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
  box-shadow: var(--shadow-soft);
  min-height: fit-content;
  color: var(--text-primary);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 9999;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

.modal-panel {
  position: relative;
  width: min(420px, 100%);
  border-radius: 24px;
  padding: 1.75rem;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-strong);
  border: 1px solid rgba(168, 85, 247, 0.4);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 1;
}

.modal-panel h3 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

footer {
  text-align: center;
  padding: 1.5rem 0 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: auto;
}

.app:has(.chat-view:not(.hidden)) footer {
  display: none;
}

.hidden {
  display: none !important;
}

.collapsible-toggle {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: none;
  transform: none;
  transition: color 0.2s ease;
}

.collapsible-toggle:hover {
  color: #c084fc;
  transform: none;
  box-shadow: none;
}

.collapsible-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
}

.report-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  margin-left: auto;
  transition: color 0.2s ease;
}

.report-btn:hover {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.15);
  border-radius: 8px;
}

.report-card {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
}

.reported-message {
  background: var(--bg-elevated);
  padding: 1rem;
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.reported-message h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.reported-message p {
  margin: 0;
  color: var(--text-primary);
}

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

.message {
  animation: messageSlideIn 0.3s ease-out;
}

/* ===== STYLES SONDAGES ===== */

.poll-button {
  background: var(--gradient-success) !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
  font-weight: 600;
  padding: 0.7rem 1.2rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.poll-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
}

#poll-form-container {
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid rgba(16, 185, 129, 0.3);
  border-radius: 16px;
  padding: 1.5rem;
  padding-bottom: calc(1rem + var(--safe-area-bottom));
}

#poll-form-container h3 {
  margin: 0 0 1rem 0;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.poll-form-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.poll-container {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.25rem;
  margin: 1rem 0;
  border: 2px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.poll-header {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: 1rem;
}

.poll-question {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  flex: 1;
}

.poll-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.poll-option {
  position: relative;
  background: rgba(168, 85, 247, 0.1);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  overflow: hidden;
}

.poll-option:hover:not(.poll-option-voted) {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  transform: translateX(2px);
}

.poll-option-voted {
  cursor: default;
}

.poll-option-selected {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.2);
}

.poll-option-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.3));
  transition: width 0.5s ease;
  border-radius: 12px 0 0 12px;
  z-index: 0;
}

.poll-option-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.poll-option-text {
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.poll-option-percentage {
  font-weight: 700;
  color: #10b981;
  font-size: 0.95rem;
  min-width: 50px;
  text-align: right;
}

.poll-total-votes {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(168, 85, 247, 0.3);
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.poll-user-vote-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: var(--gradient-success);
  color: white;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

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

.poll-option {
  animation: pollOptionReveal 0.3s ease-out backwards;
}

.poll-option:nth-child(1) { animation-delay: 0.05s; }
.poll-option:nth-child(2) { animation-delay: 0.1s; }
.poll-option:nth-child(3) { animation-delay: 0.15s; }
.poll-option:nth-child(4) { animation-delay: 0.2s; }
.poll-option:nth-child(5) { animation-delay: 0.25s; }

/* ===== RESPONSIVE ===== */

@media (max-width: 1024px) {
  #create-debate-section:not(.hidden) ~ #feed-section:not(.hidden) {
    grid-template-columns: 1fr;
  }
  
  .main-layout.admin-layout {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  
  .admin-users,
  .admin-debates,
  .admin-banwords,
  .admin-audit,
  .admin-reports,
  .admin-debate-of-day,
  .admin-admins,
  .admin-poll-reports {
    grid-column: 1 / -1;
  }
  
  .admin-feed {
    max-height: clamp(250px, 40vh, 500px);
  }
}

@media (max-width: 768px) {
  body {
    padding: 1.5rem 1rem;
  }
  
  body:has(.chat-view:not(.hidden)) {
    padding: 0;
  }
  
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    gap: 1rem;
  }
  
  .nav-actions {
    width: 100%;
    justify-content: center;
  }
  
  .brand-badge {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }
  
  .brand-copy h1 {
    font-size: 1.5rem;
  }
  
  .panel {
    padding: 1.25rem;
    border-radius: 20px;
  }
  
  .panel-header h2 {
    font-size: 1.25rem;
  }
  
  /* Auth mobile */
  .auth-form-container {
    max-width: 100%;
  }
  
  /* Menu principal mobile */
  .main-menu-content {
    max-width: 100%;
  }
  
  .menu-action-btn {
    padding: 1rem;
    font-size: 1rem;
  }
  
  /* Feed header mobile */
  .feed-header {
    flex-wrap: wrap;
  }
  
  .feed-back-arrow {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
  }
  
  /* Admin mobile - afficher les onglets et masquer les sections */
  .main-layout.admin-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  .admin-tabs {
    display: flex;
  }
  
  .admin-card {
    display: none;
  }
  
  .admin-card.admin-active {
    display: flex;
  }
  
  .admin-overview {
    display: flex !important;
  }
  
  .split-form {
    grid-template-columns: 1fr;
  }

  .chat-header {
    padding: 0.75rem 1rem;
    padding-top: calc(0.75rem + var(--safe-area-top));
  }

  .chat-title {
    font-size: 1rem;
  }

  .chat-meta {
    font-size: 0.75rem;
  }

  .description-toggle-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }

  .chat-messages {
    padding: 0.75rem;
  }

  .chat-messages .message {
    max-width: 90%;
  }
  
  /* Feed mobile - scroll de la page entière */
  .feed {
    max-height: none;
    overflow-y: visible;
  }
  
  #feed-section.panel {
    overflow: visible;
  }
  
  .chat-form-container {
    max-height: 55%;
    padding: 1rem;
    padding-bottom: calc(1rem + var(--safe-area-bottom));
  }
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.75rem;
  }
  
  body:has(.chat-view:not(.hidden)) {
    padding: 0;
  }
  
  .app {
    gap: 1.25rem;
  }
  
  .topbar {
    padding: 1rem 1.25rem;
    border-radius: 20px;
  }
  
  .nav-buttons {
    width: 100%;
    gap: 0.5rem;
  }
  
  .chip {
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
  }
  
  button {
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
  }
  
  .panel {
    padding: 1rem;
    border-radius: 18px;
  }
  
  .card {
    padding: 1rem;
    border-radius: 16px;
  }
  
  .card-actions {
    width: 100%;
  }
  
  .card-actions button:not(.favorite-btn):not(.join-btn) {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.6rem 0.8rem;
  }
  
  /* Boutons favoris et rejoindre sur mobile */
  .card-actions .favorite-btn,
  .card-actions .join-btn {
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
    flex-shrink: 0;
  }
  
  textarea {
    min-height: 100px;
  }
  
  /* Feed mobile - scroll de la page */
  .feed {
    max-height: none;
    overflow-y: visible;
  }
  
  .admin-feed {
    max-height: clamp(200px, 35vh, 400px);
  }
  
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .message-menu {
    min-width: 120px;
  }

  .chat-header {
    padding: 0.6rem 0.75rem;
    padding-top: calc(0.6rem + var(--safe-area-top));
    gap: 0.5rem;
  }

  .chat-back-arrow {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
  }

  .chat-title {
    font-size: 0.95rem;
  }

  .description-toggle-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }

  .chat-messages {
    padding: 0.5rem;
  }

  .chat-messages .message {
    max-width: 95%;
    padding: 0.65rem 0.85rem;
  }

  .chat-message-form {
    padding: 0.6rem 0.75rem;
    padding-bottom: calc(0.6rem + var(--safe-area-bottom));
  }

  .chat-input-wrapper {
    gap: 0.4rem;
  }

  .chat-message-form textarea {
    min-height: 40px;
    font-size: 16px;
    padding: 0.5rem 0.6rem;
  }

  .chat-message-actions {
    gap: 0.3rem;
  }

  .chat-message-actions button {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    white-space: nowrap;
    height: 40px;
  }

  .chat-message-actions .poll-button {
    padding: 0.5rem;
  }

  .chat-form-container {
    max-height: 50%;
    padding: 0.75rem;
    padding-bottom: calc(0.75rem + var(--safe-area-bottom));
  }
  
  .chat-form-scroll {
    gap: 0.75rem;
  }
  
  #poll-form-container h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  .poll-container {
    padding: 1rem;
  }
  
  .poll-question {
    font-size: 0.95rem;
  }
  
  .poll-option {
    padding: 0.7rem 0.85rem;
  }
  
  .poll-option-text {
    font-size: 0.9rem;
  }
  
  .poll-option-percentage {
    font-size: 0.85rem;
    min-width: 45px;
  }
  
  .poll-form-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0.75rem;
  }
  
  .poll-form-actions > button {
    width: 100%;
  }
  
  .poll-form-actions > div {
    display: flex;
    gap: 0.5rem;
    width: 100%;
  }
  
  .poll-form-actions > div button {
    flex: 1;
  }

  /* Admin tabs mobile */
  .admin-tabs {
    padding: 0.5rem;
    gap: 0.35rem;
  }
  
  .admin-tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
}

/* Optimisations performance mobile */
@media (max-width: 768px) {
  * {
    -webkit-tap-highlight-color: transparent;
  }

  body {
    background-attachment: scroll;
  }

  .card:hover,
  button:hover,
  .chip:hover {
    transform: none;
  }

  .favorite-btn:hover,
  .join-btn:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Reduire les animations si l'utilisateur le prefere */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 375px) {
  .brand-copy p {
    font-size: 0.85rem;
  }
  
  .card-meta {
    font-size: 0.8rem;
    gap: 0.5rem;
  }
  
  /* Boutons favoris et rejoindre sur tres petit ecran */
  .card-actions .favorite-btn,
  .card-actions .join-btn {
    font-size: 0.65rem;
    padding: 0.3rem 0.5rem;
    flex-shrink: 0;
  }
  
  .message {
    padding: 0.75rem;
  }

  .message-header {
    font-size: 0.8rem;
  }

  .chat-title {
    font-size: 0.9rem;
  }
  
  .feed {
    max-height: none;
    overflow-y: visible;
  }
  
  .chat-form-container {
    max-height: 45%;
    padding: 0.5rem;
    padding-bottom: calc(0.5rem + var(--safe-area-bottom));
  }
  
  .poll-form-actions {
    gap: 0.4rem;
  }

  .admin-tab {
    padding: 0.45rem 0.6rem;
    font-size: 0.75rem;
  }
  
  .admin-tab .tab-badge {
    min-width: 18px;
    height: 18px;
    font-size: 0.7rem;
    margin-left: 4px;
  }
}

/* ===== iOS Safari et Webkit fixes ===== */
@supports (-webkit-touch-callout: none) {
  html {
    height: -webkit-fill-available;
  }
  
  body:has(.chat-view:not(.hidden)) {
    height: -webkit-fill-available;
  }
  
  .chat-view {
    height: -webkit-fill-available;
  }
  
  .app:has(.chat-view:not(.hidden)) {
    height: -webkit-fill-available;
  }
  
  .app:has(.chat-view:not(.hidden)) .main-layout {
    height: -webkit-fill-available;
  }
}

/* Gestion du clavier virtuel - Classe ajoutée par JS */
.keyboard-open .chat-view {
  height: calc(100% - var(--keyboard-height, 0px));
}

.keyboard-open .chat-messages {
  padding-bottom: 0.5rem;
}

/* Fix pour éviter le zoom sur focus iOS */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="search"],
  textarea,
  select {
    font-size: 16px !important;
  }
}
/* ===== DÉBAT DU JOUR ===== */
#debate-of-day-container {
  margin-bottom: 1.5rem;
}

.debate-of-day-card {
  position: relative;
  border: 2px solid #FFD700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), 0 0 40px rgba(255, 215, 0, 0.2);
  animation: debateGlow 2s ease-in-out infinite;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08) 0%, rgba(255, 165, 0, 0.05) 100%), var(--bg-card);
}

.debate-of-day-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700);
  border-radius: inherit;
  z-index: -1;
  opacity: 0.3;
}

@keyframes debateGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4), 0 0 40px rgba(255, 215, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6), 0 0 60px rgba(255, 215, 0, 0.3);
  }
}

.debate-of-day-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FF8C00 100%);
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.debate-of-day-badge::before {
  content: '';
}

/* ===== BOUTONS VISUELS (Favoris & Rejoindre) ===== */
.favorite-btn,
.join-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.favorite-btn:hover,
.join-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.favorite-btn:active,
.join-btn:active {
  transform: translateY(0);
}

.favorite-btn.active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.15));
  border-color: rgba(255, 215, 0, 0.4);
  color: #FFD700;
}

.join-btn.active {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.15));
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* Styles des boutons dans les cartes de debat */
.card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.card-actions .favorite-btn,
.card-actions .join-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
}

/* Bouton retirer des favoris */
.remove-favorite-btn {
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.3);
}

.remove-favorite-btn:hover {
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.5);
}

/* ===== TEXTE D'ENGAGEMENT INSCRIPTION ===== */
.engagement-text {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1) 0%, rgba(192, 38, 211, 0.08) 100%);
  border-left: 4px solid;
  border-image: var(--gradient-primary) 1;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 12px 12px 0;
  font-size: 0.9rem;
  line-height: 1.7;
}

.engagement-text p {
  margin: 0 0 0.75rem 0;
}

.engagement-text p:last-child {
  margin-bottom: 0;
}

.engagement-text strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.5rem;
}

.engagement-text ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.engagement-text li {
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
}

/* ===== ADMIN - DÉBAT DU JOUR ===== */
/* Les sections sont maintenant visibles sur desktop et gÃƒÂ©rÃƒÂ©es par le systÃƒÂ¨me d'onglets sur mobile */

.current-debate-of-day-card {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 165, 0, 0.05) 100%);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.current-debate-of-day-card h4 {
  color: #FFD700;
  margin: 0 0 0.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-debate-of-day-card .debate-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.current-debate-of-day-card .debate-info strong {
  color: var(--text-primary);
}

.current-debate-of-day-card .expires-info {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.no-debate-of-day {
  color: var(--text-muted);
  font-style: italic;
  padding: 1rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  margin-bottom: 1rem;
}

/* ===== ADMIN - LISTE ADMINISTRATEURS ===== */
/* Les sections sont maintenant visibles sur desktop et gÃƒÂ©rÃƒÂ©es par le systÃƒÂ¨me d'onglets sur mobile */

.admin-card-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-card-item strong {
  color: var(--text-primary);
  font-size: 1rem;
}

.admin-card-item span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.admin-card-item .admin-badge {
  background: linear-gradient(135deg, #6b21a8, #a855f7);
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===== RESPONSIVE - Boutons visuels ===== */
@media (max-width: 600px) {
  .favorite-btn,
  .join-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.7rem;
  }

  .card-actions .favorite-btn,
  .card-actions .join-btn {
    font-size: 0.7rem;
    padding: 0.35rem 0.6rem;
  }

  .card-actions {
    gap: 0.4rem;
  }

  .remove-favorite-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.7rem;
  }

  .debate-of-day-badge {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }

  .engagement-text {
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
  }
}

/* ===== ADMIN DÉBAT DU JOUR - STYLES COMPLÉMENTAIRES ===== */

.debate-of-day-form {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-default);
}

.debate-of-day-form .field {
  margin-bottom: 1rem;
}

.debate-of-day-form .form-hint {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: rgba(168, 85, 247, 0.08);
  border-radius: 8px;
}

.debate-of-day-admin-card {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 165, 0, 0.05));
  border: 2px solid gold;
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.debate-of-day-admin-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700);
}

.debate-of-day-admin-card .debate-of-day-badge {
  display: inline-block;
  margin-bottom: 1rem;
}

.debate-of-day-admin-card h3 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.debate-of-day-admin-card .card-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.debate-of-day-expiry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 215, 0, 0.15);
  border-radius: 8px;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.debate-of-day-expiry .expiry-label {
  font-weight: 500;
}

.debate-of-day-expiry .expiry-time {
  font-weight: bold;
  color: #B8860B;
  font-size: 1.1rem;
}

.debate-of-day-expiry .expiry-date {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.current-debate-of-day-container {
  margin-bottom: 1rem;
}

.no-debate-of-day .empty-state {
  text-align: center;
  padding: 2rem;
}

.no-debate-of-day .empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.no-debate-of-day p {
  margin: 0.5rem 0;
}

/* Informations supplémentaires utilisateur (email, âge) */
.card-extra-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.5rem 0;
  font-size: 0.875rem;
}

.card-extra-info span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Admin card item pour la liste des admins */
.admin-card-item h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Responsive pour les nouveaux styles admin */
@media (max-width: 480px) {
  .debate-of-day-admin-card {
    padding: 1rem;
  }
  
  .debate-of-day-expiry {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .card-extra-info {
    flex-direction: column;
    gap: 0.5rem;
  }
}
/* ===== NOUVEAU: Styles pour le formulaire complet de dÃƒÂ©bat du jour ===== */

.debate-of-day-create-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.debate-of-day-create-section h4 {
  margin: 0 0 1rem 0;
  color: #FFD700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.debate-of-day-full-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.debate-of-day-full-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.debate-of-day-full-form label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.debate-of-day-full-form input,
.debate-of-day-full-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.debate-of-day-full-form input:focus,
.debate-of-day-full-form textarea:focus {
  outline: none;
  border-color: #FFD700;
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.15);
}

.debate-of-day-full-form textarea {
  min-height: 100px;
  resize: vertical;
}

.debate-of-day-full-form .form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.debate-of-day-full-form button[type="submit"] {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #000;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.debate-of-day-full-form button[type="submit"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

.debate-of-day-full-form button[type="submit"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.debate-of-day-full-form button[type="reset"] {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.debate-of-day-full-form button[type="reset"]:hover {
  background: rgba(255, 255, 255, 0.15);
}

.debate-of-day-mode-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.mode-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.mode-btn.active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 165, 0, 0.1) 100%);
  border-color: #FFD700;
  color: #FFD700;
}

.mode-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
}

.debate-of-day-mode-content {
  display: none;
}

.debate-of-day-mode-content.active {
  display: block;
}

/* Hint text sous les champs */
.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Liste des dÃƒÂ©bats sÃƒÂ©lectionnables */
.debate-selector {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.debate-selector-item {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.2s;
}

.debate-selector-item:last-child {
  border-bottom: none;
}

.debate-selector-item:hover {
  background: rgba(255, 215, 0, 0.1);
}

.debate-selector-item.selected {
  background: rgba(255, 215, 0, 0.15);
  border-left: 3px solid #FFD700;
}

.debate-selector-item h5 {
  margin: 0 0 0.25rem 0;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.debate-selector-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.debate-selector-item .meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.debate-selector-search {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.debate-selector-search input {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.empty-debates {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* ===== MENU LATÉRAL ADMIN DESKTOP ===== */

/* Override le grid par défaut de admin-layout quand le menu est présent */
@media (min-width: 769px) {
  .main-layout.admin-layout.admin-layout-with-menu {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto;
    gap: 1.5rem;
    max-width: 100%;
    overflow-x: visible; /* Permet le débordement pour les tableaux scrollables */
  }
  
  /* Les tabs mobiles sont cachés sur desktop */
  .admin-layout-with-menu .admin-tabs {
    display: none !important;
  }
  
  /* Le sidebar prend la première colonne */
  .admin-layout-with-menu .admin-sidebar {
    display: block;
    grid-column: 1;
    grid-row: 1 / 999;
    position: sticky;
    top: 2rem;
    height: fit-content;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    align-self: start;
  }
  
  /* Le contenu prend la deuxième colonne */
  .admin-layout-with-menu .admin-content {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    align-content: start;
  }
  
  /* Les cartes admin Ã  l'intérieur du contenu */
  .admin-layout-with-menu .admin-content .admin-card {
    grid-column: span 1;
    display: none;
  }
  
  .admin-layout-with-menu .admin-content .admin-card.admin-active {
    display: flex;
  }
  
  /* L'overview prend toute la largeur */
  .admin-layout-with-menu .admin-content .admin-overview {
    grid-column: 1 / -1;
    display: flex !important;
  }
  
  /* Les sections larges */
  .admin-layout-with-menu .admin-content .admin-users,
  .admin-layout-with-menu .admin-content .admin-debates,
  .admin-layout-with-menu .admin-content .admin-banwords,
  .admin-layout-with-menu .admin-content .admin-reports,
  .admin-layout-with-menu .admin-content .admin-poll-reports,
  .admin-layout-with-menu .admin-content .admin-audit,
  .admin-layout-with-menu .admin-content .admin-admins,
  .admin-layout-with-menu .admin-content .admin-debate-of-day {
    grid-column: 1 / -1;
  }
}

/* Écrans très larges */
@media (min-width: 1400px) {
  .main-layout.admin-layout.admin-layout-with-menu {
    grid-template-columns: 300px 1fr;
  }
}

/* Mobile : pas de sidebar, afficher les tabs */
@media (max-width: 768px) {
  .admin-layout-with-menu .admin-sidebar {
    display: none !important;
  }
  
  .admin-layout-with-menu .admin-tabs {
    display: flex !important;
  }
  
  .admin-layout-with-menu .admin-content {
    display: contents;
  }
  
  /* Sur mobile, les cartes suivent le layout normal */
  .main-layout.admin-layout.admin-layout-with-menu {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  .admin-layout-with-menu .admin-card {
    width: 100%;
  }
}

/* ===== STYLES DU MENU ===== */

.admin-menu {
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 0.5rem;
  border: 1px solid rgba(168, 85, 247, 0.3);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.admin-menu-section {
  margin-bottom: 0.25rem;
}

.admin-menu-section:last-child {
  margin-bottom: 0;
}

.admin-menu-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0.35rem 0.5rem 0.15rem;
}

.admin-menu-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow: none;
  transform: none;
}

.admin-menu-item:hover {
  background: rgba(168, 85, 247, 0.1);
  color: var(--text-primary);
  transform: none;
  box-shadow: none;
}

.admin-menu-item.active {
  background: var(--gradient-accent);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

.admin-menu-item.active:hover {
  background: var(--gradient-accent);
}

/* Badge dans le menu */
.menu-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(244, 63, 94, 0.9);
  color: white;
  border-radius: 999px;
  margin-left: auto;
}

.admin-menu-item.active .menu-badge {
  background: rgba(255, 255, 255, 0.3);
}

/* Amélioration des scrollbars pour le menu */
.admin-sidebar::-webkit-scrollbar {
  width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.admin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.3);
  border-radius: 3px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.5);
}

/* Animation pour les sections */
.admin-layout-with-menu .admin-card.admin-active {
  animation: adminFadeIn 0.25s ease-out;
}

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

/* ===== SURCHARGES SPÉCIFIQUES POUR LE MENU LATÉRAL ===== */
/* Ces règles surchargent les règles de base grid-column pour admin-layout-with-menu */

@media (min-width: 769px) {
  /* Réinitialiser grid-column pour toutes les cartes dans le nouveau layout */
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-card,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-overview,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-users,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-debates,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-banwords,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-audit,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-reports,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-poll-reports,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-debate-of-day,
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-admins {
    grid-column: 1 / -1 !important;
    width: 100%;
  }
  
  /* S'assurer que les tabs sont vraiment cachés */
  .main-layout.admin-layout.admin-layout-with-menu > .admin-tabs {
    display: none !important;
  }
  
  /* Le sidebar ne doit pas interférer avec le grid des cartes */
  .main-layout.admin-layout.admin-layout-with-menu > .admin-sidebar {
    grid-column: 1 !important;
    grid-row: 1 / 100 !important;
  }
  
  /* Le contenu doit prendre toute la 2ème colonne */
  .main-layout.admin-layout.admin-layout-with-menu > .admin-content {
    grid-column: 2 !important;
    width: 100%;
    min-width: 0; /* Permet le rétrécissement en dessous de la taille du contenu */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow: visible; /* Permet le débordement des tableaux scrollables */
  }

  /* S'assurer que les cartes peuvent gérer le contenu large */
  .main-layout.admin-layout.admin-layout-with-menu .admin-content .admin-card {
    min-width: 0; /* Important pour que le flex shrinking fonctionne */
    overflow: visible;
  }
}

/* ===== TABLEAU DES STATISTIQUES UTILISATEURS (Type Excel) ===== */

.admin-users-stats {
  grid-column: 1 / -1;
  overflow: visible !important; /* Permet le débordement pour le scroll - important pour override panel */
  min-width: 0; /* Permet le rétrécissement dans le grid */
}

/* Permettre le scroll horizontal dans le panel-content pour les stats utilisateurs */
.admin-users-stats .panel-content {
  overflow: visible !important; /* Override le overflow: hidden par défaut */
  min-width: 0;
}

/* Override aussi pour l'overview qui peut être large */
.admin-overview {
  overflow: visible !important;
  min-width: 0;
}

.users-stats-table-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  max-height: clamp(400px, 60vh, 700px);
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid rgba(168, 85, 247, 0.3);
  /* Support du scroll horizontal sur tactile */
  -webkit-overflow-scrolling: touch;
}

/* Scrollbar personnalisée pour le tableau */
.users-stats-table-container::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.users-stats-table-container::-webkit-scrollbar-thumb {
  background: var(--gradient-accent);
  border-radius: 999px;
}

.users-stats-table-container::-webkit-scrollbar-track {
  background: rgba(168, 85, 247, 0.1);
  border-radius: 999px;
}

.users-stats-table {
  width: max-content; /* Permet au tableau de s'étendre au-delà du conteneur */
  min-width: 100%; /* Assure une largeur minimale de 100% */
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--bg-card);
}

.users-stats-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.users-stats-table thead th {
  padding: 1rem 0.75rem;
  text-align: left;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.users-stats-table thead th:last-child {
  border-right: none;
}

.users-stats-table tbody tr {
  transition: background 0.2s ease;
  border-bottom: 1px solid rgba(168, 85, 247, 0.15);
}

.users-stats-table tbody tr:hover {
  background: rgba(168, 85, 247, 0.1);
}

.users-stats-table tbody tr:last-child {
  border-bottom: none;
}

.users-stats-table tbody td {
  padding: 0.85rem 0.75rem;
  color: var(--text-primary);
  border-right: 1px solid rgba(168, 85, 247, 0.1);
  white-space: nowrap;
}

.users-stats-table tbody td:last-child {
  border-right: none;
}

/* Alternance de couleurs pour les lignes */
.users-stats-table tbody tr:nth-child(even) {
  background: rgba(168, 85, 247, 0.03);
}

.users-stats-table tbody tr:nth-child(odd) {
  background: transparent;
}

/* Style pour les cellules numériques (centrage) */
.users-stats-table tbody td:nth-child(4),
.users-stats-table tbody td:nth-child(5),
.users-stats-table tbody td:nth-child(6),
.users-stats-table tbody td:nth-child(7),
.users-stats-table tbody td:nth-child(8) {
  text-align: center;
  font-weight: 600;
  color: #c084fc;
}

/* Responsive pour le tableau */
@media (max-width: 768px) {
  .users-stats-table {
    font-size: 0.8rem;
  }

  .users-stats-table thead th {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
  }

  .users-stats-table tbody td {
    padding: 0.65rem 0.5rem;
  }

  .users-stats-table-container {
    max-height: clamp(300px, 50vh, 500px);
  }
}

/* Overlay pour mots interdits */
.banword-overlay {
  position: fixed;
  inset: 0;
  background: rgba(220, 38, 38, 0.85);
  backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: banwordFadeIn 0.3s ease-out;
}

.banword-overlay.fade-out {
  animation: banwordFadeOut 0.3s ease-out forwards;
}

.banword-overlay-content {
  text-align: center;
  color: white;
  padding: 2rem;
  max-width: 90%;
}

.banword-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: banwordShake 0.5s ease-in-out;
}

.banword-overlay-content h2 {
  font-size: 2rem;
  margin: 0 0 1rem 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.banword-overlay-content p {
  font-size: 1.1rem;
  margin: 0.5rem 0;
  opacity: 0.95;
}

.banword-countdown {
  margin-top: 1.5rem;
  font-size: 3rem;
  font-weight: 700;
  width: 80px;
  height: 80px;
  border: 4px solid white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

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

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

@keyframes banwordShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-10px); }
  80% { transform: translateX(10px); }
}