/* ══════════════════════════════════════════════════════════════
   CUSTOMER CHAT WIDGET (Modern Floating Responsive Design)
   ══════════════════════════════════════════════════════════════ */

.cchat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'Poppins', sans-serif;
}

/* ── Floating Action Trigger Button ── */
.cchat-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #c0392b;
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 12px 22px;
  font-family: 'Poppins', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, background-color 0.2s;
}

.cchat-toggle-btn:hover {
  background-color: #a93226;
  transform: translateY(-2px);
}

.cchat-toggle-btn i {
  font-size: 20px;
}

.cchat-badge {
  background: #ffffff;
  color: #c0392b;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 2px;
}

/* ── Chat Panel Window ── */
.cchat-panel {
  display: none;
  position: absolute;
  bottom: 65px;
  right: 0;
  width: 680px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 100px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.cchat-panel.open {
  display: flex !important;
}

/* ── Left Column: Contact List ── */
.cchat-list-col {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid #ebebeb;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.cchat-list-header {
  background: #c0392b;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cchat-list-header h3 {
  color: #ffffff;
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.3px;
}

.cchat-close-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.9;
  transition: transform 0.15s, opacity 0.15s;
}

.cchat-close-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}

.cchat-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  background: #ffffff;
}

.cchat-search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f2f3f5;
  border-radius: 8px;
  padding: 8px 12px;
}

.cchat-search-box i {
  color: #9aa0a6;
  font-size: 16px;
}

.cchat-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  width: 100%;
  color: #333333;
}

.cchat-filter-select {
  border: 1px solid #e2e4e8;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #444444;
  padding: 8px 10px;
  background: #ffffff;
  cursor: pointer;
}

.cchat-contacts {
  flex: 1;
  overflow-y: auto;
}

.cchat-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  border-bottom: 1px solid #f8f8f8;
  transition: background 0.15s;
}

.cchat-contact-item:hover {
  background: #faf5f4;
}

.cchat-contact-item.active {
  background: #fbeceb;
  border-left: 3px solid #c0392b;
}

.cchat-contact-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #c0392b;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

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

.cchat-contact-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cchat-contact-lastmsg {
  font-size: 12px;
  color: #888888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ── Right Column: Conversation Area ── */
.cchat-convo-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #fbfbfb;
}

.cchat-convo-header {
  padding: 14px 18px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #ffffff;
}

.cchat-convo-header span {
  font-weight: 700;
  font-size: 15px;
  color: #1a1a1a;
}

.cchat-convo-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cchat-convo-close-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: #666;
  cursor: pointer;
  display: none;
  line-height: 1;
}

.cchat-chevron {
  color: #999999;
  font-size: 20px;
  cursor: pointer;
}

.cchat-convo-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cchat-empty-state {
  margin: auto;
  text-align: center;
  color: #a0a0a0;
  font-size: 13px;
  padding: 20px;
}

/* ── Message Bubbles ── */
.cchat-msg-row {
  display: flex;
  width: 100%;
}

.cchat-msg-row.me {
  justify-content: flex-end;
}

.cchat-msg-row.staff {
  justify-content: flex-start;
}

.cchat-msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.cchat-msg-row.me .cchat-msg-bubble {
  background: #c0392b;
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(192, 57, 43, 0.25);
}

.cchat-msg-row.staff .cchat-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.cchat-msg-sender {
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 3px;
}

.cchat-msg-row.me .cchat-msg-sender {
  color: rgba(255, 255, 255, 0.85);
}

.cchat-msg-row.staff .cchat-msg-sender {
  color: #64748b;
}

.cchat-msg-time {
  font-size: 9.5px;
  text-align: right;
  margin-top: 4px;
}

.cchat-msg-row.me .cchat-msg-time {
  color: rgba(255, 255, 255, 0.75);
}

.cchat-msg-row.staff .cchat-msg-time {
  color: #94a3b8;
}

/* ── Bottom Input Row ── */
.cchat-convo-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #f0f0f0;
  background: #ffffff;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

.cchat-attach-btn {
  background: none;
  border: none;
  color: #888888;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  width: 26px;
  height: 26px;
}

.cchat-attach-btn:hover {
  color: #c0392b;
}

.cchat-convo-input input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  background: #f7f8fa;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  padding: 9px 16px;
  font-family: 'Poppins', sans-serif;
  font-size: 12.5px;
  color: #1e293b;
  outline: none;
}

.cchat-convo-input input:focus {
  border-color: #c0392b;
  background: #ffffff;
}

.cchat-send-btn {
  background: #c0392b;
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 16px;
  padding: 0;
  transition: background-color 0.15s, transform 0.15s;
}

.cchat-send-btn:hover {
  background-color: #a93226;
  transform: scale(1.05);
}

/* ══════════════════════════════════════════════════════════════
   MOBILE VIEW
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {
  .cchat-widget {
    bottom: 16px;
    right: 14px;
  }

  .cchat-panel {
    position: fixed !important;
    bottom: 74px !important;
    right: 14px !important;
    left: auto !important;
    top: auto !important;
    width: min(360px, calc(100vw - 28px)) !important;
    max-width: calc(100vw - 28px) !important;
    height: 440px !important;
    max-height: 66vh !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28) !important;
    border: 1px solid #e8e8e8 !important;
    z-index: 100000 !important;
  }

  .cchat-list-col {
    display: none !important;
  }

  .cchat-convo-col {
    width: 100% !important;
    flex: 1 !important;
  }

  .cchat-convo-header {
    background: #c0392b;
    padding: 12px 14px;
  }

  .cchat-convo-header span {
    color: #ffffff;
    font-size: 14.5px;
  }

  .cchat-chevron {
    display: none;
  }

  .cchat-convo-close-btn {
    display: block !important;
    color: #ffffff !important;
    font-size: 20px;
  }

  .cchat-convo-messages {
    padding: 12px;
    gap: 8px;
  }

  .cchat-msg-bubble {
    max-width: 86%;
    font-size: 12.5px;
    padding: 8px 11px;
  }

  .cchat-convo-input {
    padding: 8px 10px !important;
    gap: 6px !important;
  }

  .cchat-convo-input input {
    font-size: 12px !important;
    padding: 7px 12px !important;
    min-width: 0 !important;
  }

  .cchat-send-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    flex-shrink: 0 !important;
  }
}