:root {
  --bg-main: #0b0f19;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-glass: rgba(17, 24, 39, 0.75);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #6366f1;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
}

/* Üst Header */
.app-header {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
  backdrop-filter: blur(8px);
}

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

.logo-pulse {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.live-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(0.9); opacity: 1; }
}

.brand-title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 40%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.room-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-surface-elevated);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
}

.room-hash {
  color: var(--primary);
  font-weight: 700;
}

.btn-icon-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-pill:hover {
  background: var(--primary);
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  padding: 4px 10px 4px 5px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.avatar-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
  color: #fff;
}

.username-display {
  font-size: 0.85rem;
  font-weight: 500;
}

.btn-danger-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-danger-pill:hover {
  background: var(--danger);
  color: #fff;
}

/* Ana Alan */
.main-content {
  flex: 1;
  display: flex;
  position: relative;
  overflow: hidden;
}

/* Video Sahnesi */
.stage-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
  position: relative;
}

.video-grid {
  display: grid;
  gap: 12px;
  width: 100%;
  height: 100%;
  max-width: 1400px;
  align-content: center;
  justify-content: center;
}

/* Otomatik Grid Düzenleri */
.video-grid[data-count="1"] {
  grid-template-columns: 1fr;
  max-width: 900px;
}

.video-grid[data-count="2"] {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.video-grid[data-count="3"],
.video-grid[data-count="4"] {
  grid-template-columns: repeat(2, 1fr);
}

.video-grid[data-count="5"],
.video-grid[data-count="6"] {
  grid-template-columns: repeat(3, 1fr);
}

/* Video Kartları */
.video-card {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  border: 2px solid transparent;
  aspect-ratio: 16 / 9;
  min-height: 160px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.video-card.is-speaking {
  border-color: var(--success) !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}

.video-overlay {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 2;
}

.user-tag {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-badges {
  display: flex;
  gap: 6px;
}

.badge {
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
}

/* Kamera Kapalı Olduğunda Gözüken Avatar */
.avatar-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, var(--bg-surface-elevated) 0%, var(--bg-surface) 100%);
  z-index: 1;
}

.avatar-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* Yan Sohbet Paneli */
.chat-section {
  width: 360px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 15;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}

.online-counter {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.btn-icon {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  user-select: text;
}

.welcome-banner {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  margin-bottom: 12px;
}

.welcome-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.welcome-banner h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.welcome-banner p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Mesaj Balonları */
.chat-bubble {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeIn 0.2s ease-out;
}

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

.chat-bubble.mine {
  align-self: flex-end;
}

.chat-bubble.others {
  align-self: flex-start;
}

.chat-bubble.system {
  align-self: center;
  text-align: center;
  max-width: 100%;
}

.system-text {
  font-size: 0.75rem;
  color: var(--text-faint);
  background: var(--bg-surface-elevated);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.bubble-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  font-size: 0.75rem;
}

.sender-name {
  font-weight: 600;
}

.msg-time {
  color: var(--text-faint);
}

.bubble-content {
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-bubble.mine .bubble-content {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 3px;
}

.chat-bubble.others .bubble-content {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-bottom-left-radius: 3px;
}

.file-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.25);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  text-decoration: none;
  color: inherit;
}

.file-attachment img {
  max-width: 220px;
  max-height: 180px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.typing-indicator {
  padding: 4px 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Mesaj Giriş Barı */
.chat-input-bar {
  padding: 10px 12px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-input-bar input[type="text"] {
  flex: 1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 9px 14px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input-bar input[type="text"]:focus {
  border-color: var(--primary);
}

.btn-tool {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 1.1rem;
}

.btn-tool:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
}

.btn-send {
  background: var(--primary);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-send:hover {
  background: var(--primary-hover);
}

.btn-send:active {
  transform: scale(0.95);
}

/* Hızlı Emoji Çubuğu */
.emoji-bar {
  display: flex;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.emoji-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: transform 0.15s;
}

.emoji-btn:hover {
  transform: scale(1.25);
}

/* Alt Kontrol Çubuğu (Dock) */
.dock-controls {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  z-index: 20;
}

.dock-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.dock-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.2s, transform 0.15s;
}

.dock-btn:hover .dock-icon {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.dock-btn.off .dock-icon {
  background: var(--danger);
  color: #fff;
}

.dock-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
}

.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

/* Modal (Dialog) */
dialog.modal {
  border: none;
  background: transparent;
  padding: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100%;
  max-height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 100;
}

dialog.modal[open] {
  display: flex !important;
}

dialog.modal:not([open]) {
  display: none !important;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  text-align: center;
  margin-bottom: 22px;
}

.modal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.modal-logo h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-group input {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--primary);
}

.color-picker-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-swatch:hover {
  transform: scale(1.15);
}

.color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,0.4);
}

.media-preview-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.media-toggle-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.toggle-checkbox input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.btn-primary-large {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 6px;
}

.btn-primary-large:hover {
  background: var(--primary-hover);
}

.btn-primary-large:active {
  transform: scale(0.98);
}

/* Mobil Uyumluluk */
.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .header-center .btn-icon-pill span {
    display: none;
  }

  .username-display {
    display: none;
  }

  .btn-danger-pill span {
    display: none;
  }

  .chat-section {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 80px;
    width: 100%;
    max-width: 100%;
    border-left: none;
    transform: translateY(100%);
    box-shadow: 0 -10px 25px rgba(0,0,0,0.8);
  }

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

  .mobile-only {
    display: flex;
  }

  .dock-controls {
    bottom: 12px;
    padding: 4px 10px;
    gap: 8px;
  }

  .dock-icon {
    width: 38px;
    height: 38px;
  }

  .dock-label {
    display: none;
  }

  .video-card {
    min-height: 130px;
  }
}

/* Aktif Odalar Hızlı Seçim Kutusu (Join Modal) */
.active-rooms-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.active-rooms-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.active-rooms-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.active-room-pill {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.active-room-pill:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}

.active-room-pill.is-active-now {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

/* Odalar Modalı */
.rooms-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.room-list-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s;
}

.room-list-item:hover {
  border-color: var(--primary);
}

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

.room-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.room-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-switch-room {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-switch-room:hover {
  background: var(--primary-hover);
}
