/* ═════════════════════════════════════════════════
   CLIENT SUPPORT MESSENGER REDESIGN (Glassmorphism)
   ═════════════════════════════════════════════════ */

.messenger-wrapper {
  display: flex;
  height: 80vh;
  /* Set a fixed height for the messenger layout */
  min-height: 600px;
}

.messenger-card {
  background: rgba(20, 10, 40, 0.6) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(205, 54, 231, 0.2) !important;
  border-radius: 20px !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
}

.messenger-card .card-header {
  background: rgba(0, 0, 0, 0.2) !important;
  border-bottom: 1px solid rgba(205, 54, 231, 0.1) !important;
  padding: 15px 20px !important;
}

.messenger-card .card-body {
  overflow-y: auto;
  position: relative;
  flex: 1;
}

/* Custom Scrollbar for Chat & List */
.messenger-card .card-body::-webkit-scrollbar {
  width: 6px;
}

.messenger-card .card-body::-webkit-scrollbar-track {
  background: transparent;
}

.messenger-card .card-body::-webkit-scrollbar-thumb {
  background: rgba(205, 54, 231, 0.3);
  border-radius: 10px;
}

/* Sidebar List */
.ticket-list {
  display: flex;
  flex-direction: column;
}

.ticket-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-left: 3px solid transparent;
  /* Keeps it stable */
  transition: all 0.3s ease;
}

.ticket-item:hover,
.ticket-item.active {
  background: rgba(205, 54, 231, 0.15);
  color: #fff;
  border-left: 3px solid #CD36E7;
}

.ticket-item-icon {
  width: 45px;
  height: 45px;
  min-width: 45px;
  background: linear-gradient(135deg, rgba(205, 54, 231, 0.2), rgba(125, 25, 175, 0.2));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #CD36E7;
  border: 1px solid rgba(205, 54, 231, 0.3);
}

.ticket-item-info {
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.ticket-item-info h6 {
  margin: 0 0 5px 0;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.ticket-item-info small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-item-status .badge {
  padding: 5px 10px;
  border-radius: 30px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* Status Colors Match Admin */
.status-answered {
  background: rgba(0, 200, 83, 0.2);
  color: #00e676;
  border: 1px solid rgba(0, 200, 83, 0.3);
}

.status-pending {
  background: rgba(255, 152, 0, 0.2);
  color: #ff9800;
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.status-closed {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

/* Chat Area */
.chat-body {
  display: flex;
  flex-direction: column;
  padding: 20px !important;
  gap: 15px;
}

.chat-message {
  display: flex;
  max-width: 85%;
  flex-direction: column;
}

.chat-message.left {
  align-self: flex-start;
}

.chat-message.right {
  align-self: flex-end;
}

.chat-message .bubble {
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #fff;
  position: relative;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: normal;
  min-width: 140px;
}

.chat-message.left .bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 4px;
}

.chat-message.right .bubble {
  background: linear-gradient(135deg, #CD36E7, #7D19AF);
  box-shadow: 0 4px 15px rgba(205, 54, 231, 0.3);
  border-bottom-right-radius: 4px;
}

.chat-message .time {
  display: block;
  font-size: 0.7rem;
  margin-top: 8px;
  opacity: 0.6;
  text-align: right;
  white-space: nowrap;
}

.chat-message.left .sender {
  font-weight: 700;
  font-size: 0.8rem;
  color: #CD36E7;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Chat Input Footer */
.messenger-card .card-footer {
  background: rgba(0, 0, 0, 0.3) !important;
  border-top: 1px solid rgba(205, 54, 231, 0.1) !important;
  padding: 15px 20px !important;
}

.chat-input-wrapper {
  display: flex;
  background: rgba(20, 10, 40, 0.6);
  border: 1px solid rgba(205, 54, 231, 0.3);
  border-radius: 30px;
  padding: 5px 5px 5px 20px;
  align-items: center;
}

.chat-input-wrapper textarea {
  background: transparent !important;
  border: none !important;
  color: #fff !important;
  box-shadow: none !important;
  resize: none;
  padding: 10px 0;
  overflow: hidden;
  height: auto;
}

.chat-input-wrapper textarea:focus {
  outline: none !important;
}

.chat-input-wrapper .btn-send {
  background: linear-gradient(135deg, #CD36E7, #7D19AF);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.chat-input-wrapper .btn-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(205, 54, 231, 0.5);
}

/* Form inputs for New Ticket */
.new-ticket-form {
  padding: 20px;
}

.new-ticket-form .form-group label {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
  margin-bottom: 8px;
}

.new-ticket-form .form-control {
  background: rgba(0, 0, 0, 0.2) !important;
  border: 1px solid rgba(205, 54, 231, 0.2) !important;
  color: #fff !important;
  border-radius: 12px;
}

.new-ticket-form .form-control:focus {
  border-color: #CD36E7 !important;
  box-shadow: 0 0 0 0.25rem rgba(205, 54, 231, 0.1) !important;
}

@media (max-width: 991px) {
  .messenger-wrapper {
    flex-direction: column;
    height: auto;
  }

  .messenger-sidebar {
    height: 400px;
  }

  .messenger-content {
    height: 600px;
  }
}