/* 
 * vistas/dist/css/consola-chat.css
 * Consola de Chat MMO - Estilo iOS Glass Premium
 */

/* ==========================================
   CONSOLA FLOTANTE - iOS GLASS STYLE
   ========================================== */

.chat-console {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 350px; /* Ancho fijo elegante */
  max-width: 90vw; /* Responsive basic */
  height: 500px;
  max-height: 80vh;
  /* iOS Glass Effect */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  pointer-events: auto; /* Clickable when visible */
}

.chat-console.hidden {
  transform: translateX(450px);
  opacity: 0;
  pointer-events: none; /* No clickable when hidden */
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .chat-console {
    background: rgba(30, 30, 35, 0.78);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow:
      0 8px 32px rgba(0, 0, 0, 0.4),
      0 2px 8px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
}

.chat-console.hidden {
  transform: translateX(450px);
  opacity: 0;
}

/* Header - iOS Style */
.chat-console-header {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.8) 0%,
    rgba(255, 255, 255, 0.4) 100%
  );
  padding: 14px 16px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
}

@media (prefers-color-scheme: dark) {
  .chat-console-header {
    background: linear-gradient(
      180deg,
      rgba(50, 50, 55, 0.8) 0%,
      rgba(40, 40, 45, 0.4) 100%
    );
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
}

.chat-console-title {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.85);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.3px;
}

@media (prefers-color-scheme: dark) {
  .chat-console-title {
    color: rgba(255, 255, 255, 0.95);
  }
}

.chat-console-title i {
  color: #007aff;
  font-size: 16px;
}

.chat-console-controls {
  display: flex;
  gap: 6px;
}

.chat-console-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  border: none;
  color: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13px;
}

@media (prefers-color-scheme: dark) {
  .chat-console-btn {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
  }
}

.chat-console-btn:hover {
  background: rgba(0, 0, 0, 0.08);
  transform: scale(1.05);
}

@media (prefers-color-scheme: dark) {
  .chat-console-btn:hover {
    background: rgba(255, 255, 255, 0.12);
  }
}

.chat-console-btn:active {
  transform: scale(0.95);
}

.chat-console-btn.close:hover {
  background: rgba(255, 59, 48, 0.15);
  color: #ff3b30;
}

/* Badges de Canal - Colores RPG */
.chat-tab-badge.badge-global {
  background: #6b7280;
  box-shadow: 0 2px 4px rgba(107, 114, 128, 0.4);
}
.chat-tab-badge.badge-clan {
  background: #f59e0b;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.4);
}
.chat-tab-badge.badge-privado {
  background: #a855f7;
  box-shadow: 0 2px 4px rgba(168, 85, 247, 0.4);
}
.chat-tab-badge.badge-mision {
  background: #ef4444;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

/* Tabs - iOS Style */
.chat-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.02);
  padding: 6px 8px;
  gap: 4px;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  .chat-tabs {
    background: rgba(255, 255, 255, 0.03);
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
}

.chat-tab {
  padding: 7px 14px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: rgba(0, 0, 0, 0.6);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  letter-spacing: -0.2px;
}

@media (prefers-color-scheme: dark) {
  .chat-tab {
    color: rgba(255, 255, 255, 0.6);
  }
}

.chat-tab:hover {
  background: rgba(0, 0, 0, 0.04);
  color: rgba(0, 0, 0, 0.85);
}

@media (prefers-color-scheme: dark) {
  .chat-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
  }
}

.chat-tab.active {
  background: rgba(0, 122, 255, 0.12);
  color: #007aff;
}

@media (prefers-color-scheme: dark) {
  .chat-tab.active {
    background: rgba(10, 132, 255, 0.18);
    color: #0a84ff;
  }
}

.chat-tab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ff3b30;
  color: #fff;
  border-radius: 10px;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 600;
  min-width: 16px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(255, 59, 48, 0.3);
}

/* Mensajes - iOS Style */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(0, 0, 0, 0.01);
}

@media (prefers-color-scheme: dark) {
  .chat-messages {
    background: rgba(0, 0, 0, 0.1);
  }
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
}

@media (prefers-color-scheme: dark) {
  .chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
  }
}

.chat-message {
  display: flex;
  gap: 10px;
  animation: messageSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007aff, #5856d6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

.chat-message-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.chat-message-content {
  flex: 1;
  min-width: 0;
}

.chat-message-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.chat-message-author {
  font-weight: 600;
  color: #007aff;
  font-size: 13px;
  letter-spacing: -0.2px;
}

@media (prefers-color-scheme: dark) {
  .chat-message-author {
    color: #0a84ff;
  }
}

.chat-message-author.admin {
  color: #ff9500;
}

.chat-message-author.gm {
  color: #ff3b30;
  font-weight: 700;
}

.chat-message-time {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.4);
  font-weight: 400;
}

@media (prefers-color-scheme: dark) {
  .chat-message-time {
    color: rgba(255, 255, 255, 0.4);
  }
}

.chat-message-text {
  color: rgba(0, 0, 0, 0.85);
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  letter-spacing: -0.2px;
}

@media (prefers-color-scheme: dark) {
  .chat-message-text {
    color: rgba(255, 255, 255, 0.9);
  }
}

.chat-message-system {
  background: rgba(255, 149, 0, 0.12);
  border: 0.5px solid rgba(255, 149, 0, 0.2);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
  color: #ff9500;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.2px;
}

.chat-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  .chat-empty-state {
    color: rgba(255, 255, 255, 0.4);
  }
}

.chat-empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.chat-empty-state p {
  font-size: 14px;
  margin: 0;
}

/* Input - iOS Style */
.chat-input-container {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  border-top: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 0 0 20px 20px;
}

@media (prefers-color-scheme: dark) {
  .chat-input-container {
    background: rgba(30, 30, 35, 0.6);
    border-top-color: rgba(255, 255, 255, 0.08);
  }
}

.chat-input-wrapper {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.04);
  border: none;
  border-radius: 18px;
  padding: 10px 14px;
  color: rgba(0, 0, 0, 0.85);
  font-size: 14px;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: -0.2px;
}

@media (prefers-color-scheme: dark) {
  .chat-input {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
  }
}

.chat-input:focus {
  background: rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  .chat-input:focus {
    background: rgba(255, 255, 255, 0.12);
  }
}

.chat-input::placeholder {
  color: rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  .chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
  }
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #007aff;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

@media (prefers-color-scheme: dark) {
  .chat-send-btn {
    background: #0a84ff;
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.3);
  }
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
  .chat-console {
    width: calc(100% - 40px);
    right: 20px;
    left: 20px;
    bottom: 70px;
  }
}

/* Sidebar Usuarios - Estilo Gaming Premium (Discord/MMO) */
.chat-sidebar {
  width: 0;
  background: rgba(var(--mvp-bg-rgb), 0.4);
  backdrop-filter: blur(15px);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  opacity: 0;
}

@media (prefers-color-scheme: dark) {
  .chat-sidebar {
    background: rgba(15, 15, 20, 0.6);
  }
}

.chat-sidebar.open {
  width: 160px;
  opacity: 1;
}

.sidebar-users-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-users-list::-webkit-scrollbar {
  width: 3px;
}

.sidebar-users-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: transparent;
  border: 1px solid transparent;
}

.user-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(2px);
}

@media (prefers-color-scheme: dark) {
  .user-item:hover {
    background: rgba(255, 255, 255, 0.03);
  }
}

.user-avatar-container {
  position: relative;
  flex-shrink: 0;
}

.user-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  object-fit: cover;
  transition: all 0.3s ease;
}

.user-item:hover .user-avatar-sm {
  border-color: #007aff;
  box-shadow: 0 0 10px rgba(0, 122, 255, 0.3);
}

.user-name-sm {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(var(--app-text-rgb), 0.85);
  letter-spacing: -0.2px;
}

.status-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid rgba(var(--mvp-bg-rgb), 1);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* Sidebar Title/Header */
.sidebar-header {
  padding: 12px 14px 4px 14px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #007aff;
  letter-spacing: 1px;
  opacity: 0.8;
}

/* Mobile Chat Overlay */
@media (max-width: 768px) {
  .chat-sidebar.open {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: rgba(var(--mvp-bg-rgb), 0.98);
    backdrop-filter: blur(25px);
    width: 200px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
  }
}

/* Context Menu - iOS Style */
.chat-context-menu {
  position: fixed;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 0.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 200px;
  z-index: 10000;
  display: none;
  flex-direction: column; /* Stack items vertically */
  overflow: hidden;
  padding: 6px;
}

@media (prefers-color-scheme: dark) {
  .chat-context-menu {
    background: rgba(40, 40, 45, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
  }
}

.context-menu-item {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(0, 0, 0, 0.8);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

@media (prefers-color-scheme: dark) {
  .context-menu-item {
    color: rgba(255, 255, 255, 0.9);
  }
}

.context-menu-item:hover {
  background: rgba(0, 122, 255, 0.1);
  color: #007aff;
}

.context-menu-item i {
  font-size: 14px;
  opacity: 0.7;
}

.context-menu-item:hover i {
  opacity: 1;
}
