/* ==========================================================================
   WhatsApp Web Hub - SaaS UI Dark Mode
   Inspirado en la interfaz moderna de 4 columnas (Messenger / CRM)
   Alar Sierra
   ========================================================================== */

:root {
  --bg-page: #0a0e14;
  --bg-card-main: #0f1520;
  
  --bg-rail: #0b1018;
  --bg-chats-col: #121926;
  --bg-chat-feed: #0d131d;
  --bg-details-col: #121926;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(59, 130, 246, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #2563eb;
  --accent-blue-hover: #1d4ed8;
  --accent-blue-glow: rgba(37, 99, 235, 0.35);
  
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #ef4444;

  --bubble-incoming: #182230;
  --bubble-incoming-border: rgba(255, 255, 255, 0.06);
  --bubble-outgoing: #2563eb;

  --font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars estilizadas y delgadas */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ==========================================================================
   Contenedor Principal de la App (Flotante y Redondeado como en la imagen)
   ========================================================================== */
.saas-workspace-wrapper {
  width: 100%;
  height: 100%;
  max-width: 1560px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saas-app-card {
  width: 100%;
  height: 100%;
  background: var(--bg-card-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7);
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   COLUMNA 1: Slim Icon Navigation Rail
   ========================================================================== */
.nav-rail {
  width: 68px;
  background-color: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 20px 0;
  flex-shrink: 0;
  z-index: 10;
}

.rail-brand-logo {
  cursor: pointer;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 0 10px rgba(37, 99, 235, 0.5));
}
.rail-brand-logo:hover {
  transform: scale(1.08);
}

.rail-nav-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.rail-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  text-decoration: none;
}
.rail-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}
.rail-btn.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.18);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.3);
}

.rail-pill-indicator {
  position: absolute;
  left: -12px;
  width: 4px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: var(--accent-blue);
}

.rail-badge-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 6px var(--accent-blue);
}

.rail-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.rail-user-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  cursor: pointer;
}
.rail-user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
}
.rail-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 2px solid var(--bg-rail);
  box-shadow: 0 0 6px var(--accent-green);
}

/* ==========================================================================
   COLUMNA 2: Chats Column
   ========================================================================== */
.chats-column {
  width: 320px;
  min-width: 290px;
  background-color: var(--bg-chats-col);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  flex-shrink: 0;
}

/* Botón + New conversation */
.chats-top-btn-wrap {
  margin-bottom: 20px;
}
.btn-new-conversation {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-new-conversation:hover {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
  color: #fff;
}
.btn-new-conversation .plus-icon {
  font-size: 1.1rem;
  color: var(--accent-blue);
  font-weight: 700;
}

/* Título Chats y tres puntos */
.chats-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.chats-main-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.chats-more-options {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}
.chats-more-options:hover {
  color: var(--text-primary);
}

/* Selector de Canales */
.channel-filter-pills {
  display: flex;
  gap: 5px;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.channel-pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}
.channel-pill-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.channel-pill-btn.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(37, 99, 235, 0.5);
  color: #93c5fd;
}
.channel-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* Buscador con lupa a la derecha */
.chats-search-bar {
  position: relative;
  margin-bottom: 14px;
}
.search-field {
  width: 100%;
  background: #182230;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 9px 38px 9px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}
.search-field::placeholder {
  color: var(--text-muted);
}
.search-field:focus {
  border-color: var(--accent-blue);
  background: #1c2738;
}
.search-submit-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-submit-btn:hover {
  color: var(--text-primary);
}

/* Filtros Chips */
.filter-chips-row {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.filter-pill {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-pill.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  font-weight: 600;
}

/* Lista de Chats */
.chats-items-scroll {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-item-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}
.chat-item-card:hover {
  background: rgba(255, 255, 255, 0.04);
}
.chat-item-card.active {
  background: #1a2536;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.chat-item-avatar-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #253346;
}
.chat-item-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #253346;
  display: block;
  overflow: hidden;
  font-size: 0;
  color: transparent;
  line-height: 0;
}
.chat-item-status-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 1.5px solid var(--bg-chats-col);
}

.chat-item-info {
  flex: 1;
  min-width: 0;
}
.chat-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 3px;
}
.chat-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.chat-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.chat-item-snippet {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.chat-item-badge {
  background: var(--accent-blue);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   COLUMNA 3: Active Chat Area (Conversación Central)
   ========================================================================== */
.active-chat-column {
  flex: 1;
  background-color: var(--bg-chat-feed);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.empty-conversation-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
}
.empty-icon-shield {
  width: 74px;
  height: 74px;
  border-radius: 20px;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.empty-conversation-state h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.empty-conversation-state p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.empty-info-tag {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.78rem;
  color: #93c5fd;
}

.active-conversation-flow {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Header Superior de la Conversación */
.chat-top-header {
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13, 19, 29, 0.8);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.chat-top-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-user-avatar-wrap {
  position: relative;
  width: 38px;
  height: 38px;
}
.top-user-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #253346;
  display: block;
  overflow: hidden;
  font-size: 0;
  color: transparent;
  line-height: 0;
}
.top-user-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 2px solid var(--bg-chat-feed);
}
.top-user-meta h3 {
  font-size: 0.95rem;
  font-weight: 700;
}
.top-user-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chat-top-right-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Indicador de Members */
.channel-members-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}
.members-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.member-add-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.member-avatar-mini {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--accent-blue);
}
.member-avatar-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-takeover-pill {
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(37, 99, 235, 0.4);
  color: #93c5fd;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-takeover-pill.manual-mode {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #fcd34d;
}

.tool-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.tool-icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}
.tool-icon-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Banner de Alerta Modo Manual */
.manual-takeover-alert {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  padding: 6px 20px;
  font-size: 0.76rem;
  color: #fcd34d;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.manual-takeover-alert button {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
}

/* Feed de Mensajes Central */
.chat-messages-feed {
  flex: 1;
  overflow-y: auto;
  padding: 24px 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Grupos de mensajes con avatar */
.message-entry-row {
  display: flex;
  gap: 12px;
  max-width: 68%;
  align-items: flex-end;
}
.message-entry-row.incoming {
  align-self: flex-start;
}
.message-entry-row.outgoing {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-bottom: 4px;
  background: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  display: block;
  overflow: hidden;
  font-size: 0;
  color: transparent;
  line-height: 0;
}

.msg-bubble-box {
  display: flex;
  flex-direction: column;
}

/* Burbuja Entrante (Blanca/Gris oscura en modo oscuro) */
.incoming .msg-bubble-card {
  background-color: var(--bubble-incoming);
  border: 1px solid var(--bubble-incoming-border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 16px 16px 16px 4px;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Burbuja Saliente (Azul Real vibrante como en la imagen) */
.outgoing .msg-bubble-card {
  background: var(--bubble-outgoing);
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.msg-time-stamp {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}
.outgoing .msg-time-stamp {
  text-align: right;
  color: rgba(255, 255, 255, 0.7);
}

/* Card especial con grid de imágenes como en el ejemplo de Fernando */
.msg-media-attachment-card {
  background: #151e2b;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 10px;
  margin-top: 6px;
}
.msg-media-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.msg-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.msg-media-thumb {
  width: 100%;
  height: 65px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s;
}
.msg-media-thumb:hover {
  transform: scale(1.04);
}

/* Barra de Atajos */
.chat-quick-shortcuts {
  padding: 4px 24px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.shortcuts-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  align-self: center;
  margin-right: 4px;
}
.shortcut-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}
.shortcut-pill:hover {
  background: rgba(37, 99, 235, 0.15);
  color: #fff;
  border-color: rgba(37, 99, 235, 0.4);
}

/* Barra de Entrada de Mensaje (Estilo exacto de la imagen) */
.chat-composer-footer {
  padding: 14px 24px 20px 24px;
}
.composer-pill-card {
  background: #182230;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 6px 8px 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s;
}
.composer-pill-card:focus-within {
  border-color: var(--accent-blue);
}

.composer-plus-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.composer-plus-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.composer-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  resize: none;
  max-height: 80px;
  outline: none;
  padding: 6px 0;
}
.composer-textarea::placeholder {
  color: var(--text-muted);
}

.composer-emoji-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color 0.15s;
}
.composer-emoji-btn:hover {
  color: var(--text-primary);
}

.composer-send-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-blue);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px var(--accent-blue-glow);
}
.composer-send-btn:hover {
  background: var(--accent-blue-hover);
  transform: scale(1.05);
}
.composer-send-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   COLUMNA 4: Right Info Sidebar (Detalles del Contacto / CRM)
   ========================================================================== */
.contact-details-sidebar {
  width: 290px;
  background-color: var(--bg-details-col);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.details-inner-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Tarjeta de Perfil Superior */
.contact-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.contact-card-avatar-wrap {
  position: relative;
  width: 68px;
  height: 68px;
  margin-bottom: 12px;
}
.contact-card-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #253346;
  border: 2px solid rgba(255, 255, 255, 0.1);
  display: block;
  overflow: hidden;
  font-size: 0;
  color: transparent;
  line-height: 0;
}
.contact-card-status-dot {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 2px solid var(--bg-details-col);
}
.contact-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.contact-card-role {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Acordeones */
.details-accordion-item {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}
.accordion-header-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 6px 0;
}
.accordion-header-btn svg {
  color: var(--text-muted);
  transition: transform 0.2s;
}
.details-accordion-item.open .accordion-header-btn svg {
  transform: rotate(180deg);
}

.accordion-body-content {
  display: none;
  padding-top: 8px;
}
.details-accordion-item.open .accordion-body-content {
  display: block;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  padding: 4px 0;
}
.info-lbl {
  color: var(--text-muted);
}
.info-val {
  color: var(--text-primary);
  font-weight: 500;
}
.info-val.active-status {
  color: var(--accent-green);
  font-weight: 600;
}

/* Media Thumbnails Grid */
.media-thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.thumb-img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s;
}
.thumb-img:hover {
  transform: scale(1.05);
}

/* Archivos Descargables */
.files-download-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}
.file-item:hover {
  background: rgba(255, 255, 255, 0.07);
}
.file-icon-square {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.file-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.file-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.pinned-tag-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pinned-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: #93c5fd;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 8px;
}

/* ==========================================================================
   MODALES (Settings y Nuevo Chat)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: #141c28;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
  animation: modalPop 0.2s ease-out;
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.callout-dark-info {
  background: rgba(37, 99, 235, 0.1);
  border-left: 3px solid var(--accent-blue);
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #bfdbfe;
}

.modal-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}
.modal-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.modal-tab-btn.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-control {
  background: #0f1520;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}
.form-control:focus {
  border-color: var(--accent-blue);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-primary-blue {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary-blue:hover {
  background: var(--accent-blue-hover);
}

.btn-subtle-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-subtle-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-danger-outline {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Responsividad */
@media (max-width: 1200px) {
  .contact-details-sidebar {
    display: none;
  }
}
@media (max-width: 900px) {
  body {
    padding: 0;
  }
  .saas-app-card {
    border-radius: 0;
  }
  .nav-rail {
    display: none;
  }
  .chats-column {
    width: 100%;
  }
  .active-chat-column {
    display: none;
  }
  .active-chat-column.mobile-open {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
  }
}
