/* ==========================================================================
   PingMe - Stile Glassmorphism Moderno (CSS Personalizzato)
   ========================================================================== */

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

:root {
  --font-family: 'Outfit', sans-serif;
  
  /* Palette Colori & Trasparenze Glassmorphism */
  --bg-overlay: rgba(10, 10, 15, 0.7);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-bg-hover: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.5);
  --glass-blur: blur(20px);
  
  /* Colori di Accento */
  --accent-primary: #8b5cf6; /* Viola */
  --accent-primary-hover: #a78bfa;
  --accent-secondary: #06b6d4; /* Teal */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  /* Stati online/offline */
  --status-online: #10b981; /* Verde smeraldo */
  --status-offline: #64748b; /* Grigio ardesia */
  
  /* Bolle Chat */
  --bubble-sender: rgba(139, 92, 246, 0.25); /* Viola sfumato semitrasparente */
  --bubble-receiver: rgba(255, 255, 255, 0.08); /* Bianco traslucido */
}

/* Reset CSS */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: url('../bg.jpg') no-repeat center center fixed;
  background-size: cover;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-main);
}

/* Overlay scuro sopra lo sfondo per migliorare il contrasto */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  z-index: 0;
}

/* Container principale dell'app */
.app-wrapper {
  position: relative;
  z-index: 1;
  width: 92vw;
  height: 88vh;
  max-width: 1400px;
  min-height: 550px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  display: flex;
  overflow: hidden;
  gap: 0;
}

/* ==========================================================================
   SCHERMATA DI AUTENTICAZIONE (Centrata all'interno del wrapper)
   ========================================================================== */
.auth-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  z-index: 2;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 40px 30px;
  text-align: center;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.auth-logo {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-logo i {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 30px;
}

.auth-form .input-group {
  position: relative;
  margin-bottom: 20px;
  text-align: left;
}

.auth-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.auth-form .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-form .input-wrapper i {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 1rem;
}

.auth-form input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 16px 12px 42px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

.auth-form input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.auth-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
  border: none;
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 10px;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
  background: linear-gradient(135deg, var(--accent-primary-hover), var(--accent-primary));
}

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

.auth-toggle-link {
  margin-top: 25px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-toggle-link span {
  color: var(--accent-primary-hover);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}

.auth-toggle-link span:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  display: none;
}

.auth-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  display: none;
}

/* ==========================================================================
   LAYOUT DI CHAT PRINCIPALE (A due colonne)
   ========================================================================== */
.chat-container {
  width: 100%;
  height: 100%;
  display: flex;
  z-index: 2;
  gap: 0;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* --- COLONNA SINISTRA (Sidebar) --- */
.sidebar {
  width: 350px;
  height: 100%;
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 15, 0.2);
  transition: all 0.3s ease;
  flex-shrink: 0;
  position: relative; /* Consente ai pannelli slidabili figli di posizionarsi correttamente */
  overflow: hidden;   /* Impedisce che il pannello slidabile esca prima di essere attivo */
}

/* Header Sidebar */
.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.profile-info h3 {
  font-size: 1rem;
  font-weight: 600;
}

.profile-info span {
  font-size: 0.75rem;
  color: var(--status-online);
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-info span::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--status-online);
  border-radius: 50%;
  display: inline-block;
}

#current-user-bio::before {
  content: none !important;
  display: none !important;
}

.logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Ricerca Utenti */
.search-wrapper {
  padding: 15px 20px;
  position: relative;
}

.search-wrapper i {
  position: absolute;
  left: 32px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 12px 10px 38px;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-primary);
}

/* Lista Contatti */
.users-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

/* Stile scrollbar personalizzato per il Glassmorphism */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.user-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.user-item:hover {
  background: var(--glass-bg-hover);
  border-color: var(--glass-border);
}

.user-item.active {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.2);
}

.user-item-avatar {
  position: relative;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #14141e; /* contrasta lo sfondo scuro */
}

.status-dot.online {
  background-color: var(--status-online);
}

.status-dot.offline {
  background-color: var(--status-offline);
}

.user-item-details {
  flex: 1;
  overflow: hidden;
}

.user-item-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.user-item-name h4 {
  font-size: 0.95rem;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.last-seen-text {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.user-item-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- COLONNA DESTRA (Area Chat) --- */
.chat-area {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 15, 0.1);
  transition: all 0.3s ease;
  overflow: hidden;
}

/* Stato vuoto all'avvio */
.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.chat-placeholder i {
  font-size: 4rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
}

.chat-placeholder h2 {
  color: var(--text-main);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 8px;
}

/* Header Chat Attiva */
.chat-header {
  padding: 15px 25px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 10, 15, 0.15);
}

.active-chat-user {
  display: flex;
  align-items: center;
  gap: 15px;
}

.mobile-back-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 8px;
  border-radius: 50%;
  display: none; /* Attivo solo su mobile */
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mobile-back-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.active-user-info h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.active-user-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.active-user-info span.online {
  color: var(--status-online);
}

/* Corpo dei Messaggi */
.messages-body {
  flex: 1;
  overflow-y: auto;
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: rgba(10, 10, 15, 0.05);
}

/* Bolla dei messaggi */
.message-bubble {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  position: relative;
  animation: fadeInBubble 0.25s ease-out;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

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

/* Messaggio Inviato (Mittente - Destra) */
.message-bubble.sent {
  align-self: flex-end;
  background: var(--bubble-sender);
  border: 1px solid rgba(139, 92, 246, 0.15);
  border-bottom-right-radius: 4px;
}

/* Messaggio Ricevuto (Destinatario - Sinistra) */
.message-bubble.received {
  align-self: flex-start;
  background: var(--bubble-receiver);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
}

.message-content {
  word-wrap: break-word;
}

/* Info all'interno della bolla (ora + spunta di lettura) */
.message-info {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.message-info i.read {
  color: var(--accent-secondary);
}

/* Footer dell'Area Chat (Input & Invio) */
.chat-footer {
  padding: 15px 25px;
  border-top: 1px solid var(--glass-border);
  background: rgba(10, 10, 15, 0.15);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 15px;
}

.input-capsule {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 15px;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 18px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

.chat-input:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--accent-primary);
}

.send-btn {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--accent-primary), #7c3aed);
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

.send-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, var(--accent-primary-hover), var(--accent-primary));
  box-shadow: 0 6px 15px rgba(139, 92, 246, 0.5);
}

.send-btn:active {
  transform: scale(0.95);
}

/* Indicatore di Scrittura ("typing...") */
.typing-indicator {
  font-size: 0.8rem;
  color: var(--accent-secondary);
  height: 16px;
  font-style: italic;
  padding-left: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.typing-indicator.visible {
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVITÀ PER DISPOSITIVI MOBILI
   ========================================================================== */
@media (max-width: 768px) {
  html, body {
    width: 100vw !important;
    max-width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #efeae2 !important;
    color: #111b21 !important;
  }
  
  body::before {
    display: none !important;
  }

  .app-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #efeae2 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: hidden !important;
  }

  .chat-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    display: flex !important;
    overflow: hidden !important;
  }

  /* Schermata di autenticazione in stile WhatsApp chiaro su mobile */
  .auth-container {
    background: #f0f2f5 !important;
    height: 100% !important;
    width: 100% !important;
    padding: 15px !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
  }

  .auth-card {
    background: #ffffff !important;
    border: 1px solid #e9edef !important;
    box-shadow: 0 2px 4px rgba(11,20,26,.08) !important;
    border-radius: 12px !important;
    width: 100% !important;
    padding: 30px 20px !important;
  }

  .auth-logo {
    background: linear-gradient(135deg, #00a884, #008069) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
  }

  .auth-logo i {
    background: linear-gradient(135deg, #00a884, #008069) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
  }

  .auth-subtitle {
    color: #667781 !important;
  }

  .auth-form label {
    color: #667781 !important;
  }

  .auth-form input {
    background: #f0f2f5 !important;
    border: 1px solid #e9edef !important;
    color: #111b21 !important;
  }

  .auth-form input:focus {
    background: #ffffff !important;
    border-color: #00a884 !important;
    box-shadow: 0 0 8px rgba(0, 168, 132, 0.2) !important;
  }

  .auth-btn {
    background: #00a884 !important;
    box-shadow: 0 2px 4px rgba(0, 168, 132, 0.3) !important;
  }

  .auth-btn:hover {
    background: #008069 !important;
    box-shadow: 0 4px 8px rgba(0, 168, 132, 0.4) !important;
  }

  .auth-toggle-link {
    color: #667781 !important;
  }

  .auth-toggle-link span {
    color: #00a884 !important;
  }

  /* Sidebar */
  .sidebar {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-right: none !important;
    background: #ffffff !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  .sidebar-header {
    background: #f0f2f5 !important;
    border-bottom: 1px solid #e9edef !important;
    color: #111b21 !important;
    padding: 10px 15px !important;
    min-height: 60px !important;
    height: auto !important;
    flex-shrink: 0 !important;
  }

  .sidebar-header .avatar {
    background: #dfe5e7 !important;
    color: #111b21 !important;
    box-shadow: none !important;
  }

  .sidebar-header .profile-info h3 {
    color: #111b21 !important;
  }

  .sidebar-header .logout-btn {
    color: #54656f !important;
  }

  .sidebar-header .logout-btn:hover {
    background: #e1e3e6 !important;
    color: #111b21 !important;
  }

  .search-wrapper {
    background: #ffffff !important;
    border-bottom: 1px solid #f0f2f5 !important;
    flex-shrink: 0 !important;
  }

  .search-input {
    background: #f0f2f5 !important;
    border: none !important;
    color: #111b21 !important;
  }

  .search-input::placeholder {
    color: #667781 !important;
  }

  .search-wrapper i {
    color: #54656f !important;
  }

  .users-list {
    background: #ffffff !important;
    padding: 0 !important;
    overflow-y: auto !important;
  }

  .user-item {
    border-bottom: 1px solid #f0f2f5 !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
  }

  .user-item:hover {
    background: #f5f6f6 !important;
  }

  .user-item.active {
    background: #e9edef !important;
  }

  .user-item .avatar {
    background: #dfe5e7 !important;
    color: #111b21 !important;
    box-shadow: none !important;
  }

  .user-item-name h4 {
    color: #111b21 !important;
  }

  .last-seen-text {
    color: #667781 !important;
  }

  .user-item-preview {
    color: #667781 !important;
  }

  /* Chat Area */
  .chat-area {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    display: none !important;
    background: #efeae2 !important;
    overflow: hidden !important;
  }

  .chat-placeholder {
    display: none !important;
  }

  /* Stato per mostrare la conversazione mobile a schermo intero */
  .app-wrapper.mobile-show-chat .sidebar {
    display: none !important;
  }

  .app-wrapper.mobile-show-chat .chat-area {
    display: flex !important;
    flex-direction: column !important;
  }

  #chat-active-container {
    height: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .chat-header {
    background: #f0f2f5 !important;
    border-bottom: 1px solid #e9edef !important;
    color: #111b21 !important;
    padding: 10px 15px !important;
    flex-shrink: 0 !important;
  }

  .active-chat-user .avatar {
    background: #dfe5e7 !important;
    color: #111b21 !important;
    box-shadow: none !important;
  }

  .active-user-info h3 {
    color: #111b21 !important;
  }

  .active-user-info span {
    color: #667781 !important;
  }

  .mobile-back-btn {
    display: flex !important;
    color: #54656f !important;
  }

  .mobile-back-btn:hover {
    background: #e1e3e6 !important;
  }

  /* Corpo dei Messaggi */
  .messages-body {
    background: #efeae2 !important;
    padding: 15px !important;
    overflow-y: auto !important;
    flex: 1 !important;
  }

  /* Bolle dei Messaggi */
  .message-bubble {
    max-width: 80% !important;
    font-size: 0.92rem !important;
    padding: 8px 12px !important;
  }

  .message-bubble.sent {
    background: #d9fdd3 !important;
    color: #111b21 !important;
    border: none !important;
    border-radius: 8px 8px 0px 8px !important;
    box-shadow: 0 1px 0.5px rgba(11,20,26,.13) !important;
    align-self: flex-end;
  }

  .message-bubble.received {
    background: #ffffff !important;
    color: #111b21 !important;
    border: 1px solid #f0f0f0 !important;
    border-radius: 8px 8px 8px 0px !important;
    box-shadow: 0 1px 0.5px rgba(11,20,26,.13) !important;
    align-self: flex-start;
  }

  .message-content {
    color: #111b21 !important;
  }

  .message-info {
    color: #667781 !important;
  }

  .message-info i.read {
    color: #53bdeb !important; /* WhatsApp spunta blu */
  }

  /* Chat Footer Input in stile WhatsApp */
  .chat-footer {
    background: #efeae2 !important;
    border-top: none !important;
    padding: 6px 8px 12px 8px !important;
    flex-shrink: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .chat-input-wrapper {
    gap: 6px !important;
    width: 100% !important;
    background: transparent !important;
  }

  /* WhatsApp Pill container wrapping emoji, text input and attach clip */
  .input-capsule {
    display: flex !important;
    align-items: center !important;
    flex: 1 !important;
    background: #ffffff !important;
    border: none !important;
    border-radius: 24px !important;
    padding: 2px 10px !important;
    gap: 6px !important;
    box-shadow: 0 1px 2px rgba(11,20,26,.1) !important;
    width: 0 !important;
  }

  .input-capsule .chat-input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 8px 4px !important;
    color: #111b21 !important;
    font-size: 0.95rem !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .input-capsule .chat-input:focus {
    background: transparent !important;
    border: none !important;
  }

  .chat-action-btn {
    background: transparent !important;
    border: none !important;
    color: #54656f !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
  }

  .chat-action-btn:hover {
    background: transparent !important;
    color: #111b21 !important;
    transform: none !important;
  }

  .send-btn {
    background: #00a884 !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    box-shadow: 0 1px 2px rgba(11,20,26,.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    cursor: pointer !important;
  }

  .send-btn:hover {
    transform: none !important;
    background: #008069 !important;
    box-shadow: 0 2px 4px rgba(11,20,26,.2) !important;
  }

  .typing-indicator {
    color: #00a884 !important;
    padding-left: 12px !important;
  }

  /* Emoji Picker Popup */
  .emoji-picker-popup {
    bottom: 60px !important;
    left: 8px !important;
    right: 8px !important;
    width: calc(100% - 16px) !important;
    height: 280px !important;
    background: #ffffff !important;
    border: 1px solid #e9edef !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-radius: 12px !important;
    padding: 10px !important;
    box-sizing: border-box !important;
    z-index: 1000 !important;
  }

  .emoji-picker-tabs {
    border-bottom: 1px solid #e9edef !important;
  }

  .emoji-tab-btn {
    color: #54656f !important;
  }

  .emoji-tab-btn:hover {
    color: #111b21 !important;
    background: #f0f2f5 !important;
  }

  .emoji-tab-btn.active {
    color: #00a884 !important;
    background: rgba(0, 168, 132, 0.1) !important;
    border: 1px solid rgba(0, 168, 132, 0.2) !important;
  }

  .emoji-picker-grid {
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent !important;
  }

  .emoji-picker-grid::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1) !important;
  }

  .emoji-item {
    color: #111b21 !important;
  }

  .emoji-item:hover {
    background: #f0f2f5 !important;
  }

  .sticker-item {
    background: #f0f2f5 !important;
    border: 1px solid #e9edef !important;
  }

  .sticker-item:hover {
    border-color: #00a884 !important;
    background: #e1e3e6 !important;
  }
}

/* ==========================================================================
   STILI DASHBOARD AMMINISTRATORE (Glassmorphism)
   ========================================================================== */

/* Griglia Statistiche */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.15);
}

.stat-icon {
  width: 50px;
  height: 50px;
  background: rgba(139, 92, 246, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--accent-primary-hover);
}

.stat-card:nth-child(2) .stat-icon {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-secondary);
}

.stat-card:nth-child(3) .stat-icon {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-online);
}

.stat-card:nth-child(4) .stat-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
}

/* Stili per la Tabella Admin */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th, 
.admin-table td {
  padding: 14px 18px;
  text-align: left;
}

.admin-table th {
  font-weight: 600;
  border-bottom: 1px solid var(--glass-border);
}

.admin-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.2s ease;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

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

/* Pulsanti di moderazione */
.action-btn-group {
  display: flex;
  gap: 8px;
}

.btn-mod {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-mod:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-mod.promote {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.2);
}

.btn-mod.promote:hover {
  background: rgba(56, 189, 248, 0.15);
}

.btn-mod.demote {
  color: #fb7185;
  border-color: rgba(251, 113, 133, 0.2);
}

.btn-mod.demote:hover {
  background: rgba(251, 113, 133, 0.15);
}

.btn-mod.delete {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-mod.delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Tab Attivo stile */
.dashboard-tabs .tab-btn.active {
  color: var(--text-main) !important;
  border-bottom-color: var(--accent-primary) !important;
}

.dashboard-tabs .tab-btn:hover {
  color: var(--text-main);
}

/* ==========================================================================
   STILI ALLEGATI E SELETTORE EMOJI/STICKER (Glassmorphism)
   ========================================================================== */

/* Bottoni di azione input chat (emoji e clip) */
.chat-action-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.chat-action-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.chat-action-btn:active {
  transform: scale(0.95);
}

/* Contenitore Popup Emoji Picker */
.emoji-picker-popup {
  position: absolute;
  bottom: 80px;
  left: 25px;
  width: 320px;
  height: 380px;
  background: rgba(18, 18, 28, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding: 15px;
  animation: slideUpPopup 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Tabs all'interno del Picker */
.emoji-picker-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  flex-shrink: 0;
}

.emoji-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.emoji-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.emoji-tab-btn.active {
  color: var(--text-main);
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Griglia per Emoji ed Elementi */
.emoji-picker-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-right: 5px;
}

/* Scrollbar personalizzata per il picker */
.emoji-picker-grid::-webkit-scrollbar {
  width: 5px;
}

.emoji-picker-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* Singoli elementi emoji/sticker */
.emoji-item {
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 8px;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.15);
}

.sticker-item {
  cursor: pointer;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
}

.sticker-item:hover {
  transform: scale(1.08);
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.06);
}

.sticker-item img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

/* Bolla di chat per allegati */
.attachment-bubble {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
}

.attachment-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-main);
  flex-shrink: 0;
}

.attachment-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.attachment-name {
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.attachment-dl-btn {
  color: var(--text-main);
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.attachment-dl-btn:hover {
  background: rgba(139, 92, 246, 0.35);
  transform: scale(1.05);
}

.attachment-preview-img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 12px;
  margin-top: 5px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: block;
}

/* Player Audio Integrato nella Chat */
.attachment-audio-wrapper {
  margin-top: 8px;
  width: 100%;
  min-width: 240px;
  max-width: 320px;
}

.attachment-audio-player {
  width: 100%;
  height: 38px;
  border-radius: 20px;
  outline: none;
  filter: invert(0.88) hue-rotate(180deg);
}

@media (max-width: 480px) {
  .attachment-audio-wrapper {
    min-width: 200px;
    max-width: 100%;
  }
}

/* Bolla di chat per sticker */
.message-bubble.sticker {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.message-bubble.sticker img {
  max-width: 150px;
  max-height: 150px;
  border-radius: 12px;
  display: block;
  animation: popInSticker 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popInSticker {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Correzione visibilità per schermata di autenticazione e chat */
.chat-container.hidden,
.auth-container.hidden {
  display: none !important;
}

/* ==========================================================================
   STILI ALLINEAMENTO WHATSAPP UI (Impostazioni, Tabs & Dropdown)
   ========================================================================== */

/* Dropdown delle impostazioni in sidebar header */
.settings-dropdown {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 100%;
  right: 0;
  background: #233138 !important; /* Colore scuro WhatsApp dropdown */
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px;
  z-index: 100;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.settings-dropdown.hidden {
  display: none !important;
}

.dropdown-item {
  background: transparent;
  border: none;
  color: #d1d7db !important;
  padding: 10px 14px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  width: 100%;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: #182229 !important;
}

/* Sidebar Tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #111b21; /* Colore WhatsApp sidebar background */
  flex-shrink: 0;
}

.sidebar-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 10px;
  color: #8696a0 !important; /* WhatsApp text mute color */
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sidebar-tab-btn:hover {
  color: #e9edef !important;
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-tab-btn.active {
  color: #00a884 !important; /* WhatsApp Green Accent Color */
  border-bottom: 3px solid #00a884 !important;
  background: rgba(255, 255, 255, 0.01);
}

/* Pannello Slidabile Impostazioni (Schermo Intero Sidebar) */
.settings-full-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-main, #111b21) !important; /* WhatsApp dark mode */
  z-index: 200; /* Copre interamente l'header ed i tab */
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  transform: translateX(-100%);
  box-sizing: border-box;
}

.settings-full-view.active {
  transform: translateX(0);
}

/* Sidebar Tab Contents hidden status */
.sidebar-tab-content.hidden {
  display: none !important;
}

/* Elementi dei risultati di ricerca in sidebar */
.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
  background: transparent;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.search-result-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.search-result-user .avatar {
  width: 40px;
  height: 40px;
  background: rgba(0, 168, 132, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: #00a884;
  flex-shrink: 0;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.search-result-info h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #e9edef;
}

.search-result-info span {
  font-size: 0.78rem;
  color: #8696a0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-contact-btn {
  background: #00a884;
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.add-contact-btn:hover {
  background: #008f72;
}

.add-contact-btn:active {
  transform: scale(0.95);
}

.add-contact-btn.added {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #8696a0 !important;
  cursor: default !important;
  pointer-events: none;
}

/* Switch toggle slider styling per la Privacy */
.settings-switch .slider {
  background-color: #cbd5e1 !important;
  border: 1px solid #94a3b8 !important;
}

.switch input:checked + .slider {
  background-color: #008069 !important; /* WhatsApp Green */
  border-color: #008069 !important;
}

.switch .slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s ease;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

/* ==========================================================================
   IMPOSTAZIONI IN STILE WHATSAPP NATIVO (Flat White Layout & Green Header)
   ========================================================================== */

.settings-full-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-100%);
  border-right: 1px solid #e2e8f0;
  overflow: hidden;
  color: #111b21;
}

.settings-full-view.active {
  transform: translateX(0);
}

/* Gestione delle viste / sotto-pagine interne */
.settings-view-pane {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #111b21;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.settings-view-pane.active {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

#settings-view-main {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}

#settings-view-main.slide-left {
  transform: translateX(-25%);
  opacity: 0.6;
  pointer-events: none;
}

/* Header WhatsApp Verde */
.settings-header {
  background: #008069;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
  min-height: 62px;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.settings-nav-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  transition: background 0.2s;
  flex-shrink: 0;
}

.settings-nav-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.settings-header-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.settings-header-title-group h3 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.settings-header-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-header-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
}

/* Contenitore a scorrimento verticale (Sfondo Bianco) */
.settings-scroll-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  padding: 0 0 24px 0;
  display: flex;
  flex-direction: column;
}

/* Mini Profilo Summary in cima alla lista (Layout Piatto) */
.settings-profile-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #f0f2f5;
  cursor: pointer;
  transition: background 0.15s;
}

.settings-profile-summary:hover {
  background: #f7f8fa;
}

.settings-profile-summary .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 1.4rem;
  background: #008069;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  border: 2px solid #e2e8f0;
}

.settings-profile-text {
  flex: 1;
  min-width: 0;
}

.settings-profile-text h4 {
  margin: 0 0 3px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #111b21;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-profile-text p {
  margin: 0;
  font-size: 0.82rem;
  color: #667781;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Lista delle voci (Layout Piatto con linee divisorie) */
.settings-menu-list {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: none;
  border-radius: 0;
}

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 20px;
  background: #ffffff;
  border: none;
  border-bottom: 1px solid #f0f2f5;
  color: #111b21;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.settings-menu-item:hover {
  background: #f7f8fa;
}

/* Box per immagini reali icone PNG */
.settings-item-img-box {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-item-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  transition: transform 0.15s;
}

.settings-menu-item:hover .settings-item-img {
  transform: scale(1.08);
}

.settings-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-item-title {
  font-size: 0.98rem;
  font-weight: 500;
  color: #111b21;
}

.settings-item-desc {
  font-size: 0.8rem;
  color: #667781;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-item-arrow {
  font-size: 0.85rem;
  color: #8696a0;
  opacity: 0.7;
  transition: transform 0.2s, color 0.2s;
  flex-shrink: 0;
}

.settings-menu-item:hover .settings-item-arrow,
.settings-profile-summary:hover .settings-item-arrow {
  color: #111b21;
  transform: translateX(2px);
}

/* Pulsanti Footer Piatti (Admin Dashboard / Logout) */
.settings-footer-actions {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
  border-top: 1px solid #f0f2f5;
}

.settings-action-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 20px;
  width: 100%;
  border: none;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  background: #ffffff;
}

.settings-action-btn.admin-btn {
  color: #7c3aed;
}
.settings-action-btn.admin-btn:hover {
  background: #fbf7ff;
}

.settings-action-btn.logout-btn-danger {
  color: #ea580c;
}
.settings-action-btn.logout-btn-danger:hover {
  background: #fff7ed;
}

.settings-item-icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.settings-item-icon-circle.admin-circle {
  background: #f3e8ff;
  color: #7c3aed;
}
.settings-item-icon-circle.logout-circle {
  background: #ffedd5;
  color: #ea580c;
}

/* Sezioni Piatte per le Sotto-pagine */
.settings-flat-section {
  background: #ffffff;
  padding: 18px 20px;
  border-bottom: 1px solid #f0f2f5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-flat-title {
  font-size: 0.96rem;
  font-weight: 600;
  color: #111b21;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-flat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #008069;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-input-group {
  display: flex;
  gap: 8px;
  width: 100%;
}

.settings-field-input {
  flex: 1;
  background: #f0f2f5;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 11px 14px;
  color: #111b21;
  font-size: 0.94rem;
  outline: none;
  transition: all 0.2s;
  font-family: inherit;
}

.settings-field-input:focus {
  background: #ffffff;
  border-color: #008069;
  box-shadow: 0 0 0 2px rgba(0, 128, 105, 0.15);
}

.settings-btn-primary {
  background: #008069 !important;
  color: #ffffff !important;
  padding: 11px 20px !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
  border: none !important;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s !important;
  margin: 0 !important;
  width: auto !important;
  height: auto !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.settings-btn-primary:hover {
  background: #006a57 !important;
}

.settings-btn-primary:active {
  transform: scale(0.97);
}

.settings-btn-secondary {
  background: #f0f2f5;
  color: #111b21;
  border: 1px solid #e2e8f0;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.settings-btn-secondary:hover {
  background: #e2e8f0;
}

.settings-field-hint {
  font-size: 0.78rem;
  color: #667781;
  line-height: 1.4;
}

/* Avatar nella sezione profilo */
.settings-profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 0 16px;
  background: #ffffff;
  border-bottom: 1px solid #f0f2f5;
}

.settings-profile-avatar-section .avatar {
  width: 108px;
  height: 108px;
  font-size: 2.8rem;
  cursor: pointer;
  border: 3px solid #008069;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #e7f6f2;
  color: #008069;
  transition: transform 0.2s;
}

.settings-profile-avatar-section .avatar:hover {
  transform: scale(1.04);
}

.settings-avatar-hint {
  font-size: 0.84rem;
  color: #008069;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.settings-avatar-hint:hover {
  opacity: 0.8;
}

/* Notifiche e Suoni */
.settings-select-wrapper {
  background: #f0f2f5;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
}

.settings-select-field {
  background: transparent;
  border: none;
  color: #111b21;
  width: 100%;
  outline: none;
  cursor: pointer;
  font-size: 0.94rem;
  font-family: inherit;
}

.settings-select-field option {
  background: #ffffff;
  color: #111b21;
}

.settings-btn-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.settings-btn-row button {
  flex: 1;
}

.settings-info-card {
  background: #e7f6f2;
  border: 1px solid #c0e8dd;
  border-radius: 12px;
  padding: 14px 16px;
  margin: 16px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  color: #008069;
}

.settings-info-card i {
  font-size: 1.2rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.settings-info-card-text h5 {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #111b21;
}

.settings-info-card-text p {
  margin: 0;
  font-size: 0.82rem;
  color: #54656f;
  line-height: 1.45;
}

/* Toggle Privacy */
.settings-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.settings-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.settings-toggle-title {
  font-size: 0.98rem;
  font-weight: 500;
  color: #111b21;
}

.settings-toggle-desc {
  font-size: 0.82rem;
  color: #667781;
  line-height: 1.4;
}

/* Account e Sicurezza */
.settings-security-badge-card {
  background: #e7f6f2;
  border-bottom: 1px solid #f0f2f5;
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.settings-security-icon-circle {
  width: 46px;
  height: 46px;
  min-width: 46px;
  background: #ffffff;
  color: #008069;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.settings-security-text h4 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  color: #111b21;
}

.settings-security-text p {
  margin: 0 0 6px;
  font-size: 0.82rem;
  color: #54656f;
  line-height: 1.4;
}

.settings-status-tag-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #008069;
  background: #c0e8dd;
  padding: 3px 10px;
  border-radius: 20px;
}

.settings-form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-field-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #54656f;
}

.settings-feedback-box {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 0.84rem;
  line-height: 1.4;
}

.settings-feedback-box.success {
  background: #e7f6f2;
  border: 1px solid #c0e8dd;
  color: #008069;
}

.settings-feedback-box.error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

/* Versione Sub-view */
.settings-version-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 18px;
  text-align: center;
  background: #ffffff;
  border-bottom: 1px solid #f0f2f5;
}

.settings-version-logo {
  width: 68px;
  height: 68px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.settings-version-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 12px;
}

.settings-version-app-name {
  margin: 0 0 6px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #111b21;
}

.settings-version-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: #008069;
  background: #e7f6f2;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid #c0e8dd;
}

.settings-ws-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.settings-ws-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-ws-title {
  font-size: 0.94rem;
  font-weight: 600;
  color: #111b21;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-ws-title i {
  color: #d97706;
}

.settings-ws-desc {
  font-size: 0.8rem;
  color: #667781;
}

.settings-ws-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  background: #e7f6f2;
  color: #008069;
  border: 1px solid #c0e8dd;
}

.settings-ws-badge.disconnected {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fecaca;
}

.settings-ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.settings-about-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-about-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  padding: 6px 0;
  border-bottom: 1px solid #f0f2f5;
}

.settings-about-row:last-child {
  border-bottom: none;
}

.settings-about-label {
  color: #667781;
}

.settings-about-value {
  color: #111b21;
  font-weight: 500;
}

.settings-version-footer-note {
  font-size: 0.78rem;
  color: #8696a0;
  text-align: center;
  line-height: 1.5;
  padding: 20px 20px 10px;
  margin-top: auto;
}


