/* ==========================================================================
   Base Variables & Theme Design (Premium Light Theme - HSL Tailored)
   ========================================================================== */
:root {
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Color Palette */
  --bg-deep: 210, 40%, 96%; /* #f1f5f9 - Cool Slate 100 */
  --bg-surface: 0, 0%, 100%; /* #ffffff - White */
  --accent-color: 250, 84%, 54%; /* #5842e3 - Premium Indigo Violet */
  --accent-glow: 250, 84%, 54%, 0.12;
  --accent-light: 250, 90%, 65%; /* #7966f3 - Light Indigo */
  --accent-dark: 250, 75%, 45%; /* #432ec2 - Dark Indigo */

  /* Text Colors */
  --color-text-primary: 224, 71%, 4%; /* #0f172a - Slate 900 */
  --color-text-secondary: 215, 16%, 32%; /* #334155 - Slate 700 */
  --color-text-muted: 215, 13%, 48%; /* #64748b - Slate 500 */

  /* Status Colors */
  --color-success: 142, 76%, 36%; /* #059669 - Emerald 600 */
  --color-danger: 346, 84%, 48%; /* #dc2626 - Red 600 */
  --color-warning: 38, 92%, 40%; /* #b45309 - Amber 700 */

  /* Glassmorphism Specs for Light Mode */
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(99, 102, 241, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.6);
  --glass-shadow: rgba(15, 23, 42, 0.06);
}

/* ==========================================================================
   Reset & Main Layout
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: hsl(var(--bg-deep));
  color: hsl(var(--color-text-primary));
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient Background Aesthetics */
.ambient-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: center top;
  mask-image: radial-gradient(ellipse 60% 50% at 50% 0%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 0%, black, transparent);
  pointer-events: none;
  z-index: 0;
}

.ambient-glow {
  position: fixed;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.18;
}

.bg-glow-top {
  top: -20%;
  left: 25%;
  background: radial-gradient(circle, hsl(var(--accent-color)) 0%, transparent 70%);
}

.bg-glow-bottom {
  bottom: -20%;
  right: 10%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.5) 0%, transparent 70%);
}

.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   Scrollbar & Custom Components
   ========================================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}

::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.45);
}

/* ==========================================================================
   Navigation Bar
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.03);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 70px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-toggle-btn {
  display: none;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: hsl(var(--color-text-primary));
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 2px;
}

.logo-icon {
  background: linear-gradient(135deg, hsl(var(--accent-light)), hsl(var(--accent-color)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item {
  color: hsl(var(--color-text-secondary));
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-item:hover {
  color: hsl(var(--accent-color));
  background: rgba(99, 102, 241, 0.05);
}

.nav-item.active {
  color: white;
  background: hsl(var(--accent-color));
  box-shadow: 0 4px 12px var(--glass-shadow);
}

.private-portal-btn {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2) !important;
  color: hsl(var(--accent-color));
  display: flex;
  align-items: center;
  gap: 6px;
}

.private-portal-btn:hover {
  background: hsl(var(--accent-color)) !important;
  color: white !important;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
  border-color: hsl(var(--accent-color)) !important;
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
  flex: 1 0 auto;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 120px 24px; /* Space for persistent audio footer */
  display: flex;
  flex-direction: column;
}

/* Frosted glass container panels */
.view-card {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 10px 30px var(--glass-shadow);
  position: relative;
  overflow: hidden;
}

/* ==========================================================================
   1. Home View Styling
   ========================================================================== */
.hero-section {
  text-align: center;
  margin-bottom: 60px;
  position: relative;
}

.hero-accent {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 3px;
  color: hsl(var(--accent-color));
  display: inline-block;
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 48px;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
  background: linear-gradient(to right, hsl(var(--color-text-primary)) 40%, hsl(var(--accent-color)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  max-width: 600px;
  margin: 0 auto 32px auto;
  font-size: 16px;
  line-height: 1.6;
  color: hsl(var(--color-text-secondary));
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
  border-radius: 10px;
}

.primary-action-btn {
  background: hsl(var(--accent-color));
  color: white;
  padding: 14px 28px;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.primary-action-btn:hover {
  background: hsl(var(--accent-dark));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.secondary-action-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: hsl(var(--color-text-secondary));
  padding: 14px 28px;
  font-weight: 600;
  font-size: 15px;
}

.secondary-action-btn:hover {
  background: white;
  border-color: hsl(var(--accent-color));
  color: hsl(var(--accent-color));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-box {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(99, 102, 241, 0.05);
  padding: 30px;
  border-radius: 16px;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.02);
}

.feature-box::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(to bottom, var(--glass-border), transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.feature-box:hover {
  background: white;
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.06);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 20px;
  display: block;
}

.feature-box h3 {
  font-family: var(--font-title);
  font-size: 18px;
  margin-bottom: 10px;
}

.feature-box p {
  font-size: 14px;
  line-height: 1.5;
  color: hsl(var(--color-text-secondary));
}

/* ==========================================================================
   2. Music Playlist View Styling
   ========================================================================== */
.section-header {
  margin-bottom: 36px;
}

.section-title {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 15px;
  color: hsl(var(--color-text-secondary));
}

.songs-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.song-card {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(99, 102, 241, 0.05);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.25s ease;
  position: relative;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.02);
}

.song-card:hover {
  background: white;
  border-color: rgba(99, 102, 241, 0.2);
  transform: scale(1.02);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.06);
}

.song-card.playing, tr.playing {
  border-color: hsl(var(--color-primary));
  box-shadow: 0 0 16px hsla(var(--color-primary), 0.2);
  background: hsla(var(--color-primary), 0.05);
}

.song-thumbnail {
  aspect-ratio: 16/9;
  border-radius: 10px;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 36px;
  color: hsl(var(--accent-color));
  border: 1px solid rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.song-thumbnail::after {
  content: '♫';
  position: absolute;
  bottom: 10px;
  right: 15px;
  font-size: 24px;
  opacity: 0.15;
  color: hsl(var(--accent-color));
}
/* --- Upload Form Style --- */
.upload-track-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 4px 16px var(--glass-shadow);
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.upload-inputs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-inputs input[type="text"] {
  flex: 1;
  min-width: 150px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  background: white;
  font-family: var(--font-body);
  font-size: 14px;
}

.upload-inputs input[type="text"]:focus {
  outline: none;
  border-color: hsl(var(--accent-color));
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.file-input-wrapper {
  flex: 2;
  min-width: 200px;
  display: flex;
  align-items: center;
}

.file-input-wrapper input[type="file"] {
  width: 100%;
  font-size: 14px;
  padding: 8px;
  border: 1px dashed rgba(99, 102, 241, 0.4);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.upload-status {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 8px;
  border-radius: 8px;
}
.upload-status.success {
  background: rgba(5, 150, 105, 0.1);
  color: hsl(var(--color-success));
}
.upload-status.error {
  background: rgba(220, 38, 38, 0.1);
  color: hsl(var(--color-danger));
}

.song-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.song-title {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-artist {
  font-size: 13px;
  color: hsl(var(--color-text-secondary));
}

.song-play-btn {
  width: 100%;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: hsl(var(--accent-color));
  padding: 10px;
  font-weight: 600;
  font-size: 13px;
  border-radius: 8px;
}

.song-play-btn:hover {
  background: hsl(var(--accent-color));
  color: white;
  border-color: hsl(var(--accent-color));
}

.song-card.playing .song-play-btn, tr.playing .song-play-btn {
  background: hsla(var(--color-primary), 0.1);
  color: hsl(var(--color-primary));
  border-color: hsl(var(--color-primary));
}

/* ==========================================================================
   3. Downloads View Styling
   ========================================================================== */
.downloads-table-container {
  overflow-x: auto;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.02);
}

.downloads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.downloads-table th,
.downloads-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  font-size: 14px;
}

.downloads-table th {
  font-family: var(--font-title);
  font-weight: 600;
  color: hsl(var(--color-text-secondary));
  background: rgba(99, 102, 241, 0.02);
}

.downloads-table tr:last-child td {
  border-bottom: none;
}

.downloads-table tr:hover td {
  background: rgba(255, 255, 255, 0.4);
}

.download-action-btn {
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.2);
  color: hsl(var(--color-success));
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: all 0.2s ease;
}

.download-action-btn:hover {
  background: hsl(var(--color-success));
  color: white;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.2);
}

/* ==========================================================================
   4. Portal Login View Styling
   ========================================================================== */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
  flex: 1;
}

.login-card {
  max-width: 420px;
  width: 100%;
  padding: 48px;
  background: white; /* Clean crisp white card */
  border: 1px solid rgba(99, 102, 241, 0.1);
  box-shadow: 0 15px 40px rgba(99, 102, 241, 0.08);
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo {
  font-size: 40px;
  margin-bottom: 16px;
  display: inline-block;
}

.login-header h2 {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: hsl(var(--color-text-primary));
}

.login-header p {
  font-size: 13px;
  color: hsl(var(--color-text-muted));
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: hsl(var(--color-text-secondary));
  text-transform: uppercase;
}

.form-group input {
  background: #f8fafc;
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 8px;
  padding: 12px 16px;
  color: hsl(var(--color-text-primary));
  font-family: var(--font-body);
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: hsl(var(--accent-color));
  background: white;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.login-error-alert {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: hsl(var(--color-danger));
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.login-submit-btn {
  background: hsl(var(--accent-color));
  color: white;
  padding: 14px;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
  margin-top: 10px;
}

.login-submit-btn:hover {
  background: hsl(var(--accent-dark));
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

/* ==========================================================================
   5. Chat Dashboard Styling (Split Layout)
   ========================================================================== */
.chat-dashboard {
  display: grid;
  grid-template-columns: 300px 1fr;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  height: calc(100vh - 240px);
  min-height: 480px;
  max-height: 680px;
  background: white;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

/* --- Sidebar Style --- */
.chat-sidebar {
  border-right: 1px solid var(--glass-border);
  background: rgba(99, 102, 241, 0.02);
  display: flex;
  flex-direction: column;
}

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

.user-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-glow {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: hsl(var(--color-success));
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.4);
}

.user-handle {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 16px;
  color: hsl(var(--color-text-primary));
}

.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 10px;
}

.badge-primary {
  background: rgba(99, 102, 241, 0.08);
  color: hsl(var(--accent-color));
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.peer-status-panel {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.panel-label {
  font-size: 11px;
  font-weight: 600;
  color: hsl(var(--color-text-muted));
  letter-spacing: 1.5px;
}

.peer-card {
  background: white;
  border: 1px solid rgba(99, 102, 241, 0.06);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.01);
}

.peer-avatar-container {
  position: relative;
}

.peer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  color: hsl(var(--accent-color));
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.status-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: hsl(var(--color-danger));
  border: 2px solid white;
  transition: all 0.2s ease;
}

.status-indicator.online {
  background: hsl(var(--color-success));
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.4);
}

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

.peer-name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 15px;
  color: hsl(var(--color-text-primary));
}

.peer-status-text {
  font-size: 12px;
  color: hsl(var(--color-text-muted));
}

.sidebar-actions-panel {
  padding: 20px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: white;
}

.sidebar-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.delete-all-btn {
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.15);
  color: hsl(var(--color-danger));
}

.delete-all-btn:hover {
  background: hsl(var(--color-danger));
  color: white;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25);
  border-color: hsl(var(--color-danger));
}

.logout-btn {
  background: #f8fafc;
  border: 1px solid var(--glass-border);
  color: hsl(var(--color-text-secondary));
}

.logout-btn:hover {
  background: #e2e8f0;
  color: hsl(var(--color-text-primary));
}

/* --- Chat Console Style --- */
.chat-console {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  background: white;
}

.console-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
}

.console-title-area h3 {
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 700;
  color: hsl(var(--color-text-primary));
}

.console-title-area p {
  font-size: 12px;
  color: hsl(var(--color-success));
}

.webrtc-call-buttons {
  display: flex;
  gap: 8px;
}

.call-trigger-btn {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
}

.call-trigger-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: #f1f5f9 !important;
  color: hsl(var(--color-text-muted)) !important;
  border-color: var(--glass-border) !important;
}

.voice-call-btn {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.15);
  color: hsl(var(--accent-color));
}

.voice-call-btn:hover:not(:disabled) {
  background: hsl(var(--accent-color));
  color: white;
  border-color: hsl(var(--accent-color));
}

.video-call-btn {
  background: rgba(5, 150, 105, 0.08);
  border-color: rgba(5, 150, 105, 0.15);
  color: hsl(var(--color-success));
}

.video-call-btn:hover:not(:disabled) {
  background: hsl(var(--color-success));
  color: white;
  border-color: hsl(var(--color-success));
}

.console-message-log {
  flex-grow: 1;
  overflow-y: auto;
  min-height: 0; /* Fix flexbox intrinsic height overflow */
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc; /* Softer background to highlight white bubbles */
}

.log-info-msg {
  align-self: center;
  background: white;
  border: 1px solid var(--glass-border);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  color: hsl(var(--color-text-muted));
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.01);
}

.log-info-msg.error-msg {
  color: hsl(var(--color-danger));
  background: rgba(220, 38, 38, 0.02);
  border-color: rgba(220, 38, 38, 0.1);
}

/* Chat Bubbles Layout */
.message-bubble {
  max-width: 65%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  animation: messageSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.message-bubble.sent {
  align-self: flex-end;
}

.message-bubble.received {
  align-self: flex-start;
}

.msg-text-content {
  padding: 12px 18px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}

.message-bubble.sent .msg-text-content {
  background: linear-gradient(135deg, hsl(var(--accent-color)) 0%, hsl(var(--accent-dark)) 100%);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.15);
}

.message-bubble.received .msg-text-content {
  background: white;
  border: 1px solid rgba(99, 102, 241, 0.08);
  color: hsl(var(--color-text-primary));
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.01);
}

.msg-metadata {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: hsl(var(--color-text-muted));
}

.message-bubble.sent .msg-metadata {
  justify-content: flex-end;
}

.read-status {
  font-size: 12px;
  color: hsl(var(--color-text-muted));
  transition: color 0.2s ease;
}

.read-status.read {
  color: hsl(var(--accent-color));
}

/* Typing Indicator Animation */
.typing-indicator-container {
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: hsl(var(--color-text-muted));
  font-size: 12px;
  background: #f8fafc;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background-color: hsl(var(--color-text-muted));
  border-radius: 50%;
  display: inline-block;
  animation: typingDotPulse 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

/* Console Input Footer */
.console-input-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  background: white;
}

.message-input-form {
  display: flex;
  gap: 12px;
}

.message-text-input {
  flex-grow: 1;
  background: #f8fafc;
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 12px;
  padding: 14px 20px;
  color: hsl(var(--color-text-primary));
  font-family: var(--font-body);
  font-size: 14px;
  transition: all 0.2s ease;
}

.message-text-input:focus {
  outline: none;
  border-color: hsl(var(--accent-color));
  background: white;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.message-send-btn {
  background: hsl(var(--accent-color));
  color: white;
  font-weight: 600;
  padding: 0 24px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.message-send-btn:hover {
  background: hsl(var(--accent-dark));
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

.chat-quick-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  justify-content: flex-start;
  align-items: center;
}

.quick-action-btn {
  background: #f8fafc;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-action-btn.delete-all-btn {
  color: hsl(var(--color-danger));
  background: rgba(220, 38, 38, 0.04);
  border-color: rgba(220, 38, 38, 0.15);
}

.quick-action-btn.delete-all-btn:hover {
  background: hsl(var(--color-danger));
  color: white;
  border-color: hsl(var(--color-danger));
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.2);
}

.quick-action-btn.logout-btn {
  color: hsl(var(--color-text-secondary));
}

.quick-action-btn.logout-btn:hover {
  background: #e2e8f0;
  color: hsl(var(--color-text-primary));
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.05);
}

/* ==========================================================================
   Persistent Audio Player Footer Style
   ========================================================================== */
.audio-footer-player {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  min-width: 180px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 8px 20px;
  z-index: 90;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.player-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  gap: 0;
}

.player-track-info,
.player-timeline,
.player-volume-container {
  display: none !important;
}

.album-art-thumbnail {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
  border: 1px solid rgba(99, 102, 241, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
}

.audio-footer-player.playing .disc-icon {
  animation: spinCd 3s linear infinite;
  display: inline-block;
}

.track-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.track-title {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 600;
  color: hsl(var(--color-text-primary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 12px;
  color: hsl(var(--color-text-secondary));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.player-btn {
  background: none;
  border: none;
  color: hsl(var(--color-text-secondary));
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}

.player-btn:hover {
  background: rgba(99, 102, 241, 0.05);
  color: hsl(var(--accent-color));
}

.play-btn {
  background: rgba(99, 102, 241, 0.06);
  color: hsl(var(--accent-color));
  font-size: 20px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.play-btn:hover {
  background: hsl(var(--accent-color));
  color: white;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
  border-color: hsl(var(--accent-color));
}

.player-timeline {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 500px;
  gap: 12px;
}

.time-label {
  font-size: 11px;
  color: hsl(var(--color-text-muted));
  min-width: 32px;
}

.progress-bar-container {
  flex-grow: 1;
  height: 4px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.progress-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: hsl(var(--accent-color));
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.progress-bar-container:hover .progress-bar-fill {
  background: hsl(var(--accent-light));
}

.player-volume-container {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.volume-icon {
  font-size: 14px;
  color: hsl(var(--color-text-secondary));
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.06);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: hsl(var(--accent-color));
  transition: background 0.15s;
}

.volume-slider::-webkit-slider-thumb:hover {
  background: hsl(var(--accent-light));
}

/* ==========================================================================
   6. WebRTC Call Screen Overlay Style (Frosted Light FaceTime style)
   ========================================================================== */
.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(241, 245, 249, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.call-glass-container {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 24px;
  max-width: 600px;
  width: 90%;
  aspect-ratio: 4/3;
  padding: 40px;
  box-shadow: 0 15px 45px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.call-header {
  text-align: center;
}

.call-header h2 {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 6px;
  color: hsl(var(--accent-color));
  text-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
}

.call-peer-name {
  font-size: 16px;
  color: hsl(var(--color-text-secondary));
}

.call-avatar-container {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.call-avatar-disc {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--accent-color)) 0%, hsl(var(--accent-dark)) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
  color: white;
  border: 2px solid white;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
  z-index: 2;
}

.calling-ripples {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

.ripple {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid rgba(99, 102, 241, 0.3);
  animation: callingRipple 2.5s infinite linear;
  opacity: 0;
}

.ripple:nth-child(2) { animation-delay: 0.8s; }
.ripple:nth-child(3) { animation-delay: 1.6s; }

.video-grid-container {
  width: 100%;
  flex-grow: 1;
  margin: 20px 0;
  position: relative;
  background: #f1f5f9;
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 16px;
  overflow: hidden;
}

.video-stream {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #e2e8f0;
}

.local-video {
  position: absolute;
  bottom: 15px;
  right: 15px;
  width: 120px;
  aspect-ratio: 3/4;
  border-radius: 8px;
  border: 2px solid white;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.08);
  transform: scaleX(-1);
  z-index: 5;
}

.call-controls {
  width: 100%;
  display: flex;
  justify-content: center;
}

.incoming-actions,
.active-actions {
  display: flex;
  gap: 16px;
}

.call-btn {
  padding: 12px 24px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.accept-btn {
  background: hsl(var(--color-success));
}

.accept-btn:hover {
  background: #047857;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.reject-btn,
.hangup-btn {
  background: hsl(var(--color-danger));
}

.reject-btn:hover,
.hangup-btn:hover {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.toggle-media-btn {
  background: white;
  border: 1px solid rgba(99, 102, 241, 0.15);
  color: hsl(var(--color-text-secondary));
}

.toggle-media-btn:hover {
  background: #f1f5f9;
  border-color: hsl(var(--accent-color));
  color: hsl(var(--accent-color));
}

/* ==========================================================================
   Utility Classes & Keyframe Animations
   ========================================================================== */
.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.text-center { text-align: center; }
.loading-spinner {
  text-align: center;
  color: hsl(var(--color-text-muted));
  font-size: 14px;
  grid-column: 1 / -1;
  padding: 40px;
}

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

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

@keyframes spinCd {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes callingRipple {
  0% { transform: scale(0.65); opacity: 0.8; }
  100% { transform: scale(1.65); opacity: 0; }
}

@keyframes typingDotPulse {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Default styles for toggle/close buttons */
.sidebar-toggle-btn,
.sidebar-close-btn {
  display: none;
}

.console-title-area {
  display: flex;
  align-items: center;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 900px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  /* Mobile Header Customizations */
  .nav-container {
    height: 60px;
    padding: 0 16px;
  }

  .nav-logo {
    font-size: 17px;
    letter-spacing: 1px;
    gap: 8px;
  }

  .nav-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: hsl(var(--accent-color));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .nav-toggle-btn:hover {
    background: #e2e8f0;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px;
    gap: 8px;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.08);
    z-index: 99;
  }

  .navbar.nav-open .nav-links {
    display: flex;
    animation: navSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .nav-links .nav-item {
    width: 100%;
    text-align: center;
    padding: 10px 16px;
    border-radius: 12px;
  }

  .nav-links .private-portal-btn {
    justify-content: center;
    margin-top: 4px;
  }

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

  .main-content {
    padding: 16px 12px 140px 12px;
  }

  .view-card {
    padding: 24px 16px;
  }

  .hero-title {
    font-size: 32px;
  }

  /* Chat Dashboard Mobile Drawer System */
  .chat-dashboard {
    grid-template-columns: 1fr;
    position: relative;
    height: calc(100vh - 220px);
    min-height: 460px;
  }

  .chat-sidebar {
    position: absolute;
    left: -100%;
    top: 0;
    bottom: 0;
    width: 270px;
    background: white;
    border-right: 1px solid rgba(99, 102, 241, 0.12);
    box-shadow: 12px 0 35px rgba(15, 23, 42, 0.1);
    z-index: 10;
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .chat-dashboard.sidebar-open .chat-sidebar {
    left: 0;
  }

  /* Show Toggle button on Mobile */
  .sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: hsl(var(--accent-color));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    margin-right: 12px;
    transition: all 0.2s ease;
  }

  .sidebar-toggle-btn:hover {
    background: #e2e8f0;
  }

  /* Show and style close button on Mobile */
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: hsl(var(--accent-color));
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .sidebar-close-btn:hover {
    background: #e2e8f0;
  }

  .console-header {
    padding: 14px 16px;
  }

  .console-title-area h3 {
    font-size: 15px;
  }

  .call-trigger-btn {
    padding: 6px 12px;
    font-size: 11px;
  }

  /* Mobile Audio Player adjustments */
  .audio-footer-player {
    bottom: 12px;
    padding: 8px 16px;
  }
}

@media (max-width: 480px) {
  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons button {
    width: 100%;
  }

  .webrtc-call-buttons {
    gap: 4px;
  }

  .call-trigger-btn {
    padding: 6px 8px;
    font-size: 10px;
  }
}
