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

:root {
  --primary: #0084ff;
  --primary-glow: rgba(0, 132, 255, 0.5);
  --bg-dark: #01061a;
  --panel-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --success: #22c55e;
  --error: #ef4444;
  
  --radius: 28px;
  --gap: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, hsla(215, 98%, 15%, 1) 0, transparent 50%),
    radial-gradient(at 100% 100%, hsla(230, 85%, 16%, 1) 0, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

#root {
  width: 100vw;
  height: 100vh;
  display: flex;
}

.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  padding: var(--gap);
  gap: var(--gap);
}

/* Floating Sidebar */
.sidebar {
  width: 75px;
  min-width: 75px;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px 0;
  z-index: 100;
}

/* Main Layout Rules */
.main-content {
  flex: 1;
  display: flex;
  gap: var(--gap);
  height: 100%;
  overflow: hidden;
}

.list-panel {
  width: 360px;
  min-width: 360px;
  height: 100%;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-panel {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Glass Utilities */
.glass {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
}

.glass-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  transition: all 0.3s;
}

.avatar-small {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
  color: white;
}

.avatar-small img { width: 100%; height: 100%; object-fit: cover; }

.logo {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.6rem;
  color: white;
  box-shadow: 0 8px 20px var(--primary-glow);
  margin-bottom: 40px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex: 1;
}

.nav-item {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.3s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 10px 20px var(--primary-glow);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Floating List Panel */
.list-panel {
  width: 360px;
  min-width: 360px;
  height: 100%;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Welcome Screen */
.welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  text-align: center;
  padding: 40px;
}

.welcome-screen h2 {
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 10px;
}

/* Admin Panel Styling */
.admin-container {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 24px;
  gap: 24px;
  overflow: auto;
}

.admin-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 24px;
}

.panel-header h2 {
  font-size: 2rem;
  font-weight: 700;
}

.search-bar-container {
  padding: 0 28px 20px;
}

.search-bar {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 16px;
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  border: 1px solid var(--glass-border);
}

.search-bar input {
  background: transparent;
  border: none;
  color: white;
  width: 100%;
  outline: none;
  font-size: 1rem;
}

.add-btn {
  width: 52px;
  height: 52px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: 0 10px 20px var(--primary-glow);
}

/* Floating Chat Panel */
.chat-panel {
  flex: 1;
  height: 100%;
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Modal Overlay System */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(15px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  width: 100%;
  max-width: 450px;
  padding: 35px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  position: relative;
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
}

.close-btn:hover {
  background: var(--error);
  transform: rotate(90deg);
}

/* Message Bar Fix */
.message-input-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 0 16px;
  height: 44px;
  display: flex;
  align-items: center;
  flex: 1;
}

.message-input-container input {
  background: transparent;
  border: none;
  color: white;
  width: 100%;
  outline: none;
  font-size: 0.95rem;
}

.unread-badge {
  background: var(--primary);
  color: white;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 50px !important;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 10px 25px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 30px var(--primary-glow);
}

/* Mobile Fixes */
@media (max-width: 1000px) {
  .sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 65px !important;
    flex-direction: row !important;
    padding: 0 !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(25px) saturate(180%) !important;
    border: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    z-index: 5000 !important;
    justify-content: space-around !important;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.3) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    height: 100% !important;
    gap: 0 !important;
    justify-content: space-around !important;
    align-items: center !important;
  }

  .nav-item {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    height: 100% !important;
    width: auto !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    color: rgba(255, 255, 255, 0.4) !important;
    transition: all 0.2s ease !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  .nav-item.active {
    color: var(--primary) !important;
    transform: none !important;
    background: transparent !important;
  }

  .nav-item svg {
    width: 24px !important;
    height: 24px !important;
  }

  .nav-item span {
    display: block !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    opacity: 0.8 !important;
  }

  .nav-item.active span {
    opacity: 1 !important;
    font-weight: 600 !important;
  }

  .main-content {
    height: 100svh !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
  }

  .list-panel {
    width: 100% !important;
    min-width: 100% !important;
    height: 100% !important;
    padding-bottom: 65px !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .chat-panel {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    z-index: 6000 !important;
    background: var(--bg-dark) !important;
  }
  
  .mobile-active .list-panel {
    display: none !important;
  }
  
  .mobile-active .chat-panel {
    display: flex !important;
  }

  /* Hide bottom nav when chat is open */
  .mobile-active .sidebar {
    display: none !important;
  }
}

/* Custom Dialogs */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dialog-content {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 32px;
  width: 100%;
  max-width: 400px;
  padding: 30px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
  text-align: center;
}

.dialog-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: white;
}

.dialog-message {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 25px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

/* Animations */
.animate-spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 14px 28px;
  border-radius: 16px;
  z-index: 10000;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* ── Dropdown Menu Items ───────────────────────────────── */
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

/* ── Modern Input ──────────────────────────────────────── */
.input-modern {
  background: transparent;
  border: none;
  color: white;
  width: 100%;
  outline: none;
  font-size: 0.95rem;
  font-family: 'Outfit', sans-serif;
}

.input-modern::placeholder {
  color: var(--text-dim);
}

/* ── Flex center utility ───────────────────────────────── */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Hide scrollbar but keep scrollable ───────────────── */
.hide-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* ── Voice Player Bubble ───────────────────────────────── */
.voice-player {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px 14px;
  border-radius: 18px;
  min-width: 240px;
  max-width: 320px;
}

.voice-player-btn {
  background: var(--primary);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 14px var(--primary-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.voice-player-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px var(--primary-glow);
}

/* ── Recording pulse dot ───────────────────────────────── */
@keyframes rec-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.85); }
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--error);
  animation: rec-pulse 1s ease-in-out infinite;
  flex-shrink: 0;
}

/* ── Profile/Admin Glass Panels ────────────────────────── */
.glass-panel {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.input-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 16px;
  color: white;
  width: 100%;
  outline: none;
  font-family: 'Outfit', sans-serif;
  transition: all 0.3s;
}

.input-glass:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}


/* Autofill Fix */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px #0f172a inset !important;
  -webkit-text-fill-color: white !important;
  transition: background-color 5000s ease-in-out 0s;
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

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

/* ── Admin HQ Styles ────────────────────────────────────── */
.admin-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  gap: 24px;
  padding: 24px;
  background: var(--bg-dark);
}

.admin-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  padding: 1.5rem;
  transition: all 0.3s;
}

.admin-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.admin-sidebar {
  width: 280px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.admin-main {
  display: flex !important;
  flex-direction: column;
  flex: 1;
  height: 100%;
  overflow-y: auto;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .4s;
  border: 1px solid var(--glass-border);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

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

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* ── View-Once Overlay (screenshot deterrent) ─────────── */
.view-once-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
}

.view-once-overlay img,
.view-once-overlay video {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Prevent print/screenshot via print media */
@media print {
  .view-once-overlay,
  .view-once-overlay * {
    display: none !important;
  }
}

/* Emoji picker hover glow */
.emoji-btn:hover {
  transform: scale(1.3);
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.4));
}