@charset "utf-8";

/* ============================================================
   Toyota Online Customer Service Modal (在线客服咨询弹出层)
   Matches Official Toyota Consultation Popup Specification
   ============================================================ */

.cs-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.48);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 10px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.cs-modal-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

.cs-modal-container {
  width: 100%;
  max-width: 440px;
  height: 570px;
  max-height: calc(100vh - 24px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  transform: translateY(-14px) scale(0.98);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.cs-modal-backdrop.is-active .cs-modal-container {
  transform: translateY(0) scale(1);
}

/* Modal Header */
.cs-modal-header {
  height: 50px;
  min-height: 50px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
  box-sizing: border-box;
}

.cs-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cs-header-brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
}

.cs-header-brand-icon svg,
.cs-header-brand-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.cs-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #202020;
  letter-spacing: 0.2px;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.cs-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #888888;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease;
}

.cs-modal-close:hover {
  color: #111111;
  background: #f5f5f5;
}

/* Modal Chat Body */
.cs-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px 14px 10px;
  background: #f7f8fa;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.cs-modal-body::-webkit-scrollbar {
  width: 5px;
}
.cs-modal-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.cs-time-divider {
  display: flex;
  justify-content: center;
  margin: 2px 0 6px;
}

.cs-time-divider span {
  display: inline-block;
  padding: 3px 12px;
  background: #ebecee;
  border-radius: 12px;
  font-size: 11px;
  color: #7d828a;
  letter-spacing: 0.3px;
}

/* Chat Message Item */
.cs-msg-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.cs-msg-row.cs-msg--service {
  justify-content: flex-start;
}

.cs-msg-row.cs-msg--user {
  justify-content: flex-end;
}

.cs-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eb0a1e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(235, 10, 30, 0.25);
}

.cs-msg-avatar svg {
  width: 18px;
  height: 18px;
  fill: #ffffff;
}

.cs-msg-avatar img,
.cs-msg-avatar .cs-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.cs-msg-content-wrap {
  max-width: calc(100% - 46px);
  display: flex;
  flex-direction: column;
}

.cs-msg-bubble {
  position: relative;
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.62;
  word-break: break-word;
  white-space: pre-wrap;
  box-sizing: border-box;
}

.cs-msg-image { display: block; max-width: min(280px, 65vw); max-height: 320px; width: auto; height: auto; border-radius: 6px; }

.cs-msg--service .cs-msg-bubble {
  background: #ffffff;
  color: #262626;
  border: 1px solid #e7e8eb;
  border-radius: 4px 12px 12px 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.cs-msg--user .cs-msg-bubble {
  background: #ffeff1;
  color: #202020;
  border: 1px solid #ffd4d9;
  border-radius: 12px 4px 12px 12px;
  box-shadow: 0 2px 6px rgba(235, 10, 30, 0.05);
}

.cs-msg-time {
  margin-top: 5px;
  font-size: 10.5px;
  color: #9ea3aa;
  text-align: right;
  letter-spacing: 0.2px;
}

.cs-msg--user .cs-msg-time {
  text-align: right;
}

/* Modal Footer & Input Area */
.cs-modal-footer {
  background: #ffffff;
  border-top: 1px solid #eeeeee;
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  position: relative;
}

.cs-input-area {
  width: 100%;
}

.cs-input {
  width: 100%;
  min-height: 46px;
  max-height: 90px;
  border: 0;
  outline: none;
  resize: none;
  font-size: 13.5px;
  line-height: 1.5;
  color: #222222;
  font-family: inherit;
  box-sizing: border-box;
  background: transparent;
  padding: 2px 0;
}

.cs-input::placeholder {
  color: #b0b4ba;
}

.cs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
}

.cs-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.cs-tool-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: #666666;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.cs-tool-item svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.cs-tool-item:hover {
  color: #eb0a1e;
}

.cs-send-btn {
  padding: 5px 18px;
  border: 1px solid #e2e4e8;
  border-radius: 16px;
  background: #f5f6f8;
  color: #a0a4ab;
  font-size: 12px;
  font-weight: 600;
  cursor: not-allowed;
  transition: all 0.2s ease;
}

.cs-send-btn.is-ready {
  background: #eb0a1e;
  border-color: #eb0a1e;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(235, 10, 30, 0.25);
}

.cs-send-btn.is-ready:hover {
  background: #d6081a;
  border-color: #d6081a;
}

/* Emoji Picker Popover */
.cs-emoji-popover {
  position: absolute;
  bottom: 82px;
  left: 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 8px 10px;
  display: none;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  z-index: 20;
}

.cs-emoji-popover.is-open {
  display: grid;
}

.cs-emoji-item {
  font-size: 20px;
  line-height: 1;
  padding: 6px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.cs-emoji-item:hover {
  background: #f0f2f5;
}

/* Responsive adjust for mobile */
@media (max-width: 480px) {
  .cs-modal-backdrop {
    padding: 8px 6px;
  }
  .cs-modal-container {
    height: calc(100vh - 16px);
    max-height: 560px;
    border-radius: 10px;
  }
  .cs-msg-bubble {
    font-size: 12.5px;
    padding: 10px 12px;
  }
}
