/* ============================================
   RANDOCONNECT - Premium Minimalist Design
   ============================================ */

/* Critical CSS for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #6c5ce7;
  color: white;
  padding: 8px 16px;
  z-index: 10001;
  transition: top 0.3s;
  border-radius: 0 0 4px 0;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

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

/* Keyboard accessibility - focus indicators */
:focus-visible {
  outline: 2px solid var(--accent-primary, #7c3aed);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:root {
  /* Premium Color Palette */
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-elevated: #141414;
  --bg-tertiary: #1a1a1a;
  
  /* Accent - Sophisticated Purple */
  --accent-primary: #7c3aed;
  --accent-primary-hover: #6d28d9;
  --accent-glow: rgba(124, 58, 237, 0.15);
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  
  /* Status Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Typography */
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;
  
  /* UI Elements */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.6);
  
  /* Spacing & Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

html, body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01', 'ss02', 'cv01';
}

/* ============================================
   HEADER - Minimalist & Clean
   ============================================ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  height: 56px;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  font-size: 20px;
  filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.5));
}

.logo h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
}

.user-info:hover {
  border-color: var(--border-strong);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-primary);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.nickname {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.btn-logout {
  color: var(--text-tertiary);
  font-size: 16px;
  opacity: 0.6;
  transition: all 0.2s;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  opacity: 1;
  color: var(--danger);
  transform: scale(1.1);
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: radial-gradient(ellipse at top, rgba(124, 58, 237, 0.08) 0%, transparent 50%);
}

/* ============================================
   CHAT SCREEN - Premium Layout
   ============================================ */
.chat-screen {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 16px;
  min-height: 0;
  overflow: hidden;
}

.video-section {
  flex: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.video-main-container {
  flex: 1;
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  min-height: 0;
  box-shadow: var(--shadow-lg);
}

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

.video-pip-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--border-strong);
  cursor: pointer;
  z-index: 10;
  box-shadow: var(--shadow-xl);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-elevated);
}

.video-pip-container:hover {
  transform: scale(1.05);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-xl);
}

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

.video-pip-container .camera-off-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.video-pip-container .camera-off-overlay .cam-off-icon {
  font-size: 28px;
  margin-bottom: 6px;
  opacity: 0.5;
}

.video-pip-container .camera-off-overlay .cam-off-text {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.video-pip-container.camera-disabled .camera-off-overlay {
  display: flex;
}

.video-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  pointer-events: none;
  border: 1px solid var(--border-subtle);
}

.remote-label {
  background: rgba(124, 58, 237, 0.85);
  backdrop-filter: blur(12px);
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
}

.placeholder-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.3;
  filter: grayscale(100%);
}

.video-placeholder p {
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* ============================================
   CHAT SECTION - Clean & Modern
   ============================================ */
.chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  min-width: 320px;
  max-width: 400px;
  min-height: 0;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.chat-header h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.chat-status {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 100px;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--border-subtle);
}

.chat-status.connected {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  background: var(--bg-secondary);
}

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

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  word-wrap: break-word;
  animation: messageSlide 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

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

.message.system {
  align-self: center;
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  font-size: 12px;
  text-align: center;
  max-width: 100%;
  border: 1px solid var(--border-subtle);
}

.message.sent {
  align-self: flex-end;
  background: var(--accent-gradient);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.message.received {
  align-self: flex-start;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.message .sender {
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 4px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.typing-indicator {
  padding: 12px 18px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.chat-input-container {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.chat-input-container input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  min-width: 0;
}

.chat-input-container input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input-container input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input-container input::placeholder {
  color: var(--text-tertiary);
}

.chat-input-container .btn-send {
  background: var(--accent-gradient);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.chat-input-container .btn-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.chat-input-container .btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   CONTROLS - Minimalist Toolbar
   ============================================ */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  height: 72px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-start {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-start:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.btn-next {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-next:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-stop {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-stop:hover:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  transform: translateY(-2px);
}

.btn-report {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  width: 44px;
}

.btn-report:hover {
  background: var(--danger);
  border-color: var(--danger);
  transform: translateY(-2px);
}

.btn-mic, .btn-cam {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 12px;
  width: 44px;
  height: 44px;
}

.btn-mic:hover, .btn-cam:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.btn-mic.muted, .btn-cam.disabled {
  background: var(--danger);
  border-color: var(--danger);
}

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

/* ============================================
   SEARCHING OVERLAY - Elegant
   ============================================ */
.searching-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.searching-content {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

.searching-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.searching-content p {
  color: var(--text-tertiary);
  font-size: 13px;
  margin-bottom: 20px;
}

.btn-cancel {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* ============================================
   REPORT MODAL - Clean Dialog
   ============================================ */
.report-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease;
}

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

.report-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.report-modal-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.report-modal-content p {
  color: var(--text-tertiary);
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
}

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

.report-reason-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.report-reason-btn:hover,
.report-reason-btn.selected {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.report-modal-content textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 13px;
  resize: vertical;
  min-height: 70px;
  margin-bottom: 20px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}

.report-modal-content textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.report-modal-content textarea::placeholder {
  color: var(--text-tertiary);
}

.report-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-report-submit {
  background: var(--danger);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-report-submit:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ============================================
   FOOTER - Minimalist
   ============================================ */
.footer {
  text-align: center;
  padding: 12px 24px;
  color: var(--text-tertiary);
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  flex-shrink: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.01em;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  margin: 0 8px;
}

.footer a:hover {
  color: var(--accent-primary);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
  .chat-screen {
    flex-direction: column;
  }

  .video-section {
    flex: none;
    height: 50%;
  }

  .video-pip-container {
    width: 140px;
    height: 105px;
    bottom: 12px;
    right: 12px;
  }

  .chat-section {
    max-width: 100%;
    min-width: auto;
    flex: 1;
  }
}

@media (max-width: 768px) {
  .header {
    padding: 0 16px;
  }

  .chat-screen {
    padding: 12px;
    gap: 12px;
  }

  .video-section {
    height: 45%;
  }

  .video-pip-container {
    width: 120px;
    height: 90px;
    bottom: 10px;
    right: 10px;
  }

  .controls {
    flex-wrap: wrap;
    gap: 8px;
    height: auto;
    padding: 12px;
  }

  .btn {
    padding: 10px 16px;
    font-size: 12px;
  }

  .btn-mic, .btn-cam, .btn-report {
    width: 40px;
    height: 40px;
    padding: 10px;
  }
}

@media (max-width: 600px) {
  .chat-screen {
    padding: 8px;
    gap: 8px;
  }

  .video-section {
    height: 35%;
  }

  .chat-messages {
    padding: 12px;
  }

  .chat-input-container {
    padding: 10px 12px;
  }

  .video-pip-container {
    width: 100px;
    height: 75px;
    bottom: 8px;
    right: 8px;
  }
}

@media (max-width: 480px) {
  .logo h1 {
    font-size: 16px;
  }

  .nickname {
    display: none;
  }

  .video-section {
    height: 40%;
  }

  .chat-section {
    min-width: auto;
  }

  .footer {
    font-size: 11px;
    padding: 10px 16px;
  }
}

@media (max-width: 375px) {
  .header {
    padding: 0 10px;
    height: 44px;
  }

  .logo-icon {
    font-size: 16px;
  }

  .logo h1 {
    font-size: 14px;
  }

  .user-info {
    padding: 4px 10px;
    gap: 6px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 11px;
  }

  .controls {
    gap: 6px;
    padding: 10px;
  }

  .chat-header {
    padding: 10px 14px;
  }

  .footer {
    padding: 8px 12px;
    height: 36px;
    font-size: 10px;
  }
}
