/* ===== Chat Container ===== */
.chat-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bs-gray-100);
  position: relative;
}

.chat-container .fas {
  font-size: 10px !important;
}

/* ===== App Loading Overlay ===== */
.chat-app-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.chat-app-loading.d-none {
  display: none;
}

.chat-app-loading .loading-content {
  text-align: center;
  color: var(--bs-gray-600);
}

/* ===== Header Bar ===== */
.chat-header {
  background: var(--bs-white);
  border-bottom: 1px solid var(--bs-gray-300);
  padding: 8px 16px;
  flex-shrink: 0;
}

/* ===== Main Layout ===== */
.chat-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== Left Sidebar - Filters ===== */
.chat-sidebar {
  width: 200px;
  background: var(--bs-white);
  border-right: 1px solid var(--bs-gray-300);
  flex-shrink: 0;
  overflow-y: auto;
  transition: width 0.3s ease;
}

.chat-sidebar.collapsed {
  width: 0;
  height: 0;
}

/* ===== Filter Styling ===== */
.filter-radio {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: var(--bs-border-radius);
  transition: background 0.2s;
}

.filter-radio:hover {
  background: var(--bs-gray-100);
}

.filter-radio input {
  margin-right: 8px;
  accent-color: var(--bs-gray-800);
}

.filter-radio .radio-label {
  font-size: 13px;
  color: var(--bs-gray-800);
}

.filter-radio .count {
  color: var(--bs-gray-500);
  font-size: 12px;
}

/* ===== Conversation List Panel ===== */
.chat-list-panel {
  width: 280px;
  background: var(--bs-white);
  border-right: 1px solid var(--bs-gray-300);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* Search */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper i {
  position: absolute;
  left: 12px;
  color: var(--bs-gray-500);
  font-size: 14px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--bs-gray-300);
  border-radius: var(--bs-border-radius);
  font-size: 13px;
  outline: none;
}

.search-input-wrapper input:focus {
  border-color: var(--bs-primary);
}

/* Tabs */
.chat-tabs {
  display: flex;
  border-bottom: 1px solid #e8e8e8;
}

.chat-tabs .tab-btn {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-tabs .tab-btn:hover {
  color: #333;
}

.chat-tabs .tab-btn.active {
  color: #333;
  border-bottom-color: #333;
  font-weight: 500;
}

/* Filter toggle */
.filter-toggle {
  .btn {
    font-size: 10px;
  }
}

.btn-refresh-conversations,
.btn-webhook-config {
  padding: 8px 10px;
  font-size: 10px;
}

.shop-dropdown-btn {
  padding: 6px 12px;
  color: var(--bs-gray-800);
}

.shop-item {
  padding: 8px 12px;
  font-size: 13px;
  max-width: 100%;
}

.shop-item:hover {
  background-color: var(--bs-gray-100);
}

.shop-item.active {
  background-color: var(--bs-primary);
  color: var(--bs-white);
}

.shop-item.active:hover {
  background-color: var(--bs-primary);
  color: var(--bs-white);
}

.no-shops-found {
  font-size: 13px;
}

/* New Conversation Alert */
.new-conversation-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #fff3cd;
  border-bottom: 1px solid #ffc107;
  font-size: 13px;
  color: #856404;
}

.new-conversation-alert .btn-close {
  font-size: 10px;
  padding: 4px;
  opacity: 0.7;
}

.new-conversation-alert .btn-close:hover {
  opacity: 1;
}

/* Other Shop Alert */
.other-shop-alert {
  padding: 8px 12px;
  background: #d1ecf1;
  border-bottom: 1px solid #bee5eb;
  font-size: 13px;
  color: #0c5460;
}

.other-shop-alert .btn-close {
  font-size: 10px;
  padding: 4px;
  opacity: 0.7;
}

.other-shop-alert .btn-close:hover {
  opacity: 1;
}

.other-shop-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.other-shop-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bs-white);
  border: 1px solid #bee5eb;
  border-radius: 12px;
  font-size: 11px;
  color: #0c5460;
  text-decoration: none;
  transition: all 0.2s;
}

.other-shop-item:hover {
  background: #0c5460;
  color: var(--bs-white);
  text-decoration: none;
}

.other-shop-item .badge {
  font-size: 10px;
  padding: 2px 5px;
}

/* Conversation List */
.conversation-list {
  /* flex: 1; */
  height: calc(100vh - 230px);
  overflow-y: auto;
  margin-bottom: 50px;
}

.conversation-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--bs-gray-200);
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
}

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

.conversation-item.active {
  background: #e6f7ff;
}

.conversation-item.unread .name,
.conversation-item.unread .preview {
  font-weight: 600;
  color: var(--bs-gray-900);
}

.unread-badge {
  background: #4f63ff;
  color: white;
  font-weight: 600;
  border-radius: 10px;
  width: 10px;
  height: 10px;
  text-align: center;
  flex-shrink: 0;
  position: absolute;
  right: 10px;
  bottom: 10px;
}

.conversation-item .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bs-gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--bs-gray-600);
  font-size: 14px;
  flex-shrink: 0;
  margin-right: 12px;
}

.conversation-item .conv-content {
  flex: 1;
  min-width: 0;
}

.conversation-item .conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.conversation-item .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--bs-gray-800);
}

.conversation-item .time {
  font-size: 12px;
  color: var(--bs-gray-500);
}

.conversation-item .preview {
  font-size: 13px;
  color: var(--bs-gray-600);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Chat Detail Panel ===== */
.chat-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bs-white);
  min-width: 0;
}

/* Welcome State */
.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--bs-gray-500);
}

.chat-welcome .welcome-icon {
  width: 80px;
  height: 80px;
  background: var(--bs-gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.chat-welcome .welcome-icon i {
  font-size: 32px !important;
  color: var(--bs-gray-400);
}

.chat-welcome h5 {
  color: var(--bs-gray-800);
  margin-bottom: 8px;
}

/* Active Chat */
.chat-active {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.chat-detail-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bs-gray-300);
}

.chat-detail-header .buyer-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--bs-gray-800);
}

/* Messages Area */
.chat-messages-wrapper {
  flex: 1;
  overflow: hidden;
  background: var(--bs-gray-100);
}

.chat-messages {
  /* height: 100%; */
  height: calc(100vh - 350px);
  overflow-y: auto;
  padding: 16px;
  border-right: 0.5px solid var(--bs-gray-300);
}

/* Message Bubbles */
.message {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
}

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

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

.message-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.message.sent .message-bubble {
  background: #e0efef;
  color: var(--bs-gray-800);
  border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
  background: var(--bs-white);
  color: var(--bs-gray-800);
  border: 1px solid var(--bs-gray-300);
  border-bottom-left-radius: 4px;
}

.message-time {
  display: none;
  font-size: 11px;
  color: #8e8e8e;
  margin-top: 4px;
}

.message-time.show {
  display: block;
}

/* Time Separator */
.message-date-separator {
  text-align: center;
  margin: 16px 0;
}

.message-date-separator span {
  background: var(--bs-gray-100);
  padding: 4px 12px;
  font-size: 12px;
  color: var(--bs-gray-500);
  border-radius: 10px;
}

/* ===== Role-Based Message Styles ===== */

/* BUYER: left-aligned, white bg with border */
.message.role-buyer {
  align-items: flex-start;
}

.message.role-buyer .message-bubble {
  background: var(--bs-white);
  color: var(--bs-gray-800);
  border: 1px solid var(--bs-gray-300);
  border-bottom-left-radius: 4px;
}

/* SHOP: right-aligned, teal bg */
.message.role-shop {
  align-items: flex-end;
}

.message.role-shop .message-bubble {
  background: #e0efef;
  color: var(--bs-gray-800);
  border-bottom-right-radius: 4px;
}

/* CUSTOMER_SERVICE: right-aligned, teal bg */
.message.role-customer_service {
  align-items: flex-end;
}

.message.role-customer_service .message-bubble {
  background: #e0efef;
  color: var(--bs-gray-800);
  border-bottom-right-radius: 4px;
}

/* ROBOT: right-aligned, teal bg with label */
.message.role-robot {
  align-items: flex-end;
}

.message.role-robot .message-bubble {
  background: #e0efef;
  color: var(--bs-gray-800);
  border-bottom-right-radius: 4px;
}

/* SYSTEM: centered, no bubble, gray italic */
.message.role-system {
  align-items: center;
  margin: 12px 0;
}

.message.role-system .system-text {
  font-size: 12px;
  color: var(--bs-gray-500);
  font-style: italic;
  text-align: center;
  max-width: 45%;
}

/* Sender info (for SHOP, CUSTOMER_SERVICE, ROBOT) */
.message-sender {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 12px;
}

.message-sender .sender-name {
  color: var(--bs-gray-600);
  font-weight: 500;
}

.message-sender .role-label {
  color: var(--bs-gray-500);
  font-style: italic;
}

/* Grouped messages (consecutive from same sender) */
.message.grouped {
  margin-top: 2px;
}

/* ===== Message Type Styles ===== */

/* Image messages */
.msg-image {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.msg-image:hover {
  opacity: 0.9;
}

/* Video messages */
.msg-video video {
  max-width: 250px;
  max-height: 180px;
  border-radius: 8px;
}

/* Sticker/Emoticon */
.msg-sticker {
  max-width: 100px;
  max-height: 100px;
}

/* Card messages (product, order, coupon, etc.) */
.msg-card {
  background: var(--bs-white);
  border: 1px solid var(--bs-gray-300);
  border-radius: 8px;
  overflow: hidden;
  min-width: 180px;
  max-width: 220px;
}

.msg-card img {
  width: 100%;
  height: 80px;
  object-fit: cover;
}

.msg-card .card-header {
  padding: 6px 10px;
  background: var(--bs-gray-100);
  font-size: 11px;
  font-weight: 500;
  color: var(--bs-gray-600);
  border-radius: 0;
  border-bottom: 1px solid var(--bs-gray-200);
}

.msg-card .card-info {
  padding: 8px 10px;
}

.msg-card .card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--bs-gray-800);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.msg-card .card-price {
  font-size: 14px;
  font-weight: 600;
  color: #e74c3c;
}

.msg-card .card-status {
  font-size: 12px;
  color: var(--bs-gray-600);
}

.msg-card .card-discount {
  font-size: 14px;
  font-weight: 600;
  color: #27ae60;
}

.msg-card .card-tracking {
  font-size: 11px;
  color: var(--bs-gray-500);
  font-family: monospace;
}

/* Product card specific */
.msg-card.product-card .card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Refund card */
.msg-card.refund-card .card-header {
  background: #fff3cd;
  color: #856404;
}

/* Coupon card */
.msg-card.coupon-card .card-header {
  background: #d4edda;
  color: #155724;
}

/* Logistics card */
.msg-card.logistics-card .card-header {
  background: #cce5ff;
  color: #004085;
}

/* Context messages (buyer viewing product/order) */
.msg-context {
  font-size: 12px;
  color: var(--bs-gray-600);
  font-style: italic;
  padding: 4px 0;
}

.msg-context i {
  font-size: 10px !important;
}

/* Remove bubble padding for cards */
.message[data-type="PRODUCT_CARD"] .message-bubble,
.message[data-type="ORDER_CARD"] .message-bubble,
.message[data-type="RETURN_REFUND_CARD"] .message-bubble,
.message[data-type="COUPON_CARD"] .message-bubble,
.message[data-type="LOGISTICS_CARD"] .message-bubble {
  padding: 0;
  background: transparent;
  border: none;
}

/* Image/video bubble adjustments */
.message[data-type="IMAGE"] .message-bubble,
.message[data-type="VIDEO"] .message-bubble,
.message[data-type="EMOTICONS"] .message-bubble {
  padding: 4px;
  background: transparent;
  border: none;
}

/* Legacy system message (keep for backward compat) */
.message-system {
  text-align: center;
  margin: 12px 0;
}

.message-system span {
  font-size: 12px;
  color: var(--bs-gray-500);
  font-style: italic;
}

/* ===== Message Input Area ===== */
.chat-input-area {
  border-top: 1px solid var(--bs-gray-300);
  padding: 12px;
  background: var(--bs-white);
}

.toolbar-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--bs-gray-300);
  border-radius: var(--bs-border-radius);
  color: var(--bs-gray-600);
  cursor: pointer;
  transition: all 0.2s;
}

.toolbar-btn:hover {
  background: var(--bs-gray-100);
  color: var(--bs-gray-800);
}

.input-wrapper {
  border: 1px solid var(--bs-gray-300);
  margin-bottom: 8px;
}

.input-wrapper textarea {
  width: 100%;
  padding: 10px 12px;
  border: none;
  resize: none;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  min-height: 40px;
  max-height: 120px;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  padding: 4px 12px 8px;
  font-size: 12px;
  color: var(--bs-gray-500);
}

.btn-send {
  background: #00b894;
  color: var(--bs-white);
  border: none;
  padding: 8px 24px;
  border-radius: var(--bs-border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  float: right;
  transition: background 0.2s;
}

.btn-send:hover {
  background: #00a382;
}

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

/* ===== Customer Info Panel ===== */
.customer-info-panel {
  width: 320px;
  background: var(--bs-white);
  border-left: 1px solid var(--bs-gray-300);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

/* Customer Header */
.customer-header {
  padding: 20px;
  border-bottom: 1px solid var(--bs-gray-300);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.customer-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.customer-avatar .fa-user {
  font-size: 32px !important;
  color: var(--bs-gray-500);
}

.customer-name-section h6 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

/* Customer Stats */
.stat-box {
  flex: 1;
  background: var(--bs-gray-100);
  padding: 12px;
  border-radius: var(--bs-border-radius);
}

.stat-box .stat-label {
  display: block;
  font-size: 12px;
  color: var(--bs-gray-500);
  margin-bottom: 4px;
}

.stat-box .stat-value {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--bs-gray-800);
}

/* Customer Tabs */
.customer-tab {
  display: flex;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  color: var(--bs-gray-600);
  cursor: pointer;
  transition: all 0.2s;
}

.customer-tab:hover {
  color: var(--bs-gray-800);
}

.customer-tab.active {
  color: var(--bs-gray-800);
  border-bottom-color: var(--bs-gray-800);
  font-weight: 500;
}

.customer-tab .tab-count {
  background: var(--bs-gray-200);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 4px;
}

/* Tab Content */
.customer-tab-content {
  flex: 1;
  overflow-y: auto;
}

/* Tab Filters */
.tab-filters .search-box {
  flex: 1;
  position: relative;
}

.tab-filters .search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bs-gray-500);
  font-size: 12px;
}

.tab-filters .search-box input {
  width: 100%;
  padding: 6px 10px 6px 30px;
  border: 1px solid var(--bs-gray-300);
  border-radius: var(--bs-border-radius);
  font-size: 13px;
}

/* Order Card */
.order-card {
  border: 1px solid var(--bs-gray-300);
  border-radius: var(--bs-border-radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bs-gray-100);
  border-bottom: 1px solid var(--bs-gray-300);
}

.order-status {
  font-size: 13px;
  font-weight: 500;
}

.order-status.delivered {
  color: var(--bs-success);
}

.order-status.pending {
  color: var(--bs-warning);
}

.order-status.shipped {
  color: var(--bs-info);
}

.order-id {
  font-size: 12px;
  color: var(--bs-gray-600);
}

.order-id a {
  color: var(--bs-primary);
}

.order-date {
  font-size: 12px;
  color: var(--bs-gray-500);
}

.order-product {
  display: flex;
  padding: 12px;
  gap: 12px;
}

.order-product-img {
  width: 60px;
  height: 60px;
  border-radius: var(--bs-border-radius);
  overflow: hidden;
  flex-shrink: 0;
}

.order-product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.order-product-name {
  font-size: 13px;
  color: var(--bs-gray-800);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.order-product-variant {
  font-size: 12px;
  color: var(--bs-gray-500);
}

.order-product-price {
  text-align: right;
}

.order-product-price .price {
  font-size: 14px;
  font-weight: 500;
  color: var(--bs-gray-800);
}

.order-product-price .qty {
  font-size: 12px;
  color: var(--bs-gray-500);
}

.order-footer {
  padding: 12px;
  border-top: 1px solid var(--bs-gray-300);
}

.order-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 8px;
}

.order-row:last-child {
  margin-bottom: 0;
}

.order-row .label {
  color: var(--bs-gray-600);
}

.order-row .value {
  color: var(--bs-gray-800);
}

.order-row .value a {
  color: var(--bs-primary);
  font-size: 12px;
  margin-left: 8px;
}

/* ===== Emoji Picker ===== */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 320px;
  background: var(--bs-white);
  border: 1px solid var(--bs-gray-300);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  margin-bottom: 8px;
  z-index: 1000;
}

.emoji-tabs {
  display: flex;
  border-bottom: 1px solid var(--bs-gray-200);
  padding: 4px;
  gap: 2px;
}

.emoji-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--bs-gray-500);
  transition: all 0.2s;
}

.emoji-tab:hover {
  background: var(--bs-gray-100);
  color: var(--bs-gray-700);
}

.emoji-tab.active {
  background: var(--bs-gray-200);
  color: var(--bs-gray-800);
}

.emoji-tab i {
  font-size: 14px !important;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.2s;
}

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

.emoji-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  color: var(--bs-gray-500);
  font-size: 13px;
}

/* ===== Image Preview Modal ===== */
.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.image-preview-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bs-gray-100);
  aspect-ratio: 1;
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.image-preview-remove:hover {
  background: rgba(0, 0, 0, 0.8);
}

.image-preview-remove i {
  font-size: 10px !important;
}

.image-preview-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#image-preview-modal .modal-body {
  max-height: 400px;
  overflow-y: auto;
}

/* ===== Webhook Config Panel ===== */
.webhook-config-panel {
  position: absolute;
  top: 60px;
  left: 0;
  width: 280px;
  background: var(--bs-white);
  border: 1px solid var(--bs-gray-300);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 400px;
  display: flex;
  flex-direction: column;
}

.webhook-config-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bs-gray-200);
  background: var(--bs-gray-50);
  border-radius: 8px 8px 0 0;
}

.webhook-config-header h6 {
  font-size: 14px;
  font-weight: 500;
  color: var(--bs-gray-800);
}

.webhook-config-body {
  padding: 12px 16px;
  overflow-y: auto;
  flex: 1;
}

.webhook-list {
  max-height: 180px;
  overflow-y: auto;
}

.webhook-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bs-gray-50);
  border: 1px solid var(--bs-gray-200);
  border-radius: 6px;
  margin-bottom: 8px;
}

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

.webhook-info {
  flex: 1;
  min-width: 0;
  margin-right: 8px;
}

.webhook-event {
  font-size: 12px;
  font-weight: 500;
  color: var(--bs-gray-800);
  margin-bottom: 2px;
}

.webhook-url {
  font-size: 11px;
  color: var(--bs-gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: monospace;
}

.webhook-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.webhook-actions .btn {
  padding: 4px 6px;
  font-size: 12px;
}

.webhook-actions .btn i {
  font-size: 11px !important;
}

.webhook-form {
  border-top: 1px solid var(--bs-gray-200);
  padding-top: 12px;
}

.webhook-form .form-label {
  font-size: 12px;
  color: var(--bs-gray-600);
  margin-bottom: 4px;
}

.webhook-empty {
  padding: 16px 0;
}

/* ===== Test Conversation Panel ===== */
.test-conversation-panel {
  position: absolute;
  top: 60px;
  left: 0;
  width: 300px;
  background: var(--bs-white);
  border: 1px solid var(--bs-gray-300);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  max-height: 450px;
  display: flex;
  flex-direction: column;
}

/* ===== Responsive ===== */

/* Larger screens - wider customer panel */
@media (min-width: 1800px) {
  .customer-info-panel {
    width: 420px;
  }
}

@media (min-width: 1600px) and (max-width: 1799px) {
  .customer-info-panel {
    width: 380px;
  }
}

@media (min-width: 1400px) and (max-width: 1599px) {
  .customer-info-panel {
    width: 320px;
  }
}

@media (max-width: 1400px) {
  .customer-info-panel {
    width: 120px;
  }
}

@media (max-width: 1200px) {
  .chat-sidebar {
    width: 160px;
  }
  .chat-list-panel {
    width: 240px;
  }
}

@media (max-width: 992px) {
  /* Enable horizontal scroll for chat panels */
  .chat-main {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  /* Fixed widths for mobile swipe */
  .chat-sidebar {
    min-width: 200px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .chat-list-panel {
    min-width: 280px;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .chat-message-area {
    min-width: 100vw;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .chat-detail-panel {
    min-width: 100vw;
    flex-shrink: 0;
    scroll-snap-align: start;
  }

  .customer-info-panel {
    min-width: 280px;
    width: 280px;
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex;
  }
}
