/* ============================================
   OmeChat — Premium Random Video Chat UI
   ============================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-glass: rgba(15, 15, 35, 0.85);
  --text-primary: #f0f0ff;
  --text-secondary: #8888aa;
  --text-muted: #555577;
  --accent-purple: #6C63FF;
  --accent-pink: #FF6584;
  --accent-cyan: #00D4FF;
  --accent-green: #00E676;
  --gradient-main: linear-gradient(135deg, #6C63FF 0%, #FF6584 100%);
  --gradient-cool: linear-gradient(135deg, #6C63FF 0%, #00D4FF 100%);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-active: rgba(108, 99, 255, 0.4);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.2);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent-purple);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- Screens ---- */
.screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
}

.screen.active {
  display: flex;
}

/* ================================================
   LANDING SCREEN
   ================================================ */
#landing-screen {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  position: relative;
}

.landing-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: orbFloat 8s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-purple);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 350px;
  height: 350px;
  background: var(--accent-pink);
  bottom: -80px;
  left: -80px;
  animation-delay: -3s;
}

.orb-3 {
  width: 250px;
  height: 250px;
  background: var(--accent-cyan);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -5s;
  opacity: 0.2;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 30px) scale(0.95); }
}

.landing-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 40px 24px;
  max-width: 440px;
  width: 100%;
}

/* Logo */
.logo-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.3); }
  50% { box-shadow: 0 0 20px 8px rgba(108, 99, 255, 0.15); }
}

.logo-text {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1px;
}

.gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  max-width: 280px;
}

/* Online badge */
.online-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.2);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-green);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 2s ease-in-out infinite;
}

.pulse-dot.small {
  width: 6px;
  height: 6px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.5); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(0, 230, 118, 0); }
}

/* Start section */
.start-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.rules-card {
  width: 100%;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
}

.rules-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.rules-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rules-card li {
  font-size: 13px;
  color: var(--text-secondary);
  padding-left: 18px;
  position: relative;
}

.rules-card li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent-green);
  font-weight: 700;
  font-size: 11px;
}

/* Gender select */
.gender-select {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gender-select label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.gender-options {
  display: flex;
  gap: 10px;
}

.gender-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg-card);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.gender-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(108, 99, 255, 0.3);
}

.gender-btn.active {
  background: rgba(108, 99, 255, 0.1);
  border-color: var(--accent-purple);
  color: var(--text-primary);
}

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

/* Primary Button */
.primary-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  background: var(--gradient-main);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.primary-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
  opacity: 0;
  transition: var(--transition);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(108, 99, 255, 0.35);
}

.primary-btn:hover::before {
  opacity: 1;
}

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

.terms {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ================================================
   CHAT SCREEN
   ================================================ */

/* Top Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
  flex-shrink: 0;
}

.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.brand-mini {
  font-size: 16px;
  font-weight: 700;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.connection-status.searching .status-dot {
  background: #FFB300;
  animation: pulse 1.5s ease-in-out infinite;
}

.connection-status.connected .status-dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.5);
}

.connection-status.disconnected .status-dot {
  background: var(--accent-pink);
}

.status-text {
  color: var(--text-secondary);
}

.connection-status.connected .status-text {
  color: var(--accent-green);
}

.connection-status.searching .status-text {
  color: #FFB300;
}

.online-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent-green);
  font-weight: 600;
}

/* Video Container */
.video-container {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}

.video-wrapper {
  position: relative;
  overflow: hidden;
}

.remote-video-wrapper {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

#remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  z-index: 2;
  transition: opacity 0.5s ease;
}

.video-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.searching-animation {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-ripple {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(108, 99, 255, 0.3);
  animation: ripple 2.5s ease-out infinite;
}

.search-ripple.delay-1 { animation-delay: 0.8s; }
.search-ripple.delay-2 { animation-delay: 1.6s; }

@keyframes ripple {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

.search-icon {
  font-size: 40px;
  z-index: 1;
  animation: searchBounce 2s ease-in-out infinite;
}

@keyframes searchBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.overlay-text {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: center;
  max-width: 250px;
}

.stranger-label {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stranger-label span {
  padding: 5px 14px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Local Video PIP */
.local-video-wrapper {
  position: absolute;
  bottom: 90px;
  right: 16px;
  width: 130px;
  height: 180px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-soft);
  z-index: 5;
  cursor: grab;
  transition: transform 0.2s ease;
}

.local-video-wrapper:hover {
  transform: scale(1.03);
}

#local-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  background: var(--bg-secondary);
}

.local-label {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

/* ---- Chat Panel ---- */
.chat-panel {
  position: absolute;
  bottom: 90px;
  left: 16px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.chat-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-toggle:hover {
  background: rgba(0, 0, 0, 0.8);
  color: var(--text-primary);
}

.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  background: var(--accent-pink);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePop 0.3s ease;
}

@keyframes badgePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.chat-body {
  width: 300px;
  max-height: 300px;
  background: rgba(10, 10, 26, 0.9);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.chat-body.open {
  display: flex;
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  min-height: 100px;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.chat-system-msg {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
}

.chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
  animation: msgSlide 0.2s ease;
  word-wrap: break-word;
}

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

.chat-msg.you {
  align-self: flex-end;
  background: var(--accent-purple);
  color: white;
  border-bottom-right-radius: 3px;
}

.chat-msg.stranger {
  align-self: flex-start;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-bottom-left-radius: 3px;
}

.chat-input-area {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--border-subtle);
}

#chat-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

#chat-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.15);
}

#chat-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.send-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-purple);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
  background: #5a52e0;
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---- Controls Bar ---- */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 10;
  flex-shrink: 0;
}

.control-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 48px;
  height: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
}

.control-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: scale(1.05);
}

.control-btn.active-mute {
  background: rgba(255, 101, 132, 0.15);
  border-color: rgba(255, 101, 132, 0.3);
  color: var(--accent-pink);
}

.primary-control {
  width: auto;
  padding: 0 28px;
  border-radius: var(--radius-full);
  background: var(--gradient-main);
  border: none;
  color: white;
  font-size: 14px;
  gap: 8px;
}

.primary-control:hover {
  box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
  color: white;
}

.danger-control:hover {
  background: rgba(255, 101, 132, 0.15);
  border-color: rgba(255, 101, 132, 0.3);
  color: var(--accent-pink);
}

.btn-label {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

/* ---- Report Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 360px;
  width: 90%;
  animation: modalPop 0.3s ease;
}

@keyframes modalPop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.report-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.report-option {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.report-option:hover {
  background: rgba(255, 101, 132, 0.1);
  border-color: rgba(255, 101, 132, 0.3);
  color: var(--accent-pink);
}

.cancel-btn {
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.cancel-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .logo-text {
    font-size: 34px;
  }

  .landing-content {
    padding: 30px 16px;
  }

  .local-video-wrapper {
    width: 100px;
    height: 140px;
    bottom: 80px;
    right: 10px;
  }

  .chat-panel {
    left: 10px;
    bottom: 80px;
  }

  .chat-body {
    width: 250px;
  }

  .controls-bar {
    padding: 10px 16px;
    gap: 8px;
  }

  .control-btn {
    width: 42px;
    height: 42px;
  }

  .primary-control {
    padding: 0 20px;
    font-size: 13px;
  }
}

@media (min-width: 768px) {
  .local-video-wrapper {
    width: 180px;
    height: 240px;
    bottom: 100px;
    right: 24px;
  }

  .chat-panel {
    left: 24px;
    bottom: 100px;
  }

  .chat-body {
    width: 350px;
    max-height: 400px;
  }

  .chat-messages {
    max-height: 320px;
  }
}

/* ---- Connection animation ---- */
.connecting-text {
  display: inline-flex;
  gap: 2px;
}

.connecting-text .dot {
  animation: dotBounce 1.4s ease-in-out infinite;
}

.connecting-text .dot:nth-child(2) { animation-delay: 0.2s; }
.connecting-text .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

/* Timer */
.call-timer {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 4;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
