/* Reset y variables */
#portal_empleado_mensajes {
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
  --primary-color: #29448e;
  --primary-hover: #1e3363;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --light-bg: #f8f9fa;
  --white: #ffffff;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
  --border-radius: 0.5rem;
  --border-radius-lg: 1rem;
  --transition: all 0.3s ease;
}

/* Chat Container */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 300px);
  min-height: 600px;
  max-height: 800px;
  background: var(--white);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  margin: 0;
  max-width: 100%;
  position: relative;
  border-top: 1px solid var(--gray-200);
}

/* Header */
.chat-header {
  background: linear-gradient(142deg, #29448e 0%, rgba(42,51,68,1) 100%);
  color: var(--white);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-icon {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chat-title h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: var(--transition);
}

.status-dot.online {
  background: var(--success-color);
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.status-dot.offline {
  background: var(--danger-color);
}

.status-text {
  font-size: 0.875rem;
  opacity: 0.9;
}

.btn-reconnect {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--white);
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-reconnect:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-reconnect:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Main Content */
.chat-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.chat-sidebar {
  width: 320px;
  background: var(--gray-100);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-container {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  transition: var(--transition);
}

.search-box:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(41, 68, 142, 0.1);
}

.search-box i {
  color: var(--gray-500);
  margin-right: 0.5rem;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  flex: 1;
  font-size: 0.875rem;
}

.search-box input::placeholder {
  color: var(--gray-500);
}

/* Chat List */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--gray-500);
  text-align: center;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.chat-item {
  display: flex;
  align-items: flex-start;
  padding: 1rem;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
  gap: 0.75rem;
}

.chat-item:hover {
  background: var(--white);
  border-left-color: var(--gray-400);
}

.chat-item.active {
  background: var(--white);
  border-left-color: var(--primary-color);
  box-shadow: inset 0 0 0 1px rgba(41, 68, 142, 0.1);
}

.chat-item.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-color);
}

.chat-item.has-unread {
  background: rgba(41, 68, 142, 0.03);
}

.chat-item.has-unread .chat-name {
  font-weight: 700;
  color: var(--gray-900);
}

.chat-item.has-unread .chat-preview {
  font-weight: 500;
  color: var(--gray-700);
}

.chat-avatar {
  position: relative;
  margin-right: 0;
  flex-shrink: 0;
}

.chat-avatar img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.online-indicator {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--white);
  border-radius: 50%;
  transition: var(--transition);
}

.online-indicator.online {
  background: var(--success-color);
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.online-indicator.offline {
  background: var(--gray-400);
}

.user-status {
  font-size: 0.875rem;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.status-online {
  color: var(--success-color);
  font-weight: 500;
}

.status-offline {
  color: var(--gray-500);
}

.unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger-color);
  color: var(--white);
  border-radius: 12px;
  min-width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0 6px;
  border: 2px solid var(--white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

.chat-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.chat-name {
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.chat-preview-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.2rem;
}

.chat-preview {
  font-size: 0.875rem;
  color: var(--gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.chat-centro {
  font-size: 0.875rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-empty {
  font-size: 0.875rem;
  color: var(--gray-400);
  font-style: italic;
}

.chat-time {
  font-size: 0.75rem;
  color: var(--gray-500);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

/* Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--white);
}

.chat-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  background: var(--white);
}

.chat-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  position: relative;
}

.user-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 1rem;
}

.user-centro {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.chat-actions {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray-600);
}

.action-btn:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
  transform: scale(1.05);
}

/* Messages Container */
.messages-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--gray-500);
  padding: 2rem;
}

.welcome-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.welcome-screen h4 {
  margin-bottom: 0.5rem;
  color: var(--gray-700);
}

.messages-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) transparent;
}

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

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

.messages-list::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 3px;
}

.messages-list::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,0.3);
}

.empty-messages {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  color: var(--gray-500);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Messages */
.message {
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.3s ease-out;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.125rem;
}

.message.sent {
  align-items: flex-end;
}

.message.received {
  align-items: flex-start;
}

/* Mensajes del sistema */
.message-system {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1rem 0;
  padding: 0 1rem;
  animation: fadeInUp 0.3s ease-out;
}

.system-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-left: 3px solid #2196f3;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  color: #1565c0;
  max-width: 80%;
  box-shadow: var(--shadow-sm);
}

.system-message i {
  color: #2196f3;
  font-size: 1rem;
  flex-shrink: 0;
}

.system-message.system-call-started {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-left-color: #2196f3;
}

.system-message.system-call-started i {
  color: #2196f3;
}

.system-message.system-call-accepted {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-left-color: #4caf50;
}

.system-message.system-call-accepted i {
  color: #4caf50;
}

.system-message.system-call-rejected,
.system-message.system-call-ended {
  background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
  border-left-color: #f44336;
}

.system-message.system-call-rejected i,
.system-message.system-call-ended i {
  color: #f44336;
}

.system-text {
  flex: 1;
  font-weight: 500;
  line-height: 1.4;
}

.system-time {
  font-size: 0.75rem;
  color: #64b5f6;
  opacity: 0.8;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.message-header {
  margin-bottom: 0.25rem;
  opacity: 0.8;
}

.sender-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sender-info.sent {
  flex-direction: row-reverse;
}

.sender-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.sender-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
}

.message-content {
  max-width: 65%;
  width: fit-content;
  min-width: 60px;
  box-sizing: border-box;
  position: relative;
}

.message-bubble {
  padding: 0.5rem 0.75rem;
  border-radius: 1.25rem;
  position: relative;
  word-wrap: break-word;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
  backdrop-filter: blur(10px);
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  font-size: 0.875rem;
  line-height: 1.25;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}

.message-bubble.sent {
  background: linear-gradient(142deg, #29448e 0%, rgba(42,51,68,1) 100%);
  color: var(--white);
}

.message-bubble.received {
  background: var(--white);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
}


.message-text {
  flex: 1;
  line-height: 1.2;
}

.message-time-hover {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.7;
  font-size: 0.625rem;
  white-space: nowrap;
}

.message-time {
  font-size: 0.625rem;
}

.message-status {
  display: flex;
  align-items: center;
}

.message-status i {
  font-size: 0.625rem;
}

.message-status .seen {
  color: var(--primary-color);
}

.message-status .delivered {
  color: var(--gray-500);
}

.message-status .sent {
  color: var(--gray-400);
}

/* Message Input */
.message-input {
  padding: 1rem 1.5rem;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
}

.input-container {
  display: flex;
  align-items: center;
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-lg);
  padding: 0.5rem;
  transition: var(--transition);
}

.input-container:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(41, 68, 142, 0.1);
}

.input-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray-600);
  margin: 0 0.25rem;
}

.input-btn:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.input-wrapper {
  flex: 1;
  margin: 0 0.5rem 0 0;
}

.input-wrapper input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.875rem;
  padding: 0.5rem 0;
}

.input-wrapper input::placeholder {
  color: var(--gray-500);
}

.send-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--primary-color);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  margin-left: 0.25rem;
}

.send-btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.send-btn:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
  transform: none;
}

.connection-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: var(--border-radius);
  color: #856404;
  font-size: 0.875rem;
}

/* Scrollbar */
.messages-list::-webkit-scrollbar,
.chat-list::-webkit-scrollbar {
  width: 6px;
}

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

.messages-list::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.messages-list::-webkit-scrollbar-thumb:hover,
.chat-list::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.message.sent .message-bubble {
  animation: slideInRight 0.3s ease-out;
}

.message.received .message-bubble {
  animation: slideInLeft 0.3s ease-out;
}

/* Prevent horizontal scroll */
* {
  box-sizing: border-box;
}

.chat-container,
.chat-main,
.messages-container,
.messages-list {
  overflow-x: hidden !important;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: flex-start;
  margin-bottom: 1rem;
  animation: fadeInUp 0.3s ease-out;
  width: 100%;
  justify-content: flex-start;
}

.typing-bubble {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 1.25rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
  width: fit-content;
  min-width: 50px;
  position: relative;
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  background: var(--gray-500);
  border-radius: 50%;
  animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}


@keyframes typingPulse {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .chat-container {
    height: 100vh;
    border-radius: 0;
  }
  
  .chat-sidebar {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--white);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .chat-sidebar.open {
    transform: translateX(0);
  }
  
  .message-content {
    max-width: 85%;
  }
  
  .message-input {
    padding: 1rem;
  }
  
  .input-container {
    padding: 0.375rem;
  }
  
  .input-btn,
  .send-btn {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 576px) {
  .chat-header {
    padding: 0.75rem 1rem;
  }
  
  .header-content {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  
  .header-right {
    align-self: flex-end;
  }
  
  .btn-reconnect {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
  }
  
  .message-content {
    max-width: 90%;
  }
  
  .message-bubble {
    padding: 0.625rem 0.875rem;
  }
  
  .input-container {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .input-wrapper {
    margin: 0;
    order: 1;
  }
  
  .input-btn,
  .send-btn {
    order: 2;
  }
}

/* Nuevo Chat Button */
.new-chat-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.btn-new-chat {
  width: 100%;
  padding: 0.75rem 1rem;
  background: linear-gradient(142deg, #29448e 0%, rgba(42,51,68,1) 100%);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.btn-new-chat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

.btn-new-chat i,
.btn-new-group i {
  margin-right: 0.5rem;
}

.btn-new-group {
  background: linear-gradient(142deg, #29448e 0%, rgba(42,51,68,1) 100%);
  color: var(--white);
  border: none;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.btn-new-group:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-new-group:active {
  transform: translateY(0);
}

.btn-new-chat i {
  font-size: 1rem;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

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

.modal-content {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--gray-800);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-500);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--gray-800);
}

.modal-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.search-employees {
  margin-bottom: 1rem;
}

.search-employees .search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--gray-100);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
}

.search-employees .search-box i {
  color: var(--gray-500);
  margin-right: 0.75rem;
}

.search-employees .search-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: var(--gray-800);
}

.employees-list {
  max-height: 400px;
  overflow-y: auto;
}

.loading-state,
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--gray-500);
}

.loading-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--gray-400);
}

.employee-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.employee-item {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.employee-item:hover {
  background: var(--gray-100);
  border-color: var(--gray-200);
}

.employee-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 1rem;
  flex-shrink: 0;
}

.employee-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-info {
  flex: 1;
  min-width: 0;
}

.employee-name {
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* .employee-email removido - no se muestra email por privacidad */
  font-size: 0.85rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employee-centro {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

.employee-action {
  color: var(--primary-color);
  font-size: 1.25rem;
  padding: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.employee-item:hover .employee-action {
  opacity: 1;
}

/* Estilos para grupos en la lista de chats */
.chat-item.group-chat {
  border-left: 3px solid var(--primary-color);
}

.group-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  border: 2px solid var(--white);
}

.group-icon {
  margin-right: 0.5rem;
  color: var(--primary-color);
  font-size: 0.9rem;
}

.group-badge-header {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  border: 2px solid var(--white);
}

.group-icon-small {
  margin-right: 0.5rem;
  color: var(--primary-color);
  font-size: 0.9rem;
}

.group-info {
  color: var(--gray-600);
  font-size: 0.9rem;
}

/* Estilos para modal de crear grupo */
.modal-group {
  max-width: 600px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--gray-700);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(41, 68, 142, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}

/* Búsqueda de miembros para grupos */
.search-group-members {
  margin-bottom: 1rem;
}

.search-group-members .search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--gray-100);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
}

.search-group-members .search-box:focus-within {
  border-color: var(--primary-color);
  background: var(--white);
}

.search-group-members .search-box i {
  color: var(--gray-500);
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.search-group-members .search-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  color: var(--gray-800);
}

.search-group-members .search-box input::placeholder {
  color: var(--gray-400);
}

.members-selector {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  padding: 0.5rem;
  background: var(--white);
}

.member-checkbox {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
  margin-bottom: 0.25rem;
}

.member-checkbox:last-child {
  margin-bottom: 0;
}

.member-checkbox:hover {
  background: var(--gray-100);
}

.member-checkbox input[type="checkbox"] {
  margin-right: 0.75rem;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.member-checkbox label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  margin: 0;
  font-weight: normal;
  flex: 1;
  min-width: 0;
}

.member-checkbox label img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.member-name {
  font-weight: 500;
  color: var(--gray-800);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-centro {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-300);
}

.btn-cancel {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-700);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}

.btn-cancel:hover {
  background: var(--gray-100);
}

.btn-submit {
  padding: 0.75rem 1.5rem;
  border: none;
  background: linear-gradient(142deg, #29448e 0%, rgba(42,51,68,1) 100%);
  color: var(--white);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Estilos para gestión de grupos */
.modal-group-management {
  max-width: 700px;
}

.group-info-section {
  margin-bottom: 2rem;
}

.group-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--gray-100);
  border-radius: var(--border-radius);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-700);
}

.meta-item i {
  color: var(--primary-color);
}

.group-members-section {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--gray-800);
}

.btn-add-member {
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-add-member:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.members-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  padding: 0.5rem;
  background: var(--white);
}

.member-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
  margin-bottom: 0.5rem;
}

.member-item:last-child {
  margin-bottom: 0;
}

.member-item:hover {
  background: var(--gray-100);
}

.member-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.member-details {
  flex: 1;
  min-width: 0;
}

.member-name {
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 0.25rem;
}

.member-role {
  font-size: 0.75rem;
}

.badge-admin {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--primary-color);
  color: var(--white);
  border-radius: 12px;
  font-weight: 500;
}

.badge-member {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background: var(--gray-300);
  color: var(--gray-700);
  border-radius: 12px;
}

.btn-remove-member {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--danger-color);
  color: var(--white);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-remove-member:hover {
  background: #c82333;
  transform: scale(1.1);
}

.group-sync-section {
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--gray-100);
  border-radius: var(--border-radius);
  text-align: center;
}

.btn-sync {
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.btn-sync:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-sync:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-save {
  padding: 0.75rem 1.5rem;
  border: none;
  background: var(--primary-color);
  color: var(--white);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-save:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-danger {
  padding: 0.75rem 1.5rem;
  border: none;
  background: var(--danger-color);
  color: var(--white);
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-danger:hover:not(:disabled) {
  background: #c82333;
  transform: translateY(-1px);
}

.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(41, 68, 142, 0.1);
}

.form-control:disabled {
  background: var(--gray-100);
  cursor: not-allowed;
}

/* SweetAlert2 z-index para que aparezca por encima de los modals */
.swal2-container {
  z-index: 20000 !important;
}

.swal2-popup {
  z-index: 20001 !important;
}

/* Estilos para llamadas de voz */
.call-btn {
  color: var(--success-color) !important;
}

.call-btn.calling {
  animation: pulse-call 1.5s ease-in-out infinite;
  color: var(--warning-color) !important;
}

.call-btn.ringing {
  animation: pulse-call 1s ease-in-out infinite;
  color: var(--danger-color) !important;
}

.call-btn.in-call {
  color: var(--success-color) !important;
}

@keyframes pulse-call {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

/* Modal de llamada */
.call-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.call-modal.active {
  opacity: 1;
  visibility: visible;
}

.call-content {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: slideInCall 0.3s ease-out;
}

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

.call-header {
  margin-bottom: 2rem;
}

.call-user-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.call-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.call-status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.call-user-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-900);
}

.call-status-text {
  font-size: 1rem;
  color: var(--gray-600);
}

.call-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.call-btn-accept,
.call-btn-reject,
.call-btn-end {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.call-btn-accept {
  background: var(--success-color);
  color: var(--white);
}

.call-btn-accept:hover {
  background: #218838;
  transform: scale(1.1);
}

.call-btn-reject,
.call-btn-end {
  background: var(--danger-color);
  color: var(--white);
}

.call-btn-reject:hover,
.call-btn-end:hover {
  background: #c82333;
  transform: scale(1.1);
}

.call-audio-indicator {
  margin-top: 1.5rem;
}

.audio-waves {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  height: 40px;
}

.audio-waves span {
  width: 4px;
  background: var(--primary-color);
  border-radius: 2px;
  animation: audio-wave 1.2s ease-in-out infinite;
}

.audio-waves span:nth-child(1) {
  animation-delay: 0s;
  height: 20px;
}

.audio-waves span:nth-child(2) {
  animation-delay: 0.2s;
  height: 30px;
}

.audio-waves span:nth-child(3) {
  animation-delay: 0.4s;
  height: 40px;
}

.audio-waves span:nth-child(4) {
  animation-delay: 0.6s;
  height: 30px;
}

@keyframes audio-wave {
  0%, 100% {
    transform: scaleY(0.5);
    opacity: 0.7;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

