/*!
 *  Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
 *  License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
 */@font-face{font-family:FontAwesome;src:url(../fonts/fontawesome-webfont.eot?v=4.7.0);src:url(../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0) format("embedded-opentype"),url(../fonts/fontawesome-webfont.woff2?v=4.7.0) format("woff2"),url(../fonts/fontawesome-webfont.woff?v=4.7.0) format("woff"),url(../fonts/fontawesome-webfont.ttf?v=4.7.0) format("truetype"),url(../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular) format("svg");font-weight:400;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{animation:a 2s infinite linear}.fa-pulse{animation:a 1s infinite steps(8)}@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(359deg)}}.fa-rotate-90{transform:rotate(90deg)}.fa-rotate-180{transform:rotate(180deg)}.fa-rotate-270{transform:rotate(270deg)}.fa-flip-horizontal{transform:scaleX(-1)}.fa-flip-vertical{transform:scaleY(-1)}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-spinner:before{content:"\f110"}.fa-comment:before{content:"\f075"}.fa-times:before{content:"\f00d"}.fa-paper-plane:before{content:"\f1d8"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}

/* ══════════════════════════════════════════════
   ChatHood – New Design
   ══════════════════════════════════════════════ */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  color: #ffffff;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-color: #0a0a1a;
}

/* ── Accessibility ── */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── Logo ── */
.ch-logo {
  position: fixed;
  top: 16px;
  left: 20px;
  z-index: 100;
  display: block;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.ch-logo:hover {
  opacity: 1;
}

.ch-logo img {
  height: 36px;
  width: auto;
  display: block;
}

/* ── Main Wrapper ── */
.ch-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Video Area ── */
.ch-video-area {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  width: 100%;
  max-width: 1100px;
  flex-shrink: 0;
}

.ch-video-box {
  width: 350px;
  max-width: 525px;
  min-width: 175px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  position: relative;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 12px;
}

/* Resize grip indicator (bottom-right corner) */
.ch-video-box::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.3) 50%);
  border-radius: 0 0 12px 0;
  z-index: 5;
}

.ch-video-box:hover::after {
  opacity: 1;
}

.ch-video-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  background: transparent;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  will-change: transform;
}

.ch-remote-canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  object-fit: cover;
}

.ch-video-stranger.use-canvas-fallback video {
  opacity: 0.01;
}

/* Mirror own camera (natural mirror UX) */
.ch-video-me video {
  transform: scaleX(-1);
}

.ch-video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.95em;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.ch-welcome-title {
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(2.25rem, 4.6vw, 3.45rem);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72), 0 1px 2px rgba(0, 0, 0, 0.8);
}

.ch-search-title {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.05em;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.72), 0 1px 2px rgba(0, 0, 0, 0.8);
}

.ch-welcome-text {
  max-width: 32ch;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1.22rem, 2.25vw, 1.55rem);
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.74), 0 1px 2px rgba(0, 0, 0, 0.82);
}

.ch-search-text {
  max-width: 26ch;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.88em;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.74), 0 1px 2px rgba(0, 0, 0, 0.82);
}

  .ch-video-placeholder .fa {
    color: rgba(255, 255, 255, 0.25);
  }

  .ch-welcome-title {
    font-size: 2.65em;
  }

  .ch-search-title {
    font-size: 1.05em;
  }

  .ch-welcome-text {
    max-width: 24ch;
    font-size: 1.45em;
  }

  .ch-search-text {
    max-width: 22ch;
    font-size: 0.82em;
  }

/* Hide placeholder once video is playing */
.ch-video-box.has-video .ch-video-placeholder {
  display: none;
}

/* ── Controls ── */
.ch-controls {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  flex-shrink: 0;
}

.ch-btn {
  background: rgba(0, 0, 0, 0.50);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 44px;
  font-size: 1em;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  text-transform: capitalize;
}

.ch-btn:hover {
  background: rgba(0, 0, 0, 0.70);
  border-color: rgba(255, 255, 255, 0.25);
}

.ch-btn:active {
  background: rgba(0, 0, 0, 0.80);
}

.ch-btn:focus {
  outline: none;
}

/* ── Chat toggle (hidden on desktop) ── */
.ch-btn-chat {
  display: none !important;
}

.ch-chat-badge {
  display: none !important;
}

/* ── Chat Section ── */
.ch-chat-section {
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  flex-shrink: 0;
  gap: 10px;
}

/* Input Bar */
.ch-input-bar {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  gap: 0;
}

.ch-input-bar input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  background: rgba(0, 0, 0, 0.50);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px 0 0 12px;
  color: #ffffff;
  font-size: 0.95em;
  font-family: inherit;
  letter-spacing: 0.3px;
  transition: border-color 0.2s ease;
}

.ch-input-bar input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.ch-input-bar input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.25);
}

/* Send Button */
.ch-send-btn {
  background: rgba(0, 0, 0, 0.50);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-left: none;
  border-radius: 0 12px 12px 0;
  color: rgba(255, 255, 255, 0.6);
  padding: 0 16px;
  font-size: 1em;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.ch-send-btn:hover {
  color: #ffffff;
  background: rgba(0, 0, 0, 0.70);
}

.ch-send-btn:focus {
  outline: none;
}

/* Chat Close Button (hidden on desktop) */
.ch-chat-close {
  display: none;
}

/* Chat Box */
.ch-chatbox {
  width: 100%;
  flex: 1;
  min-height: 240px;
  height: 240px;
  max-height: 600px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.92em;
  line-height: 1.5;
}

/* Chat Messages */
.ch-chatbox .msg-me {
  color: #5b9cf5;
}

.ch-chatbox .msg-stranger {
  color: #f55b5b;
}

.ch-chatbox .msg-system {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.ch-chatbox .msg-system.error {
  color: #ff6b6b;
}

/* Scrollbar styling */
.ch-chatbox::-webkit-scrollbar {
  width: 5px;
}

.ch-chatbox::-webkit-scrollbar-track {
  background: transparent;
}

.ch-chatbox::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

/* ── Online Counter ── */
.ch-online-count {
  position: fixed;
  bottom: 16px;
  right: 20px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.65);
  padding: 6px 14px;
  font-size: 0.82em;
  font-weight: 500;
  letter-spacing: 0.3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* WebRTC diagnostics */
.ch-ice-diagnostics {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 120;
  max-width: min(520px, calc(100vw - 32px));
  padding: 7px 10px;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  line-height: 1.35;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  pointer-events: none;
}

.ch-ice-diagnostics strong {
  color: #ffffff;
  margin-right: 6px;
}

.ch-ice-diagnostics span {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

/* ── Badge pulse animation ── */
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

/* ══════════════════════════════════════════════
   MOBILE (max-width: 768px)
   ══════════════════════════════════════════════ */
@media screen and (max-width: 768px) {

  html, body {
    overflow: hidden;
    height: 100%;
    position: fixed;
    width: 100%;
  }

  /* Logo 30% smaller */
  .ch-logo {
    top: 10px;
    left: 12px;
    z-index: 50;
  }

  .ch-logo img {
    height: 25px;
  }

  .ch-wrapper {
    padding: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    justify-content: stretch;
  }

  /* Video area fills entire screen */
  .ch-video-area {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-width: 100%;
    height: 100%;
    position: relative;
  }

  .ch-video-box {
    max-width: 100%;
    min-width: 0;
    width: auto;
    aspect-ratio: auto;
    resize: none !important;
  }

  .ch-video-box::after {
    display: none;
  }

  /* Stranger fills entire screen, no margins */
  .ch-video-stranger {
    order: 1;
    flex: 1;
    margin: 0;
    border-radius: 0;
    background: transparent;
  }

  .ch-video-stranger .ch-video-placeholder {
    justify-content: flex-start;
    padding-top: clamp(150px, 23vh, 240px);
  }

  /* Own video: 2:3 PIP overlay, draggable */
  .ch-video-me {
    order: 2;
    position: absolute;
    bottom: 76px;
    right: 10px;
    width: 26vw;
    height: auto;
    aspect-ratio: 2 / 3;
    flex: none;
    border-radius: 8px;
    z-index: 15;
    border: 2px solid rgba(255, 255, 255, 0.18);
    touch-action: none;
    cursor: grab;
    transition: none;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  }

  .ch-video-me.dragging {
    opacity: 0.85;
    cursor: grabbing;
  }

  /* Controls at the bottom center */
  .ch-controls {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    margin-top: 0;
    order: 3;
    align-items: stretch;
  }

  .ch-btn {
    background: rgba(0, 0, 0, 0.30);
    border-color: rgba(255, 255, 255, 0.15);
    padding: 12px 30px;
    font-size: 1.15em;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Chat toggle button – visible on mobile */
  .ch-btn-chat {
    display: inline-flex !important;
    padding: 12px 18px;
    position: relative;
    font-size: 1.1em;
    min-width: 50px;
  }

  /* Notification badge (red dot) */
  .ch-chat-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 10px;
    height: 10px;
    background: #ff3b3b;
    border-radius: 50%;
    display: none !important;
    box-shadow: 0 0 6px rgba(255, 59, 59, 0.7);
  }

  .ch-chat-badge.active {
    display: block !important;
    animation: pulse-badge 1.5s infinite;
  }

  /* Chat section = slide-up overlay on mobile */
  .ch-chat-section {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50vh;
    height: 50dvh;
    max-width: 100%;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    flex-direction: column;
    padding: 10px 14px 14px;
    gap: 8px;
    margin-top: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
  }

  .ch-chat-section.ch-chat-open {
    transform: translateY(0);
  }

  /* Close button at top of chat overlay */
  .ch-chat-close {
    display: block;
    align-self: flex-end;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.3em;
    padding: 4px 8px;
    cursor: pointer;
    flex-shrink: 0;
    order: 0;
  }

  .ch-chat-close:hover,
  .ch-chat-close:active {
    color: #ffffff;
  }

  /* Messages area */
  .ch-chat-section .ch-chatbox {
    order: 1;
    flex: 1;
    max-height: none;
    min-height: 0;
  }

  /* Input at bottom */
  .ch-chat-section .ch-input-bar {
    order: 2;
  }

  /* Hide online counter on mobile */
  .ch-online-count {
    display: none;
  }

  .ch-ice-diagnostics {
    left: 8px;
    bottom: 64px;
    max-width: calc(100vw - 16px);
    font-size: 10px;
    padding: 6px 8px;
  }
}

/* ── Tablets (769px – 1024px) ── */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .ch-video-box {
    max-width: 280px;
  }

  .ch-video-area {
    gap: 20px;
  }

  .ch-chat-section {
    max-width: 580px;
  }
}
