/* Loading overlay */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.col {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.col-lg-3 {
  flex: 0 0 25%;
  max-width: 25%;
}
.col-lg-6 {
  flex: 0 0 50%;
  max-width: 50%;
}
/* Sidebar conversation header */
.sidebar-convo-header {
  padding: 8px 10px;
  margin: 0;
  border-bottom: 1px solid #ccc;
}

/* Filter bar */
.filter-bar {
  #main {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
  }
  padding: 8px;
  border-bottom: 1px solid #ddd;
}

/* Chat header */
.chat-header {
  margin: 0;
  padding: 10px;
  border-bottom: 1px solid #ccc;
}

/* Info panel section */
.info-section {
  padding: 16px;
  border-bottom: 1px solid #ddd;
}
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  overflow: hidden; /* Prevent body scroll */
}

.unread-badge {
  font-size: 12px;
  font-weight: bold;
  color: red;
  margin-left: 6px;
  flex-shrink: 0;
}

#sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #ccc;
  height: 100vh;
  max-height: 100vh;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  overflow: hidden; /* Prevent sidebar from extending */
}

#convoList {
  flex: 1;
  overflow-y: auto;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden; /* Prevent main from extending */
}

.sidebar-header {
  padding: 13px;
  background-color: #5e6ed6;
  color: white;
  border-bottom: 1px solid #4a58c2;
}

.sidebar-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.search-box {
  padding: 12px;
  background-color: #f0f2f5;
  border-bottom: 1px solid #e0e0e0;
}

.search-input {
  width: 100%;
  padding: 8px 1px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.sidebar-subtitle {
  font-size: 13px;
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.9);
}

#chatHistory {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  background: #f9f9f9;
  position: relative;
}

.received {
  background: #e5e5ea;
}

.typing-indicator {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  height: 20px;
  padding: 10px 14px;
  border-radius: 20px;
  background: #03a84e;
  color: black;
  max-width: 90%;
}

.typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: black;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

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

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

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.message {
  padding: 8px 12px;
  border-radius: 18px;
  max-width: 70%;
  word-wrap: break-word;
  margin: 4px 0;
}

.received {
  background: #e5e5ea;
  align-self: flex-start;
}

.sent {
  background: #5E6ED6;
  color: white;
  align-self: flex-end;
}

#inputBar {
  display: flex;
  padding: 8px;
  border-top: 1px solid #ccc;
}

#inputBar input {
  flex: 1;
  padding: 6px;
}

#inputBar button {
  margin-left: 6px;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  padding: 8px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

li:hover {
  background: #fafafa;
}

.active {
  background: #d0e0ff !important;
}

.empty-state {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #666;
  text-align: center;
  padding: 20px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: #9ca3af;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state-message {
  font-size: 14px;
  max-width: 300px;
}

.agent-profile {
  padding: 12px 16px;
  border-top: 1px solid #e0e0e0;
  background-color: white;
  display: flex;
  align-items: center;
  margin-top: auto;
}

.agent-avatar {
  width: 36px;
  height: 36px;
  background-color: #5e6ed6;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.agent-info { flex: 1; }

.agent-name { font-weight: 600; margin: 0; }

.agent-status { font-size: 12px; color: #666; }

#inputBar {
  display: flex;
  padding: 12px 16px;
  background-color: white;
  border-top: 1px solid #e0e0e0;
}

#agentInput {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

#sendBtn {
  margin-left: 8px;
  padding: 10px 16px;
  background-color: #5e6ed6;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

#sendBtn:disabled {
  background-color: #c2c6dc;
  cursor: not-allowed;
}

.conversation-item.active {
  background-color: #eef2ff;
  border-left: 3px solid #5e6ed6;
}

.conversation-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  flex-direction: column;
}

.message {
  animation: fadeIn 0.6s ease;
  max-width: 40%;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  word-break: break-word;
  overflow-wrap: break-word;
  display: flex;
  white-space: normal;
}

.conversation-item.assigned-to-you {
  border-left: 4px solid #5e6ed6;
  background: #eef2ff;
}

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

.sent {
  background-color: #5e6ed6;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.received {
  background-color: white;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.filter-tab {
  padding: 6px 12px;
  margin-right: 4px;
  border: 1px solid #ccc;
  background-color: white;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  color: #333;
  transition: background-color 0.2s;
}

.filter-tab:hover { background-color: #5e6ed6; color: white; }

.active-tab { background-color: #5e6ed6; color: white; border-color: #5e6ed6; }

.z-topmost { z-index: 10000 !important; }

#infoPanel {
  width: 320px;
  border-left: 1px solid #ddd;
  background: #f9f9fb;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.04);
  font-family: "Segoe UI", sans-serif;
}

#infoPanel {
  width: 320px;
  min-width: 240px;
  max-width: 400px;
  border-left: 1px solid #ddd;
  background: #f9f9fb;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0;
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.04);
  font-family: "Segoe UI", sans-serif;
  height: 100vh;
  max-height: 100vh;
}
#infoPanel h4 {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

#infoPanel div.section {
  padding: 20px;
  border-bottom: 1px solid #e4e4e4;
  background: white;
}

#infoPanel textarea,
#infoPanel input[type="text"],
#infoPanel input[type="datetime-local"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
  margin-top: 4px;
  background: #fff;
}

#infoPanel button {
  background: #5e6ed6;
  color: white;
  border: none;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 6px;
  margin-top: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

#infoPanel button:hover { background: #4a59c2; }

#infoPanel .quick-reply {
  display: inline-block;
  margin-bottom: 6px;
  padding: 6px 12px;
  background: #eef0fc;
  color: #2948ff;
  border: 1px solid #d6daf7;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  margin-right: 6px;
  transition: all 0.2s ease;
}

#infoPanel .quick-reply:hover { background: #5e6ed6; color: white; border-color: #5e6ed6; }

#notesList,
#pastConvos { list-style: none; padding-left: 0; margin-top: 10px; }

#notesList li,
#pastConvos li {
  background: #f1f2f8;
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 6px;
  font-size: 13px;
  color: #333;
}

#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #5e6ed6;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
