/* ──────────────── Buttons (Duolingo-style depth) ──────────────── */
.btn-bl {
  border: none;
  border-radius: var(--radius);
  padding: 12px 22px;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.05s ease, filter 0.15s ease;
  position: relative;
  box-shadow: 0 var(--btn-depth) 0 0 rgba(0,0,0,0.18);
  cursor: pointer;
}
.btn-bl:hover { filter: brightness(1.05); text-decoration: none; color: white; }
.btn-bl:active {
  transform: translateY(var(--btn-depth));
  box-shadow: 0 0 0 0 rgba(0,0,0,0.18);
}
.btn-bl:disabled { opacity: 0.55; cursor: not-allowed; filter: none; transform: none; }

.btn-green { background: var(--green); box-shadow: 0 var(--btn-depth) 0 0 var(--green-dark); }
.btn-blue { background: var(--blue); box-shadow: 0 var(--btn-depth) 0 0 var(--blue-dark); }
.btn-orange { background: var(--orange); box-shadow: 0 var(--btn-depth) 0 0 #CC7700; }
.btn-red { background: var(--red); box-shadow: 0 var(--btn-depth) 0 0 #CC3B3B; }
.btn-purple { background: var(--purple); box-shadow: 0 var(--btn-depth) 0 0 #A861D6; }

.btn-outline {
  background: white;
  color: var(--text);
  border: 2px solid var(--border-strong);
  box-shadow: 0 var(--btn-depth) 0 0 var(--border-strong);
}
.btn-outline:hover { background: var(--bg-soft); color: var(--text); }

.btn-sm { padding: 8px 14px; font-size: 0.8rem; --btn-depth: 3px; }
.btn-lg { padding: 16px 28px; font-size: 1.05rem; --btn-depth: 5px; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  box-shadow: none;
  border: none;
  padding: 8px 14px;
  font-weight: 700;
}
.btn-ghost:hover { background: var(--bg-soft); }

/* ──────────────── Forms ──────────────── */
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--blue);
}
.field textarea { min-height: 100px; resize: vertical; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

/* ──────────────── Cards ──────────────── */
.card-bl {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.card-bl .card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-weight: 800;
  font-size: 1.15rem;
}
.card-bl .card-title i { color: var(--green); }

/* ──────────────── Partner / user list ──────────────── */
.partner-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.partner-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.partner-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.partner-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: white;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.avatar-sm { width: 36px; height: 36px; font-size: 1rem; }
.avatar-lg { width: 80px; height: 80px; font-size: 2rem; }

.partner-info { flex: 1; min-width: 0; }
.partner-name {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
.partner-meta { font-size: 0.85rem; color: var(--text-soft); }

.online-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}
.online-dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(88,204,2,0.2); }

.lang-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #E8F8D6;
  color: var(--green-dark);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.lang-pill.learn { background: #D6F2FB; color: var(--blue-dark); }

/* ──────────────── Toasts ──────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast-bl {
  background: white;
  border-radius: var(--radius);
  padding: 14px 20px;
  border-left: 5px solid var(--green);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  animation: slideIn 0.25s ease;
  pointer-events: auto;
}
.toast-bl.error { border-left-color: var(--red); }
.toast-bl.warn { border-left-color: var(--orange); }
.toast-bl.info { border-left-color: var(--blue); }
.toast-bl i { font-size: 1.2rem; }
.toast-bl.success i { color: var(--green); }
.toast-bl.error i { color: var(--red); }
.toast-bl.warn i { color: var(--orange); }
.toast-bl.info i { color: var(--blue); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ──────────────── Modal ──────────────── */
.modal-backdrop-bl {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-bl {
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-bl h3 { margin-bottom: 8px; }
.modal-bl .modal-body { margin-bottom: 20px; color: var(--text-soft); }
.modal-bl .modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ──────────────── Room / video page ──────────────── */
.room-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  height: calc(100vh - 80px);
}
@media (max-width: 900px) {
  .room-layout { grid-template-columns: 1fr; height: auto; }
}

.video-area {
  background: #1a1a1a;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr;
  padding: 16px;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: 100%;
}
@media (max-width: 700px) { .video-grid { grid-template-columns: 1fr; } }
.video-grid.solo { grid-template-columns: 1fr; }

.video-tile {
  background: #000;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
/* object-fit:contain → la cámara se muestra completa sin recortes (sin
   efecto "zoom" en móviles donde la cámara suele ser 4:3 y el tile es 16:9).
   El espacio sobrante queda cubierto por el fondo negro del tile. */
.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
/* En móvil, el tile sigue la relación natural de la cámara para evitar
   bandas negras innecesarias arriba/abajo. */
@media (max-width: 640px) {
  .video-tile { aspect-ratio: auto; min-height: 220px; }
}
.video-tile .tile-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.video-tile .tile-muted-icon {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255,75,75,0.9);
  color: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-tile.no-video {
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-tile .placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.6);
}

.room-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.ctrl-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: background 0.15s ease;
}
.ctrl-btn:hover { background: rgba(255,255,255,0.22); }
.ctrl-btn.off { background: var(--red); }
.ctrl-btn.leave { background: var(--red); width: auto; padding: 0 22px; border-radius: var(--radius); font-weight: 800; gap: 8px; }

.sidebar-panel {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
}
.sidebar-tab {
  flex: 1;
  padding: 14px;
  border: none;
  background: transparent;
  font-weight: 800;
  color: var(--text-soft);
  font-size: 0.9rem;
}
.sidebar-tab.active { color: var(--green); border-bottom: 3px solid var(--green); margin-bottom: -2px; }

.sidebar-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  display: flex;
  gap: 10px;
}
.chat-msg-bubble {
  background: var(--bg-soft);
  padding: 10px 14px;
  border-radius: var(--radius);
  max-width: 80%;
}
.chat-msg-bubble .sender {
  font-weight: 800;
  font-size: 0.8rem;
  margin-bottom: 2px;
}
.chat-msg.own { justify-content: flex-end; }
.chat-msg.own .chat-msg-bubble { background: #E8F8D6; }

.chat-input-bar {
  padding: 12px;
  border-top: 2px solid var(--border);
  display: flex;
  gap: 8px;
}
.chat-input-bar input {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: inherit;
  font-weight: 600;
}
.chat-input-bar input:focus { outline: none; border-color: var(--blue); }

.room-info-panel {
  padding: 20px;
  border-bottom: 2px solid var(--border);
}
.room-code-display {
  background: var(--bg-soft);
  padding: 14px;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 4px;
  color: var(--green);
  margin: 12px 0;
}

/* ──────────────── Tables (admin) ──────────────── */
.table-bl {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--border);
}
.table-bl th {
  background: var(--bg-soft);
  text-align: left;
  padding: 12px 16px;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-soft);
  border-bottom: 2px solid var(--border);
}
.table-bl td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.table-bl tr:last-child td { border-bottom: none; }
.table-bl tr:hover { background: var(--bg-soft); }

.badge-bl {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}
.badge-bl.green { background: #E8F8D6; color: var(--green-dark); }
.badge-bl.red { background: #FFE0E0; color: #B22323; }
.badge-bl.orange { background: #FFE9CC; color: #B36A00; }
.badge-bl.blue { background: #D6F2FB; color: var(--blue-dark); }
.badge-bl.gray { background: var(--bg-muted); color: var(--text-soft); }

.tabs-bl {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.tab-bl {
  padding: 12px 20px;
  border: none;
  background: transparent;
  font-weight: 800;
  color: var(--text-soft);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.95rem;
}
.tab-bl.active { color: var(--green); border-bottom-color: var(--green); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-soft);
}
.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.empty-state h3 { margin-bottom: 6px; }

/* ──────────────── Room view (room.js) ──────────────── */
.room-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
}
@media (max-width: 960px) {
  .room-grid { grid-template-columns: 1fr; }
}

.videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  background: #1a1a1a;
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 360px;
}
/* Tiles dentro de .videos (vistas legacy: in_meeting_room.ejs, etc.) — mismo
   criterio que .video-tile / .tile para no recortar la cámara en móvil. */
.videos > video,
.videos .video-wrap > video,
.videos .video-slot > video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
@media (max-width: 640px) {
  .videos { grid-template-columns: 1fr; padding: 10px; gap: 10px; min-height: 0; }
}

.media-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.ctrl-btn.danger { background: var(--red); }
.ctrl-btn.danger:hover { background: #e63b3b; }

.chat-area .chat-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 500px;
  margin-bottom: 0;
}

.chat-card .chat-messages {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 320px;
  max-height: 500px;
}

.chat-msg {
  display: flex;
  width: 100%;
}
.chat-msg.me { justify-content: flex-end; }
.chat-msg.other { justify-content: flex-start; }
.chat-bubble {
  background: white;
  border: 2px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius);
  max-width: 80%;
}
.chat-msg.me .chat-bubble {
  background: #E8F8D6;
  border-color: var(--green-light);
}
.chat-author {
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--green-dark);
  margin-bottom: 2px;
}
.chat-text {
  font-weight: 600;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.chat-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}
.chat-system {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px;
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.chat-form input {
  flex: 1;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
}
.chat-form input:focus { outline: none; border-color: var(--blue); }

/* ──────────────── Admin tabs ──────────────── */
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.admin-tabs .tab-btn {
  padding: 12px 20px;
  border: none;
  background: transparent;
  font-weight: 800;
  color: var(--text-soft);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.admin-tabs .tab-btn:hover { color: var(--text); }
.admin-tabs .tab-btn.active { color: var(--green); border-bottom-color: var(--green); }

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

.badge-bl.purple { background: #F1E1FF; color: #7B3FBF; }

/* ──────────────── Language bar (in-call translator) ──────────────── */
.lang-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #F0FBE3 0%, #E8F8D6 100%);
  border-bottom: 2px solid var(--border);
}
.lang-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.lang-bar-group label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  gap: 5px;
}
.lang-bar-group select {
  width: 100%;
  border: 2px solid var(--green-light, #B5E48C);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  background: white;
  color: var(--text);
  cursor: pointer;
}
.lang-bar-group select:focus {
  outline: none;
  border-color: var(--green);
}
.lang-arrow {
  color: var(--green-dark);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

/* ──────────────── Chat message with translation ──────────────── */
.chat-msg-bubble .msg-translated {
  font-weight: 600;
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.35;
}
.chat-msg-bubble .msg-original {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(0,0,0,0.12);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-soft);
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.3;
}
.chat-msg-bubble .lang-tag {
  display: inline-block;
  background: var(--blue);
  color: white;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
  vertical-align: middle;
  font-style: normal;
}
