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

:root {
  --primary: #7c5cff;
  --primary-hover: #967dff;
  --primary-light: #c1b3ff;
  --secondary: #2dd4bf;
  --secondary-light: #6ee7b7;
  --accent: #f43f5e;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --bg: #07080d;
  --bg-secondary: #0f111a;
  --bg-card: rgba(22, 24, 38, 0.7);
  --bg-card-hover: rgba(30, 32, 50, 0.85);
  --text: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --border: rgba(124, 92, 255, 0.2);
  --border-light: rgba(124, 92, 255, 0.35);
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.4);
  --glow: 0 0 0 1px rgba(124, 92, 255, 0.3), 0 10px 40px -4px rgba(124, 92, 255, 0.5);
  --radius: 24px;
  --radius-sm: 16px;
  --radius-xs: 10px;
  --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'Outfit', system-ui, sans-serif;
  --font: 'Inter', system-ui, sans-serif;
  --nav-height: 76px;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --text: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border: rgba(124, 92, 255, 0.15);
  --border-light: rgba(124, 92, 255, 0.25);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.04);
  --glow: 0 0 0 1px rgba(124, 92, 255, 0.2), 0 8px 30px -4px rgba(124, 92, 255, 0.3);
}

[dir="rtl"] {
  --font: 'Inter', 'Tahoma', 'Arial', sans-serif;
  --font-display: '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(--primary);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

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

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

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

.navbar .logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  -webkit-text-fill-color: white;
  box-shadow: 0 4px 16px -2px rgba(124, 92, 255, 0.5);
}

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

/* Buttons */
.btn {
  padding: 11px 26px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  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.1px;
}

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

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

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

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

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

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #c92e2e);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px -4px rgba(240, 68, 68, 0.45);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #14a888);
  color: white;
}

.btn-success:hover {
  transform: translateY(-2px);
}

.btn-icon {
  width: 42px;
  height: 42px;
  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);
}

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

.btn-icon.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-large {
  padding: 16px 40px;
  font-size: 16px;
  border-radius: var(--radius);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Inputs */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.input-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-family: var(--font-display);
}

.input-group input,
.input-group select {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

.input-group input:focus,
.input-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.16);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239d9cc2' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

[dir="rtl"] .input-group select {
  background-position: left 14px center;
  padding-right: 16px;
  padding-left: 38px;
}

.input-group select option {
  background: var(--bg-card);
  color: var(--text);
}

/* Auth Pages */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 15% 0%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(45, 212, 191, 0.12), transparent 60%);
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .auth-page {
  background-image:
    radial-gradient(ellipse 80% 60% at 15% 0%, rgba(124, 92, 255, 0.12), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(45, 212, 191, 0.10), transparent 60%);
}

.auth-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.16), transparent 70%);
  top: -220px;
  right: -180px;
  pointer-events: none;
  animation: drift 14s ease-in-out infinite;
}

.auth-page::after {
  content: '';
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.12), transparent 70%);
  bottom: -200px;
  left: -160px;
  pointer-events: none;
  animation: drift 17s ease-in-out infinite reverse;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.06); }
}

.auth-container {
  width: 100%;
  max-width: 430px;
  position: relative;
  z-index: 1;
}

.auth-box {
  background: linear-gradient(165deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  border-radius: var(--radius);
  padding: 42px 38px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
}

[data-theme="light"] .auth-box {
  background: var(--bg-card);
}

.auth-box .auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-box .auth-header .auth-logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-display);
  margin: 0 auto 18px;
  color: white;
  box-shadow: 0 10px 30px -6px rgba(124, 92, 255, 0.55);
}

.auth-box .auth-header h1 {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-box .auth-header p {
  color: var(--text-secondary);
  margin-top: 7px;
  font-size: 14px;
}

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

.auth-form .btn {
  margin-top: 8px;
  width: 100%;
  padding: 14px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Chat Page */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding-top: var(--nav-height);
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.video-container {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 1500px;
  flex: 1;
  min-height: 0;
  padding: 0 10px;
}

.video-box {
  flex: 1;
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  min-height: 200px;
  aspect-ratio: 4 / 3;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.video-box:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

#remoteVideoBox.in-call {
  border-color: rgba(45, 212, 191, 0.4);
  box-shadow: var(--glow);
}

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

.video-box .video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  font-size: 14px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-secondary) 50%, var(--bg-card) 100%);
  background-size: 200% 200%;
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.video-box .video-placeholder .placeholder-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  border: 2px solid var(--border);
  transition: all var(--transition);
  position: relative;
}

.video-box .video-placeholder .placeholder-icon::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, var(--primary), var(--secondary)) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition);
}

.video-box .video-placeholder.searching .placeholder-icon::after {
  opacity: 1;
  animation: spin 2s linear infinite;
}

.video-box .video-placeholder.searching {
  animation: shimmer 2s ease-in-out infinite;
}

.video-box .video-placeholder.searching .placeholder-text {
  animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.video-box .video-placeholder.connected {
  animation: none;
  background: linear-gradient(135deg, rgba(0, 184, 148, 0.1), rgba(0, 206, 209, 0.05));
}

.video-box .video-placeholder.error {
  animation: none;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.05));
}

.video-box .user-info {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 5;
}

.video-box .user-info .user-flag {
  width: 24px;
  height: 16px;
  border-radius: 3px;
  object-fit: cover;
}

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

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

.video-box .user-status {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-box .user-status.connected {
  background: rgba(0, 184, 148, 0.7);
}

.video-box .user-status.searching {
  background: rgba(253, 203, 110, 0.7);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Chat Controls */
.chat-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: rgba(11, 11, 26, 0.85);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  position: relative;
  z-index: 10;
}

[data-theme="light"] .chat-controls {
  background: rgba(255, 255, 255, 0.85);
}

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

.chat-controls .section-media {
  flex: 1;
  justify-content: center;
}

.chat-controls .section-primary {
  flex-shrink: 0;
}

.chat-controls .section-partner {
  flex: 1;
  justify-content: center;
}

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

.chat-controls .ctrl-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--transition);
  letter-spacing: 0.3px;
}

.chat-controls .ctrl-wrap:not(.disabled):hover .ctrl-label {
  color: var(--text-secondary);
}

.chat-controls .control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
  background: var(--bg-card);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.chat-controls .control-btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.chat-controls .control-btn.skip-btn {
  color: var(--warning);
}

.chat-controls .control-btn.skip-btn:hover {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}

.chat-controls .control-btn.report-btn {
  color: var(--danger);
}

.chat-controls .control-btn.report-btn:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.chat-controls .control-btn.camera-btn.cam-off {
  color: var(--danger);
  border-color: var(--danger);
}

.chat-controls .control-btn.camera-btn.cam-off:hover {
  background: var(--danger);
  color: white;
}

.chat-controls .control-btn.mute-btn.muted {
  color: var(--danger);
  border-color: var(--danger);
}

.chat-controls .control-btn.mute-btn.muted:hover {
  background: var(--danger);
  color: white;
}

.chat-controls .control-btn.start-btn {
  width: 66px;
  height: 66px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  box-shadow: 0 8px 30px -4px rgba(124, 92, 255, 0.55);
  font-size: 26px;
  position: relative;
  transition: all var(--transition);
}

.chat-controls .control-btn.start-btn::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary-light);
  opacity: 0.4;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.12); opacity: 0.1; }
  100% { transform: scale(1); opacity: 0.4; }
}

.chat-controls .control-btn.start-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 40px -4px rgba(124, 92, 255, 0.65);
}

.chat-controls .control-btn.start-btn:disabled {
  box-shadow: none !important;
}

.chat-controls .control-btn.start-btn:disabled::before {
  animation: none;
  opacity: 0;
}

.chat-controls .control-btn.stop-btn {
  display: none;
  color: var(--danger);
  border-color: var(--danger);
  border-width: 3px;
  width: 56px;
  height: 56px;
  box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
  animation: pulse-stop 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-stop {
  0%, 100% { box-shadow: 0 0 15px rgba(231, 76, 60, 0.3); }
  50% { box-shadow: 0 0 30px rgba(231, 76, 60, 0.6); }
}

.chat-controls .control-btn.stop-btn:hover {
  background: var(--danger);
  color: white;
}

.chat-controls .control-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.chat-controls .primary-wrap {
  position: relative;
}

.chat-controls .primary-label {
  position: absolute;
  bottom: -18px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-light);
  white-space: nowrap;
}

.chat-controls .control-btn.start-btn:disabled + .primary-label {
  color: var(--text-muted);
}

.chat-controls .section-media .ctrl-label {
  margin-top: 2px;
}

/* Region Selector */
.region-selector {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.region-btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-display);
}

.region-btn:hover {
  color: var(--text);
}

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

/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 2000;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4);
}

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

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

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

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

.settings-panel .settings-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.settings-panel .settings-header .close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 18px;
}

.settings-panel .settings-header .close-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text);
}

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

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

.settings-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  transition: all var(--transition);
}

.settings-item:hover {
  border-color: var(--border-light);
}

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

.settings-item .item-label {
  font-size: 14px;
  font-weight: 600;
}

.settings-item .item-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* 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: var(--border);
  border-radius: 26px;
  transition: var(--transition);
}

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

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

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


/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  backdrop-filter: blur(4px);
}

.overlay.show {
  opacity: 1;
  pointer-events: all;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 3000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: var(--success);
}

.toast.error {
  border-color: var(--danger);
}

.toast .toast-icon {
  font-size: 18px;
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Animations */
.fade-in {
  animation: fadeIn 0.4s ease;
}

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

.hidden {
  display: none !important;
}

.slide-up {
  animation: slideUp 0.4s ease;
}

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

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

  .chat-main {
    padding: 12px;
    height: calc(100% - 90px);
  }

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

  .video-box {
    flex: 1;
    min-height: 0;
    height: 50%;
  }

  .settings-panel {
    width: 100%;
    right: -100%;
  }

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

  .auth-box {
    padding: 24px;
  }

  .chat-controls {
    padding: 12px 8px;
    gap: 4px;
  }

  .chat-controls .control-section {
    gap: 4px;
  }

  .chat-controls .control-btn {
    width: 42px;
    height: 42px;
    font-size: 16px;
  }

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

  .chat-controls .control-btn.stop-btn {
    width: 48px;
    height: 48px;
  }

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

  .navbar {
    padding: 0 12px;
    gap: 6px;
  }

  .navbar .nav-actions {
    gap: 6px;
  }

  .region-selector {
    display: none;
  }

  .user-menu .user-details {
    display: none;
  }
}

/* Flag select styling */
.flag-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.flag-option img {
  width: 24px;
  height: 16px;
  border-radius: 2px;
  object-fit: cover;
}

/* Region group labels in select */
optgroup {
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-card);
}

/* User menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.user-menu:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.user-menu .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-display);
}

.user-menu .user-details {
  display: flex;
  flex-direction: column;
}

.user-menu .user-details .user-display-name {
  font-size: 13px;
  font-weight: 600;
}

.user-menu .user-details .user-display-email {
  font-size: 11px;
  color: var(--text-muted);
}

/* Modern status dots instead of text emojis */
.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

[dir="rtl"] .status-dot {
  margin-right: 0;
  margin-left: 8px;
}

.status-dot.pulsing-yellow {
  background-color: #fdcb6e;
  box-shadow: 0 0 8px #fdcb6e;
  animation: pulse-dot 1.5s infinite;
}

.status-dot.pulsing-green {
  background-color: #00b894;
  box-shadow: 0 0 8px #00b894;
}

.status-dot.gray {
  background-color: #6c6c8a;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* Mute Indicator on remote video */
.mute-indicator {
  position: absolute;
  top: 16px;
  left: 12px;
  display: none;
  align-items: center;
  gap: 6px;
  color: white;
  background: rgba(231, 76, 60, 0.7);
  backdrop-filter: blur(8px);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  z-index: 10;
  pointer-events: none;
}

.mute-indicator.visible {
  display: flex;
}

.mute-indicator span {
  white-space: nowrap;
}

/* Profile picture overlay for camera-off state */
.profile-pic-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  z-index: 6;
  display: none;
  border: 3px solid var(--border-light);
  box-shadow: 0 8px 30px -4px rgba(0,0,0,0.55), var(--glow);
}

.profile-pic-overlay.visible {
  display: block;
}

/* When a profile picture is shown, hide the generic placeholder icon/text so they don't overlap */
.video-placeholder.has-picture .placeholder-icon,
.video-placeholder.has-picture > span {
  opacity: 0;
}

@media (max-width: 768px) {
  .profile-pic-overlay {
    width: 96px;
    height: 96px;
  }
}

/* Online badge */
.online-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  animation: pulse-dot 1.5s infinite;
}

/* Ban Overlay */
.ban-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 5000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.ban-overlay.visible {
  opacity: 1;
}

.ban-overlay .ban-box {
  background: linear-gradient(165deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
  border: 1.5px solid var(--danger);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 70px rgba(240, 68, 68, 0.25), var(--shadow);
  animation: slideUp 0.5s ease;
}

.ban-overlay .ban-icon {
  margin-bottom: 16px;
}

.ban-overlay h2 {
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--danger);
  margin-bottom: 12px;
}

.ban-overlay .ban-reason {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}

.ban-overlay .ban-remaining {
  font-size: 14px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .online-badge {
    display: none;
  }
}

/* Modern Expandable Volume Control */
.volume-wrap {
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 30px;
  background: var(--bg-card);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border: 1px solid transparent;
}
.volume-wrap:hover, .volume-wrap.expanded {
  background: var(--bg-secondary);
  border-color: var(--border-light);
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}
.volume-btn {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  color: var(--text-secondary);
}
.volume-wrap:hover .volume-btn, .volume-wrap.expanded .volume-btn {
  color: var(--primary);
}
.volume-slider-container {
  width: 0;
  opacity: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.volume-wrap:hover .volume-slider-container, .volume-wrap.expanded .volume-slider-container {
  width: 80px;
  opacity: 1;
  padding-right: 12px;
}
[dir="rtl"] .volume-wrap:hover .volume-slider-container, [dir="rtl"] .volume-wrap.expanded .volume-slider-container {
  padding-right: 0;
  padding-left: 12px;
}
.modern-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-card);
  border-radius: 10px;
  outline: none;
  cursor: pointer;
}
.modern-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
  transition: transform 0.1s;
}
.modern-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}
.modern-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0,0,0,0.5);
  border: none;
}
