/* ============================================================
   ChatAnon – Global Reset & Variables
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-dark:      #1a2433;
  --bg-panel:     #1e2d40;
  --bg-video:     #111820;
  --blue-primary: #2196f3;
  --blue-dark:    #1565c0;
  --blue-light:   #42a5f5;
  --btn-next:     #2196f3;
  --btn-back:     #1976d2;
  --btn-stop:     #607d8b;
  --text-main:    #e8eaf0;
  --text-muted:   #8fa0b4;
  --border:       #2d3f55;
  --chat-bg:      #ffffff;
  --accent-green: #4caf50;
  --accent-red:   #e53935;
  --radius:       6px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
}

.hidden { display: none !important; }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0d1b2a 0%, #1a2d45 50%, #0d1b2a 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.landing-box {
  background: rgba(30, 45, 64, 0.95);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 48px;
  max-width: 520px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.landing-logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--blue-light);
  margin-bottom: 8px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.landing-logo i { color: var(--blue-primary); }
.landing-logo strong { color: #fff; }

.landing-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

.landing-stats {
  margin-bottom: 24px;
}
.stat-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(33,150,243,0.12);
  border: 1px solid rgba(33,150,243,0.25);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 0.85rem;
  color: var(--blue-light);
}

.landing-options {
  text-align: left;
  margin-bottom: 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.option-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.option-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 70px;
  flex-shrink: 0;
}

.gender-select {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.gender-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; gap: 5px;
}
.gender-btn:hover { border-color: var(--blue-primary); color: var(--blue-light); }
.gender-btn.active {
  background: var(--blue-primary);
  border-color: var(--blue-primary);
  color: #fff;
}

.landing-buttons {
  display: flex; flex-direction: column; gap: 12px;
  margin-bottom: 20px;
}

.btn-start-video {
  background: linear-gradient(135deg, var(--blue-primary), var(--blue-dark));
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(33,150,243,0.35);
}
.btn-start-video:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(33,150,243,0.5);
}

.btn-start-text {
  background: rgba(255,255,255,0.07);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
}
.btn-start-text:hover { color: var(--text-main); border-color: var(--blue-primary); }

.landing-terms {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.landing-terms a { color: var(--blue-light); text-decoration: none; }

/* ============================================================
   CHAT INTERFACE LAYOUT
   ============================================================ */
.chat-interface {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* TOP BAR */
.top-bar {
  height: 56px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 10;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--blue-light);
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.logo i { color: var(--blue-primary); }
.logo strong { color: #fff; }

.nav-buttons {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  color: #fff;
}
.nav-btn:hover { filter: brightness(1.15); }
.nav-btn:active { transform: scale(0.97); }

.btn-back  { background: var(--btn-back); }
.btn-next  { background: var(--btn-next); }
.btn-stop  { background: var(--btn-stop); }

.top-right-info {
  display: flex; align-items: center; gap: 8px;
}
.online-badge {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* MAIN CONTENT */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ============================================================
   VIDEO AREA
   ============================================================ */
.video-area {
  display: flex;
  flex-direction: column;
  width: 56%;
  min-width: 300px;
  background: var(--bg-video);
  border-right: 2px solid var(--blue-dark);
  position: relative;
}

.video-panel {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #0a1015;
}

.video-panel video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#local-video,
#remote-video {
  transform: scaleX(-1);
}

/* Overlay */
.video-overlay {
  position: absolute; inset: 0;
  background: rgba(10,16,21,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  transition: opacity 0.3s;
}
.video-overlay.hidden { opacity: 0; pointer-events: none; }
.overlay-content {
  text-align: center;
  color: var(--text-muted);
}
.overlay-content p { margin-top: 12px; font-size: 0.9rem; }

.status-icon {
  font-size: 2.5rem;
  color: var(--blue-light);
}
.status-icon.connected { color: var(--accent-green); }
.status-icon.disconnected { color: var(--accent-red); }

/* Video labels */
.video-label {
  position: absolute;
  top: 10px; left: 12px;
  background: rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.75);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  z-index: 6;
  pointer-events: none;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Watermark */
.remote-panel::after {
  content: 'ChatAnon';
  position: absolute;
  top: 10px; right: 14px;
  color: rgba(255,255,255,0.35);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 7;
  pointer-events: none;
  letter-spacing: 1px;
}

/* Resize handle between videos */
.resize-handle {
  height: 6px;
  background: var(--border);
  cursor: ns-resize;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.resize-handle::before {
  content: '';
  width: 32px; height: 3px;
  background: var(--blue-primary);
  border-radius: 2px;
  opacity: 0.6;
}


/* Video controls bar */
.video-controls {
  height: 52px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-shrink: 0;
  padding: 0 12px;
}

.ctrl-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.ctrl-btn:hover { background: rgba(33,150,243,0.2); color: var(--blue-light); }
.ctrl-btn.active {
  background: var(--blue-primary);
  color: #fff;
  border-color: var(--blue-light);
  box-shadow: 0 0 8px rgba(33,150,243,0.4);
}
.ctrl-btn.muted {
  background: rgba(229,57,53,0.2);
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* ============================================================
   CHAT AREA
   ============================================================ */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
  min-width: 0;
}

.stranger-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fc;
  flex-shrink: 0;
}

.info-left {
  display: flex; align-items: center; gap: 10px;
}

.gender-icon {
  font-size: 1.1rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.gender-icon.male   { background: #e3f2fd; color: #1565c0; }
.gender-icon.female { background: #fce4ec; color: #c2185b; }
.gender-icon.other  { background: #f3e5f5; color: #7b1fa2; }

.country-flag {
  width: 24px; height: 16px;
  object-fit: cover;
  border-radius: 3px;
}

#stranger-location {
  font-size: 0.92rem;
  font-weight: 600;
  color: #2c3e50;
}


/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
}

.messages-container::-webkit-scrollbar { width: 5px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.message {
  max-width: 78%;
  padding: 9px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}
.message.you {
  background: var(--blue-primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.message.stranger {
  background: #f0f2f5;
  color: #2c3e50;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.system-message {
  font-size: 0.8rem;
  color: #999;
  text-align: center;
  padding: 6px 12px;
  background: #f5f5f5;
  border-radius: 12px;
  align-self: center;
  display: flex; align-items: center; gap: 6px;
}

/* Message input */
.message-input-area {
  display: flex;
  padding: 10px 12px;
  border-top: 1px solid #e8e8e8;
  background: #f8f9fc;
  gap: 8px;
  flex-shrink: 0;
}

#message-input {
  flex: 1;
  border: 1px solid #dde1e7;
  border-radius: 22px;
  padding: 10px 18px;
  font-size: 0.9rem;
  outline: none;
  background: #fff;
  color: #333;
  transition: border-color 0.2s;
}
#message-input:focus { border-color: var(--blue-primary); }
#message-input::placeholder { color: #aaa; }

.send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--blue-primary);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}
.send-btn:hover { background: var(--blue-dark); }
.send-btn:active { transform: scale(0.94); }

/* ============================================================
   SETTINGS MODAL
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 380px;
  max-width: 90%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  color: var(--text-main);
}
.modal-close {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1.1rem;
}
.modal-close:hover { color: var(--text-main); }

.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }

.setting-group {
  display: flex; flex-direction: column; gap: 6px;
}
.setting-group label {
  font-size: 0.82rem; color: var(--text-muted); font-weight: 500;
}
.setting-group select {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  outline: none;
}
.setting-group select:focus { border-color: var(--blue-primary); }

.modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end;
}

.btn-primary {
  background: var(--blue-primary);
  color: #fff; border: none;
  padding: 9px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--blue-dark); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  /* Layout */
  .main-content { flex-direction: column; }

  /* Video */
  .video-area {
    width: 100%;
    height: 58vh;
    min-height: 300px;
    border-right: none;
    border-bottom: 2px solid var(--blue-dark);
    flex-shrink: 0;
  }

  /* Chat */
  .chat-area { flex: 1; min-height: 0; }

  /* Top bar */
  .top-bar { padding: 0 8px; gap: 6px; }
  .logo { font-size: 0.95rem; }
  .nav-btn { padding: 8px 10px; font-size: 0.8rem; gap: 4px; }
  .nav-btn i { font-size: 0.85rem; }
  .online-badge { display: none; }

  /* Landing */
  .landing-box { padding: 24px 18px; }
  .landing-logo { font-size: 1.5rem; }
  .option-row { flex-direction: column; gap: 6px; }
  .option-row label { width: auto; }
  .gender-select { flex-wrap: wrap; }

  /* Stranger info */
  .stranger-info { padding: 8px 12px; }
  #stranger-location { font-size: 0.82rem; }

  /* Messages */
  .messages-container { padding: 10px; }

  /* Input */
  .message-input-area { padding: 7px 8px; }
  #message-input { padding: 8px 14px; font-size: 0.85rem; }

  /* Controls */
  .video-controls { gap: 14px; height: 46px; }
  .ctrl-btn { width: 36px; height: 36px; font-size: 0.9rem; }
}

@media (max-width: 400px) {
  .nav-btn span { display: none; } /* Back/Next/Stop yazıları gizle, sadece ikon */
  .nav-btn { padding: 8px; }
}

/* Pulse animation for searching */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.pulse { animation: pulse 1.5s ease-in-out infinite; }

