/* ========================================
   FiPiLi Walkie-Talkie - Glassmorphism UI
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Colors - Red/Dark Radio Theme */
  --bg-primary: #050506;
  --bg-main: #050506;
  --bg-gradient: linear-gradient(180deg, #08080a 0%, #050506 100%);
  
  --bg-card: #111114;
  --bg-card-soft: #18181d;
  
  --red-main: #e50914;
  --red-dark: #9b0008;
  --red-soft: rgba(229, 9, 20, 0.18);
  --white-main: #f5f5f5;
  --text-muted: #a7a7a7;
  --border-soft: rgba(255, 255, 255, 0.08);

  /* Glass Variables (reduced usage) */
  --glass-bg: var(--bg-card);
  --glass-border: var(--border-soft);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
  
  --bg-secondary: var(--bg-card-soft);
  --bg-hover: #1f1f25;
  
  --text-primary: var(--white-main);
  --text-secondary: var(--text-muted);
  
  /* Fluo Accents - Replaced mostly by red */
  --accent-green: #00e676;
  --accent-green-glow: rgba(0, 230, 118, 0.5);
  --accent-red: var(--red-main);
  --accent-red-glow: rgba(229, 9, 20, 0.5);
  --accent-blue: var(--white-main);
  --accent-orange: var(--red-main);
  --accent-orange-glow: rgba(229, 9, 20, 0.5);
  
  /* Telegram theme integration */
  --tg-theme-bg-color: var(--bg-main);
  
  /* Sizing */
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-full: 50%;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button,
.channel-btn,
.auth-btn,
.leave-modal-btn,
#pttBtn,
#backBtn,
#emergencyBtn {
  -webkit-appearance: none;
  appearance: none;
  background-image: none !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}

html, body {
  background-color: #111827 !important;
  background-image: none !important;
  color: #ffffff !important;
}

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Glassmorphism Helper (replaced by solid for Android compat) */
.glass-panel {
  background-color: #1f2937 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  border-radius: var(--radius-lg);
}

#mainApp,
.app {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 40px;
  background-color: #111827 !important;
  background-image: none !important;
  color: #ffffff !important;
}

/* ========== Header ========== */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 12px;
  margin-bottom: 24px;
  background: linear-gradient(180deg, #08080a, #050506);
  border-bottom: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 8px rgba(0,229,255,0.4));
}

.logo-text {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--white-main);
  text-transform: uppercase;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red-main);
  box-shadow: 0 0 8px rgba(229, 9, 20, 0.5);
  animation: pulse 2s infinite;
}

.connection-status.connected {
  background: rgba(229, 9, 20, 0.12) !important;
  border: 1px solid rgba(229, 9, 20, 0.35) !important;
  color: #fff;
}

.connection-status.connected .status-dot {
  background: #00e676;
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.5);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}


.push-notify-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 15px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Outfit';
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: 15px;
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

.push-notify-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #007aff, #0051a8);
  border-color: #007aff;
  box-shadow: 0 4px 15px rgba(0, 122, 255, 0.3);
}

.push-notify-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ========== Channels Section ========== */
.channels {
  margin-bottom: 24px;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-blue);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.section-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin: -8px 0 16px 0;
  line-height: 1.5;
  letter-spacing: 0.3px;
}

.channel-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-btn {
  position: relative;
  overflow: visible;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: 
    "icon name users"
    "icon desc users";
  align-items: center;
  text-align: left;
  gap: 6px 16px;
  padding: 20px 24px;
  background-color: var(--bg-card) !important;
  background-image: none !important;
  border: 1px solid var(--red-soft) !important;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
}

.channel-btn * {
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
}

.channel-btn:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-3px);
  box-shadow: 
    0 12px 40px rgba(0,0,0,0.5),
    inset 0 1px 3px rgba(255,255,255,0.1);
}

.channel-btn:active {
  transform: scale(0.98);
}

.channel-btn.active {
  border-color: var(--red-main);
  background: rgba(229, 9, 20, 0.05);
  box-shadow: 
    0 10px 40px rgba(0,0,0,0.5),
    0 0 20px rgba(229, 9, 20, 0.2),
    inset 0 0 15px rgba(229, 9, 20, 0.2);
}

.channel-icon {
  grid-area: icon;
  font-size: 38px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
}

.channel-name {
  grid-area: name;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.channel-desc {
  grid-area: desc;
  font-size: 13px;
  color: var(--text-secondary);
}

.channel-users {
  grid-area: users;
  font-size: 12px;
  font-weight: 800;
  color: var(--white-main);
  background: var(--red-main);
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--red-dark);
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 10px rgba(229, 9, 20, 0.3);
}

.channel-btn:hover .channel-users {
  background: var(--red-dark);
  border-color: #ff0033;
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.5);
}

/* ========== SOS Badge (corner notification) ========== */
.channel-sos {
  position: absolute;
  top: -10px;
  right: -6px;
  left: -6px;
  background: var(--accent-red);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 2px 14px var(--accent-red-glow), 0 0 30px var(--accent-red-glow);
  animation: sos-badge-pulse 0.5s infinite;
  z-index: 10;
  pointer-events: none;
}

.channel-sos.hidden {
  display: none;
}

@keyframes sos-badge-pulse {
  0%, 100% { opacity: 1; transform: scale(1); background: var(--accent-red); box-shadow: 0 2px 14px var(--accent-red-glow), 0 0 30px var(--accent-red-glow); }
  50% { opacity: 0.9; transform: scale(1.05); background: #ff0033; box-shadow: 0 2px 25px var(--accent-red-glow), 0 0 50px var(--accent-red-glow); }
}

/* ========== Room View ========== */
.room-view {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.room-view.active {
  display: flex;
}

.channels.hidden {
  display: none;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.back-btn {
  background-color: #1f2937 !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.back-btn:hover {
  background-color: #374151 !important;
  border-color: rgba(255,255,255,0.25) !important;
}

.room-name {
  font-size: 20px;
  font-weight: 800;
  text-shadow: 0 0 10px rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.room-timer {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-orange);
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  text-shadow: 0 0 10px var(--accent-orange-glow);
  opacity: 0;
  transition: opacity 0.2s;
  letter-spacing: 1px;
}

/* ========== VU Meter ========== */
.vu-meter-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.vu-meter {
  width: 100%;
  height: 20px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.8);
}

.vu-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff9800, var(--red-main), var(--red-dark));
  border-radius: var(--radius-full);
  transition: width 50ms linear;
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.5);
}

.speaking-indicator {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(229, 9, 20, 0.1);
  border: 1px solid rgba(229, 9, 20, 0.3);
  border-radius: var(--radius-full);
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.3);
}

.speaking-indicator.active {
  display: flex;
  animation: fade-in-up 0.3s ease;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.speaker-name {
  font-size: 15px;
  color: var(--white-main);
  font-weight: 800;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* ========== Emergency Button ========== */
.emergency-room-btn {
  width: 100%;
  background: var(--red-main);
  border: 2px solid var(--red-dark);
  color: #fff;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  font-family: 'Outfit';
  font-weight: 900;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0.5px;
  box-shadow: 0 5px 20px rgba(229, 9, 20, 0.4);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.emergency-room-btn:active {
  transform: scale(0.96);
  background: var(--accent-red);
}

.emergency-room-btn.hidden {
  display: none !important;
}

.emergency-room-btn.active {
  background: var(--red-dark) !important;
  border-color: #fff !important;
  color: #fff;
  box-shadow: 0 0 30px rgba(229, 9, 20, 0.8) !important;
  animation: sos-badge-pulse 1s infinite !important;
}

/* Alert Drop for Channels */
.channel-btn.alert {
  background: rgba(255, 0, 0, 0.25) !important;
  border-color: #ff0033 !important;
  box-shadow: 
    0 0 30px rgba(255,0,0,0.5),
    0 0 60px rgba(255,0,0,0.3),
    inset 0 0 30px rgba(255,0,0,0.3) !important;
  animation: bg-flash-red 0.6s infinite !important;
}

@keyframes bg-flash-red {
  0%, 100% { 
    background: rgba(255, 0, 0, 0.25); 
    box-shadow: 0 0 30px rgba(255,0,0,0.5), 0 0 60px rgba(255,0,0,0.3), inset 0 0 30px rgba(255,0,0,0.3);
    border-color: #ff0033;
  }
  50% { 
    background: rgba(255, 0, 0, 0.5); 
    box-shadow: 0 0 50px rgba(255,0,0,0.8), 0 0 100px rgba(255,0,0,0.4), inset 0 0 50px rgba(255,0,0,0.5);
    border-color: #ff3333;
    transform: scale(1.02);
  }
}

@keyframes pulse-animation {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(0, 229, 255, 0.4); }
  50% { transform: scale(1.02); box-shadow: 0 0 20px rgba(0, 229, 255, 0.8), inset 0 0 10px rgba(0, 229, 255, 0.4); border-color: rgba(0, 229, 255, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(0, 229, 255, 0.4); }
}

.channel-btn.pulse-animation {
  animation: pulse-animation 1s ease-in-out infinite;
}


/* ========== Leave Confirmation Modal ========== */
.leave-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-fade-in 0.25s ease;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.leave-modal {
  background: rgba(20, 20, 35, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.8),
    inset 0 1px 1px rgba(255, 255, 255, 0.08);
  animation: modal-pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.leave-modal-icon {
  font-size: 44px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 10px rgba(255, 165, 0, 0.5));
}

.leave-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.leave-modal-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.leave-modal-buttons {
  display: flex;
  gap: 12px;
}

.leave-modal-btn {
  flex: 1;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--glass-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.leave-modal-btn.stay {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.leave-modal-btn.stay:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.leave-modal-btn.leave {
  background: rgba(255, 51, 102, 0.15);
  color: var(--accent-red);
  border-color: rgba(255, 51, 102, 0.3);
}

.leave-modal-btn.leave:hover {
  background: rgba(255, 51, 102, 0.25);
  box-shadow: 0 0 15px var(--accent-red-glow);
}

/* ========== Push-to-Talk Button ========== */
.ptt-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.ptt-btn {
  width: 85vw;
  max-width: 320px;
  max-height: 320px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: radial-gradient(circle, #1c1c22 0%, #060607 70%);
  border: 3px solid var(--red-main) !important;
  box-shadow:
    0 0 0 8px rgba(229,9,20,0.08),
    0 0 40px rgba(229,9,20,0.35);
}

.ptt-btn::before {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: transparent;
  z-index: 1;
  transition: inherit;
}

.ptt-btn:hover {
  transform: scale(1.02);
  background: radial-gradient(circle, #25252c 0%, #08080a 70%);
  box-shadow:
    0 0 0 10px rgba(229,9,20,0.1),
    0 0 50px rgba(229,9,20,0.45);
}

.ptt-btn.fallback-mode {
  border-color: rgba(255, 204, 0, 0.3);
  box-shadow: 
    0 15px 45px rgba(40, 30, 0, 0.6),
    inset 0 2px 20px rgba(255, 204, 0, 0.05),
    inset 0 -5px 25px rgba(0, 0, 0, 0.5);
}

.ptt-btn.fallback-mode .ptt-icon {
  filter: drop-shadow(0 0 10px rgba(255, 204, 0, 0.5));
}

.ptt-btn:active,
.ptt-btn.active {
  transform: scale(0.95);
}

.ptt-btn.active {
  background: radial-gradient(circle, #e50914 0%, #6d0005 80%);
  box-shadow:
    0 0 0 10px rgba(229,9,20,0.15),
    0 0 60px rgba(229,9,20,0.7);
  animation: pulse-red-active 1.5s infinite;
}

@keyframes pulse-red-active {
  0% { box-shadow: 0 0 0 10px rgba(229,9,20,0.15), 0 0 60px rgba(229,9,20,0.7); }
  50% { box-shadow: 0 0 0 15px rgba(229,9,20,0.25), 0 0 80px rgba(229,9,20,0.9); }
  100% { box-shadow: 0 0 0 10px rgba(229,9,20,0.15), 0 0 60px rgba(229,9,20,0.7); }
}

.ptt-btn.active::before {
  background: transparent;
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.1);
}

.ptt-btn.queued {
  background: linear-gradient(145deg, rgba(255, 165, 0, 0.2), rgba(20, 10, 0, 0.4));
  border-color: var(--accent-orange);
  box-shadow: 
    0 15px 60px rgba(255, 165, 0, 0.4),
    inset 0 0 40px rgba(255, 165, 0, 0.15);
}

.ptt-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.07);
  transition: all var(--transition-normal);
  z-index: 0;
}

.ptt-btn.active .ptt-ring {
  border-color: rgba(255, 255, 255, 0.3);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
  animation: ring-spin 4s linear infinite;
  border-style: solid;
  border-top-color: transparent;
  border-bottom-color: transparent;
}

.ptt-btn.fallback-mode .ptt-ring {
  border-color: rgba(255, 204, 0, 0.3);
  filter: drop-shadow(0 0 10px rgba(255, 204, 0, 0.3));
}

.ptt-btn.queued .ptt-ring {
  border-color: var(--accent-orange);
  filter: drop-shadow(0 0 15px var(--accent-orange-glow));
  animation: ring-spin 6s linear infinite;
  border-style: dotted;
}

@keyframes ring-spin {
  0% { transform: rotate(0deg) scale(1.02); }
  50% { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(1.02); }
}

.ptt-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.ptt-icon {
  font-size: 64px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.2s;
}

.ptt-btn.active .ptt-icon {
  transform: scale(1.15);
  filter: drop-shadow(0 0 25px rgba(255, 51, 102, 1));
}

.ptt-text {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.2;
  letter-spacing: 2px;
  text-shadow: 0 4px 10px rgba(0,0,0,0.8);
  transition: all var(--transition-normal);
}

.ptt-text::after {
  content: "PREMI PER\A PARLARE";
  white-space: pre-wrap;
}

.ptt-btn.active .ptt-text {
  color: #fff;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.ptt-btn.active .ptt-text::after {
  content: "IN ONDA";
}

.ptt-btn.active .room-timer {
  opacity: 1;
}

.ptt-hint {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition-normal);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ptt-hint.visible {
  opacity: 1;
  color: var(--accent-red);
  text-shadow: 0 0 10px rgba(255, 51, 102, 0.8);
}

/* ========== User List ========== */
.user-list-container {
  background-color: #1f2937 !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
}

.user-list-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.user-item.speaking {
  background: var(--red-main);
  color: #000;
  border-color: var(--red-main);
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.5);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

/* ========== Toast ========== */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 90%;
  max-width: 400px;
}

.toast {
  padding: 14px 20px;
  background: rgba(20, 20, 30, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: toast-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.error {
  border-left: 4px solid var(--accent-red);
  box-shadow: 0 10px 40px var(--accent-red-glow);
}

.toast.success {
  border-left: 4px solid var(--red-main);
  box-shadow: 0 10px 40px rgba(229, 9, 20, 0.5);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Footer Scadenza ========== */
.app-footer {
  width: 100%;
  padding: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.footer-glass {
  background: transparent;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-icon {
  font-size: 12px;
  opacity: 0.7;
}

#footerExpiryDate {
  color: var(--text-secondary);
  font-weight: 700;
}

/* ========== Responsive ========== */
@media (max-width: 380px) {
  .ptt-btn {
    width: 180px;
    height: 180px;
  }
  .ptt-icon { font-size: 48px; }
  .channel-btn { padding: 16px; }
  .channel-name { font-size: 16px; }
  .channel-users { font-size: 12px; }
}

.hidden {
  display: none !important;
}

/* ========== Auth View ========== */
.auth-view {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: block; /* Changed from flex to allow safe scrolling */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-primary);
  background-image: var(--bg-gradient);
  z-index: 100;
  padding: 20px;
}

.auth-view.hidden, .app.hidden {
  display: none !important;
}

.auth-card {
  background-color: #1f2937 !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  padding: 40px 30px;
  border-radius: 30px;
  margin: 5vh auto 40px auto; /* Replaces flex centering, safe for small screens */
  text-align: center;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: auth-in 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes auth-in {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-logo {
  font-size: 60px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 20px rgba(0,229,255,0.5));
}

.auth-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #00e5ff 0%, #ff00ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
}

.auth-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
  font-weight: 500;
}

.auth-input-group input {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 20px;
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  text-transform: uppercase;
  outline: none;
  transition: all var(--transition-fast);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.auth-input-group input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 15px rgba(0,229,255,0.3), inset 0 2px 10px rgba(0,0,0,0.5);
}

.auth-btn {
  width: 100%;
  background: linear-gradient(135deg, #00e5ff, #0088ff);
  color: #000;
  border: none;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  font-family: 'Outfit';
  border-radius: var(--radius-md);
  margin-top: 24px;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 10px 30px rgba(0, 229, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 229, 255, 0.6);
}

.auth-btn:active {
  transform: scale(0.98);
}

.auth-error-msg {
  color: var(--accent-red);
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
  min-height: 16px;
  text-shadow: 0 0 5px var(--accent-red-glow);
}

.auth-divider {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.auth-support-msg {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  text-align: center;
  margin-bottom: 16px;
  background: rgba(255,0,255,0.05);
  border: 1px solid rgba(255,0,255,0.2);
  padding: 12px;
  border-radius: var(--radius-md);
}

.paypal-btn-wrapper {
  width: 100%;
  margin-top: 12px;
  border-radius: var(--radius-md);
  overflow: hidden;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.3));
}

/* ========== Stats Bar && Global Alert ========== */
.stats-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  background-color: #1f2937 !important;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid rgba(255,255,255,0.15) !important;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
}

.stats-bar strong {
  color: var(--accent-blue);
  font-weight: 700;
  font-size: 15px;
}

.global-alert {
  display: flex !important;
  align-items: center;
  gap: 12px;
  background: rgba(255, 100, 0, 0.15);
  border: 1px solid var(--accent-orange);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-top: 20px;
  box-shadow: 0 5px 20px rgba(255, 100, 0, 0.2);
  animation: fade-in-up 0.3s ease;
}

.global-alert.hidden {
  display: none !important;
}

.global-alert-icon {
  font-size: 24px;
  filter: drop-shadow(0 0 10px var(--accent-orange-glow));
}

.global-alert-text {
  font-size: 15px;
  color: #fff;
  font-weight: 600;
  line-height: 1.4;
  text-shadow: 0 0 5px rgba(0,0,0,0.5);
  white-space: pre-wrap;
  width: 100%;
}

/* ========================================
   SOS Recording Modal
   ======================================== */

.sos-modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in-up 0.25s ease;
}

.sos-modal {
  background: linear-gradient(145deg, #1a0505, #2a0a0a);
  border: 2px solid var(--accent-red);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 0 40px rgba(255, 50, 50, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.05);
}

.sos-modal-icon {
  font-size: 48px;
  margin-bottom: 12px;
  animation: pulse 1.5s infinite;
}

.sos-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-red);
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-shadow: 0 0 15px var(--accent-red-glow);
}

.sos-modal-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.sos-timer-display {
  font-size: 42px;
  font-weight: 700;
  color: var(--red-main);
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(229, 9, 20, 0.5);
  font-variant-numeric: tabular-nums;
}

.sos-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sos-modal-btn {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
  letter-spacing: 0.5px;
}

.sos-modal-btn.record {
  background: linear-gradient(135deg, #cc0000, #ff3333);
  color: white;
  box-shadow: 0 4px 20px rgba(255, 0, 0, 0.4);
  -webkit-user-select: none;
  user-select: none;
}

.sos-modal-btn.record:active,
.sos-modal-btn.record.recording {
  background: linear-gradient(135deg, #ff0000, #ff5555);
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.7);
  transform: scale(1.03);
}

.sos-modal-btn.send {
  background: linear-gradient(135deg, var(--red-main), #00cc66);
  color: #000;
  box-shadow: 0 4px 20px rgba(229, 9, 20, 0.5);
}

.sos-modal-btn.send:hover {
  transform: translateY(-2px);
}

.sos-modal-btn.cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sos-modal-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.15);
}

.sos-recording-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-red);
  letter-spacing: 1px;
}

.sos-recording-indicator.hidden {
  display: none;
}

.sos-rec-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red-glow);
  animation: pulse 0.8s infinite;
}

/* Emergency Render Patch */
#connectionStatus,
.stat-card,
.stats-card,
.channel-card,
.room-card,
.auth-card,
.glass-panel,
.stats-bar,
.auth-support-msg {
  background-color: #1f2937 !important;
  background-image: none !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.channel-btn * {
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
}
