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

.body11 {
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f2f5;

  justify-content: center;
  align-items: center;
  height: 100vh;
}

/* index.php */

.btnMessengerStart {
  display: flex;
  position: fixed;
  right: 30px;
  bottom: 18px;
  float: left;
  width: 54px;
  height: 54px;
  transition: all 2s ease;  
  animation: wiggle 2s linear infinite;
  z-index: 19;
  cursor: pointer;
}

.btnMessengerStart:hover {
  transform: scale(1.1) !important;
}

.btnMessengerStart img {
  width: 100%;
}

/* Keyframes */
@keyframes wiggle {
  0%,
  7% {
    transform: rotateZ(0);
  }

  15% {
    transform: rotateZ(-15deg);
  }

  20% {
    transform: rotateZ(10deg);
  }

  25% {
    transform: rotateZ(-10deg);
  }

  30% {
    transform: rotateZ(6deg);
  }

  35% {
    transform: rotateZ(-4deg);
  }

  40%,
  100% {
    transform: rotateZ(0);
  }
}

.messengerStartContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: fixed;
  right: 20px;
  bottom: 20px;
  float: left;
  width: 100px;
  height: auto;
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, .2);
  border-radius: 15px;
  padding: 20px;
  box-sizing: border-box;
  z-index: 1000;
  visibility: hidden;
}

.btnMessengerStartClose {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 10px;
  left: 10px;
  float: left;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background-color: #007aff;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.messengerClose:hover {
  color: rgb(244, 9, 9);
}


.messengerWrapper {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 400px;
  height: auto;
  -webkit-border-radius: 12px; 
  -moz-border-radius: 12px;
  border-radius: 12px;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  z-index: 1000;  
}


.typeCommunication {
  position: relative;
  float: left;
  width: 40px;
  margin-top: 5px;
}

.typeCommunicationFirst {
  margin-top: 20px;
}

.typeCommunication img {
  width: 100%;
  height: auto;
  cursor: pointer;
}

.typeCommunication img:hover {
  animation: wiggle 2s linear infinite;
}

.contenedor {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  max-width: 400px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  padding: 0;
  overflow: hidden;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  animation: aparecer 0.3s ease-out;
}

/* Encabezado del modal */
.contenedor .modal-header {
  background: var(--primary-color);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.contenedor .modal-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.contenedor .close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.contenedor .close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Cuerpo del modal */
.contenedor .modal-body {
  padding: 20px;
  line-height: 1.5;
  color: #333;
}

/* Pie del modal */
.contenedor .modal-footer {
  padding: 15px 20px;
  background: #f5f7fa;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.contenedor .btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.contenedor .btn-primary {
  background: #3a5ecf;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
}

.contenedor .btn-primary:hover {
  background: #29d496;
}

.contenedor .btn-secondary {
  background: rgba(127, 179, 192, 1);
  color: #fff;
  font-size: 16px;
  font-weight: 450;
}

.contenedor .btn-secondary:hover {
  background: #29d496;
}

/* Fondo oscuro detrás del modal */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  animation: fadeIn 0.3s ease-out;
}

.checkbox-container {
  margin: 15px 0;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.checkbox-container:hover {
  background: #f0f0f0;
}

.checkbox-container label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.checkbox-container input {
  width: 30px;
  height: 30px;
  margin-right: 10px;
  transform: scale(1.2);
}

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

.error-message {
  color: #d32f2f;
  font-size: 1rem;
  margin-top: 8px;
  min-height: 20px;
  text-align: center;
}

/* Animaciones */
@keyframes aparecer {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Messenger */
.messengerContainer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 400px;
  height: auto;
  background-color: var(--tertiary-color);
  z-index: 1000;
}

/* /Messenger */
/* /index.php */

/* user.php */
.chat-container {
  display: flex;  
  width: 400px;
  height: 600px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  background: #2d7d46;
  color: white;
  padding: 15px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
}

.message.bot {
  background: #e8f5e9;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.manager {
  background: #fff3e0;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.system {
  background: #fce4ec;
  align-self: center;
  color: #c62828;
  font-style: italic;
  max-width: 90%;
}



@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#chat-send {
  width: 35px;
  background: #2d7d46;
  color: white;
  border: none;
  border-radius: 50%;
  padding: 5px;
  cursor: pointer;
}

#chat-send img {
  width: 100%;
}

#chat-send:hover {
  background: #1f5f33;
}

#chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#attach-btn {
  background: none;
  border: none;
  font-size: 25px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

#attach-btn:hover {
  background: #eee;
}

.status-bar {
  padding: 8px 15px;
  background: #fff3cd;
  color: #856404;
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid #ffe8a1;
  display: none;
}

.link-preview {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  margin-top: 6px;
  background: #fafafa;
  max-width: 300px;
}

.link-preview img {
  max-width: 100%;
  border-radius: 6px;
}

.link-title {
  font-weight: bold;
  margin: 4px 0;
}

.link-desc {
  font-size: 13px;
  color: #555;
}

.link-site {
  font-size: 12px;
  color: #888;
}

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

#progress-text {
  font-size: 13px;
  color: #555;
  min-width: 120px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  overflow: hidden;
}

#progress-bar {
  width: 0%;
  height: 6px; /*100%;*/
  background: #2d7d46;
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Manager.php */
.login-box {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  width: 320px;
}

.login-box h2 {
  text-align: center;
  margin-bottom: 20px;
}

.login-box input {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

.login-box button {
  width: 100%;
  padding: 10px;
  background: #2d7d46;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.login-box .error {
  color: red;
  margin-top: 10px;
  text-align: center;
}

.manager-panel {
  display: flex;

  overflow: hidden;
  height: 100vh;
}

#panel {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 300px;
  background: white;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 15px;
  background: #2d7d46;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

#chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.chat-item {
  padding: 12px;
  margin-bottom: 8px;
  background: #f5f7fa;
  border-radius: 8px;
  cursor: pointer;
  border-left: 4px solid transparent;
}

.chat-item:hover {
  background: #e9ecf2;
}

.chat-item.active {
  background: #d4e3fd;
  border-left-color: #2d7d46;
}

.chat-item .visitor {
  font-weight: bold;
}

.chat-item .status {
  font-size: 12px;
  color: #888;
}

.chat-item .last-msg {
  font-size: 13px;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item .unread-badge {
  background: #d32f2f;
  color: white;
  border-radius: 50%;
  padding: 2px 8px;
  font-size: 12px;
  margin-left: 8px;
}

.chat-item .assigned {
  font-size: 11px;
  color: #2d7d46;
}

.chat-item .unread-badge {
  background: #d32f2f;
  color: white;
  border-radius: 50%;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: bold;
  margin-left: 8px;
  display: inline-block;
  min-width: 20px;
  text-align: center;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* важно! */
  height: 100%;
  background: #f9fafc;
}

#tabs {
  display: flex;
  flex-shrink: 0;
  /* не сжимается */
  background: white;
  border-bottom: 1px solid #ddd;
  padding: 0 15px;
}

.tab-btn {
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  border-bottom-color: #2d7d46;
  font-weight: bold;
}

.tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

.chat-area-header {
  padding: 15px;
  background: white;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-area-header button {
  background: #d32f2f;
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
}

#chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;   /* важно! */
  background: #f9fafc;
}

.message {
  padding: 10px 14px;
  border-radius: 18px;
  max-width: 80%;
  word-break: break-word;
  line-height: 1.4;
  animation: fadeIn 0.3s;
}

.message.user {
  background: #e1f5fe;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.bot {
  background: #e8f5e9;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.manager {
  background: #fff3e0;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.system {
  background: #fce4ec;
  align-self: center;
  color: #c62828;
  font-style: italic;
  max-width: 90%;
}

.message .time {
  font-size: 10px;
  color: #999;
  margin-top: 4px;
  display: block;
}

.message img {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 4px;
}

.empty-chat {
  color: #888;
  font-style: italic;
  text-align: center;
  margin-top: 40px;
}

.chat-input-area {
  display: flex;
  position: relative;
  flex-shrink: 0;
  /* не сжимается */
  padding: 10px 15px;
  background: white;
  border-top: 1px solid #ddd;
  align-items: center;
  gap: 8px;
}

#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 24px;
  outline: none;
  font-size: 14px;
}

#chat-input:focus {
  border-color: #2d7d46;
}

#upload-progress {
  display: none;
  padding: 8px 15px;
  background: #f9f9f9;
  border-top: 1px solid #e0e0e0;
}

#upload-progress #progress-bar {
  width: 0%;
  height: 6px;
  background: #2d7d46;
  border-radius: 3px;
  transition: width 0.3s;
}

.managers-section {
  padding: 15px;
  background: white;
  overflow-y: auto;
  flex: 1;
}

#managers-list table {
  width: 100%;
  border-collapse: collapse;
}

#managers-list th,
#managers-list td {
  padding: 8px;
  border-bottom: 1px solid #ddd;
  text-align: left;
}

.manager-form {
  margin-top: 20px;
  background: #f5f7fa;
  padding: 15px;
  border-radius: 8px;
}

.manager-form input {
  padding: 8px;
  margin: 4px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.manager-form button {
  padding: 8px 16px;
  background: #2d7d46;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.tab-content {
  display: none;
  flex: 1;
  flex-direction: column;
}

.tab-content.active {
  display: flex;
}

#tab-chats {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

#tab-chats.tab-content.active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

#tab-managers.tab-content.active {
  display: block;
  /* или flex, но для содержимого лучше block */
  overflow-y: auto;
  padding: 15px;
  background: white;
}

#close-chat-btn {
  display: none;
}
/* /Manager.php */

/* Emojis */
#emoji-btn {
  background: none;
  border: none;
  font-size: 25px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

#emoji-btn:hover {
  background: #eee;
}

#emoji-popup {
  display: none;
  position: absolute;
  bottom: 65px;
  left: 10px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 10px;
  max-width: 280px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

#emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#emoji-grid span {
  font-size: 22px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.1s;
}

#emoji-grid span:hover {
  background: #e0e0e0;
}
/* /Emojis */

.btnMessengerClose {
	display: flex;
	align-items: center;
	justify-content: center;
	position: sticky;
	float: right;
	top: 2px;
	right: 2px;
	width: 30px;
	height: 30px;
	border: none;
	border-radius: 50%;
	background-color: #f0f0f0;
	font-size: 30px;
	color: #666;
	transition: background 0.3s;
	cursor: pointer;
	z-index: 1;
}

/* Estilos responsivos */
@media screen and (max-width: 640px) {
  .messengerWrapper {
    right: 15px;
    left: 15px; 
    width: auto;
    max-height: calc(100dvh - 40px);
    max-height: calc(100vh - 40px);
    height: auto;
  }

  #chat-input {
    font-size: 16px !important;
  }

  .chat-container {
    width: 100%;
  }

  .btnMessengerStart {
    right: 0;
  }

  .contenedor {
    width: 95%;
    max-width: none;
  }

  .messengerContainer {
    right: 5px;
    bottom: 5px;
    width: 95%;
  }


}