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

:root {
  --primary: #7c5cff;
  --primary-hover: #6a47f0;
  --primary-light: #b3a1ff;
  --primary-glow: rgba(124, 92, 255, 0.35);
  --secondary: #2dd4bf;
  --secondary-light: #5eead4;
  --secondary-glow: rgba(45, 212, 191, 0.35);
  --accent: #ff4757;
  --danger: #ff4757;
  --danger-glow: rgba(255, 71, 87, 0.35);
  --success: #2dd4bf;
  --warning: #fbbf4a;

  --bg: #060611;
  --bg-secondary: #0a0a1e;
  --bg-card: rgba(18, 18, 42, 0.7);
  --bg-card-hover: rgba(26, 26, 58, 0.85);

  --text: #f8f8fc;
  --text-secondary: #a3a2cb;
  --text-muted: #696894;

  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  --border-active: rgba(124, 92, 255, 0.5);

  --shadow: 0 30px 80px -15px rgba(0, 0, 0, 0.85), 0 0 30px rgba(124, 92, 255, 0.15);
  --shadow-sm: 0 12px 32px -4px rgba(0, 0, 0, 0.6);
  --glow: 0 0 0 1px rgba(124, 92, 255, 0.25), 0 10px 40px -5px rgba(124, 92, 255, 0.4);

  --radius: 24px;
  --radius-sm: 14px;
  --radius-xs: 10px;

  --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --nav-height: 76px;
}

[data-theme="light"] {
  --bg: #f2f0fc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --text: #120e26;
  --text-secondary: #4a456e;
  --text-muted: #8580aa;
  --border: rgba(124, 92, 255, 0.12);
  --border-light: rgba(124, 92, 255, 0.25);
  --shadow: 0 25px 60px -10px rgba(76, 58, 145, 0.16), 0 4px 16px rgba(76, 58, 145, 0.08);
  --shadow-sm: 0 10px 30px -4px rgba(76, 58, 145, 0.12);
  --glow: 0 0 0 1px rgba(124, 92, 255, 0.2), 0 10px 35px -5px rgba(124, 92, 255, 0.25);
}

[dir="rtl"] {
  --font: 'Outfit', 'Plus Jakarta Sans', 'Tahoma', 'Arial', sans-serif;
  --font-display: 'Outfit', 'Plus Jakarta Sans', 'Tahoma', 'Arial', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--secondary);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

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

::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 92, 255, 0.4);
}

:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Glass Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(10, 10, 26, 0.75);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 1000;
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.8);
}

.navbar .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff, #b3a1ff, #2dd4bf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar .logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  -webkit-text-fill-color: white;
  box-shadow: 0 8px 24px -2px rgba(124, 92, 255, 0.6);
  transform: perspective(400px) rotateX(10deg);
}

.navbar .nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Glass Buttons */
.btn {
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  letter-spacing: 0.2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 8px 25px -4px rgba(124, 92, 255, 0.5);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 35px -4px rgba(124, 92, 255, 0.65);
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #d63031);
  color: white;
  box-shadow: 0 8px 25px -4px rgba(255, 71, 87, 0.4);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 35px -4px rgba(255, 71, 87, 0.6);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  backdrop-filter: blur(12px);
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text);
  transform: translateY(-2px) scale(1.05);
}

.btn-icon.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(124, 92, 255, 0.4);
}

/* Chat Page Layout */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: var(--nav-height);
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 0;
  position: relative;
  overflow: hidden;
  height: calc(100vh - var(--nav-height));
}

/* Video Grid Area */
.video-container {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 1550px;
  flex: 1;
  min-height: 0;
  padding: 0;
  margin-bottom: 16px;
}

.video-box {
  flex: 1;
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  background: rgba(18, 18, 42, 0.7);
  backdrop-filter: blur(20px);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 0;
  height: 100%;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-box:hover {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 35px 90px -15px rgba(0, 0, 0, 0.9);
}

#remoteVideoBox.in-call {
  border-color: rgba(45, 212, 191, 0.6);
  box-shadow: 0 0 50px rgba(45, 212, 191, 0.25), var(--shadow);
}

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

/* Video Placeholders with Radar Wave */
.video-box .video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  background: radial-gradient(circle at center, rgba(30, 30, 65, 0.6) 0%, rgba(10, 10, 26, 0.9) 100%);
}

.video-box .video-placeholder .placeholder-icon {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(124, 92, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  border: 2px solid rgba(124, 92, 255, 0.3);
  transition: all 0.4s ease;
  position: relative;
}

.video-box .video-placeholder.searching .placeholder-icon::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 2px solid rgba(124, 92, 255, 0.4);
  animation: radarWave 2s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}

.video-box .video-placeholder.searching .placeholder-icon::after {
  content: '';
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  border: 2px solid rgba(45, 212, 191, 0.3);
  animation: radarWave 2s cubic-bezier(0, 0.2, 0.8, 1) infinite 0.6s;
}

@keyframes radarWave {
  0% { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.video-box .user-info {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(10, 10, 26, 0.65);
  backdrop-filter: blur(20px) saturate(180%);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.video-box .user-info .user-flag {
  width: 26px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
}

.video-box .user-info .user-name {
  font-size: 14px;
  font-weight: 700;
  color: white;
}

.video-box .user-info .user-country {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

.video-box .user-status {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(10, 10, 26, 0.65);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: white;
  z-index: 5;
}

/* Controls Bar (Compact Floating Glass Dock) */
.chat-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 28px;
  background: rgba(12, 12, 30, 0.85);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-radius: 40px;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  margin: 0 auto 16px;
  max-width: 840px;
  width: 92%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  gap: 16px;
  position: relative;
  z-index: 20;
}

.chat-controls .control-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-controls .ctrl-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.chat-controls .ctrl-label {
  font-size: 11px;
  font-weight: 600;
  color: #9d9cc2;
  white-space: nowrap;
}

.chat-controls .control-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-controls .control-btn:hover {
  transform: translateY(-3px) scale(1.05);
  background: rgba(124, 92, 255, 0.2);
  border-color: rgba(124, 92, 255, 0.5);
  box-shadow: 0 10px 25px rgba(124, 92, 255, 0.3);
}

.chat-controls .control-btn.start-btn {
  width: 62px;
  height: 62px;
  background: linear-gradient(135deg, #7c5cff, #2dd4bf);
  color: white;
  border: none;
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.55);
  font-size: 26px;
  position: relative;
}

.chat-controls .control-btn.start-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(45, 212, 191, 0.6);
  animation: auraPulse 2s infinite;
}

@keyframes auraPulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0.2; }
  100% { transform: scale(1); opacity: 0.8; }
}

.chat-controls .control-btn.skip-btn:hover {
  background: linear-gradient(135deg, #fbbf4a, #f39c12);
  border-color: #fbbf4a;
  color: white;
  box-shadow: 0 10px 25px rgba(251, 191, 74, 0.4);
}

.chat-controls .control-btn.report-btn:hover {
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  border-color: #ff4757;
  color: white;
  box-shadow: 0 10px 25px rgba(255, 71, 87, 0.4);
}

/* Region Selector segmented pill */
.region-selector {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.region-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 16px;
  background: transparent;
  color: #9d9cc2;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-display);
}

.region-btn.active {
  background: linear-gradient(135deg, #7c5cff, #6a47f0);
  color: white;
  box-shadow: 0 4px 15px rgba(124, 92, 255, 0.5);
}

/* Online Badge pill */
.online-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 700;
  color: #dcd6ff;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2dd4bf;
  box-shadow: 0 0 10px #2dd4bf;
}

/* User Menu Pill */
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 6px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-menu:hover {
  background: rgba(124, 92, 255, 0.15);
  border-color: rgba(124, 92, 255, 0.4);
}

.user-menu .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c5cff, #2dd4bf);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: 800;
}

/* Settings Sidebar Panel */
.settings-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: #0c0c24;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 3000;
  transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.7);
}

.settings-panel.open {
  right: 0;
}

[dir="rtl"] .settings-panel {
  right: auto;
  left: -420px;
  border-left: none;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

[dir="rtl"] .settings-panel.open {
  left: 0;
  right: auto;
}

.settings-panel .settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-panel .settings-header h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
}

.settings-panel .settings-header .close-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #a3a2cb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.settings-panel .settings-header .close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.settings-panel .settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #7c5cff;
  margin-bottom: 14px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 10px;
}

.settings-item .item-label {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.settings-item .item-desc {
  font-size: 12px;
  color: #9d9cc2;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

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

.toggle .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 26px;
  transition: 0.3s ease;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 3px;
  left: 3px;
  transition: 0.3s ease;
}

.toggle input:checked + .slider {
  background: #7c5cff;
}

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

/* Ban Overlay Modern Styling */
.ban-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 17, 0.85);
  backdrop-filter: blur(16px);
  z-index: 5000;
  align-items: center;
  justify-content: center;
}

.ban-overlay .ban-box {
  background: rgba(20, 20, 48, 0.9);
  border: 2px solid #ff4757;
  border-radius: 28px;
  padding: 44px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 80px rgba(255, 71, 87, 0.35);
}

.ban-overlay h2 {
  font-size: 26px;
  font-weight: 900;
  color: #ff4757;
  margin-bottom: 12px;
}

.ban-overlay .ban-reason {
  font-size: 16px;
  color: #f8f8fc;
  margin-bottom: 10px;
}

.ban-overlay .ban-remaining {
  font-size: 15px;
  color: #9d9cc2;
  font-weight: 600;
}

/* Responsive Mobile Overrides */
@media (max-width: 768px) {
  .chat-page {
    height: 100vh;
    overflow: hidden;
    padding-top: 64px;
  }

  .navbar {
    height: 64px;
    padding: 0 14px;
  }

  .navbar .logo {
    font-size: 20px;
  }

  .navbar .logo-icon {
    width: 34px;
    height: 34px;
    font-size: 17px;
  }

  .chat-main {
    padding: 8px 10px 78px;
    height: calc(100vh - 64px);
  }

  .video-container {
    flex-direction: column;
    gap: 10px;
    height: 100%;
    max-width: 100%;
    padding: 0;
  }

  .video-box {
    flex: 1;
    width: 100%;
    min-height: 0;
    border-radius: 20px;
    aspect-ratio: auto;
  }

  .chat-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    border-radius: 24px 24px 0 0;
    padding: 10px 14px;
    background: rgba(8, 8, 22, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1.5px solid rgba(255, 255, 255, 0.12);
    border-left: none;
    border-right: none;
    border-bottom: none;
    z-index: 1000;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-around;
    gap: 4px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.85);
  }

  .chat-controls .control-section {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .chat-controls .control-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .chat-controls .control-btn.start-btn {
    width: 58px;
    height: 58px;
    font-size: 24px;
  }

  .chat-controls .ctrl-label {
    display: none;
  }

  .online-badge, .region-selector {
    display: none;
  }

  .settings-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background: #0d0d26;
    border-left: none;
    z-index: 3000;
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.9);
  }

  .settings-panel.open {
    right: 0;
  }

  [dir="rtl"] .settings-panel {
    right: auto;
    left: -100%;
  }

  [dir="rtl"] .settings-panel.open {
    left: 0;
    right: auto;
  }
}
