/* Cantu Safety Live Chat Widget Styles */
:root {
  --cs-primary: #7cbb18;
  --cs-primary-hover: #8ecc20;
  --cs-bg-dark: #0e120e;
  --cs-bg-card: #161b16;
  --cs-bg-input: #202620;
  --cs-text-light: #f0f4f0;
  --cs-text-muted: #9ba49b;
  --cs-border: #2a332a;
  --cs-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  --cs-radius: 16px;
  --cs-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Floating Launcher Button */
#cs-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7cbb18 0%, #5a8a10 100%);
  box-shadow: 0 8px 24px rgba(124, 187, 24, 0.4);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#cs-chat-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 28px rgba(124, 187, 24, 0.55);
}

#cs-chat-launcher svg {
  width: 28px;
  height: 28px;
  fill: #ffffff;
}

#cs-chat-launcher .cs-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 7px;
  border: 2px solid var(--cs-bg-dark);
  display: none;
}

/* Main Chat Container Frame */
#cs-chat-box {
  position: fixed;
  bottom: 98px;
  right: 24px;
  z-index: 999999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 550px;
  max-height: calc(100vh - 120px);
  background: var(--cs-bg-dark);
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius);
  box-shadow: var(--cs-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--cs-font);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

#cs-chat-box.cs-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header - Fixed Height */
.cs-header {
  background: var(--cs-bg-card);
  padding: 14px 18px;
  border-bottom: 1px solid var(--cs-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cs-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cs-avatar-wrap {
  position: relative;
}

.cs-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--cs-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 16px;
}

.cs-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: #2ecc71;
  border: 2px solid var(--cs-bg-card);
  border-radius: 50%;
}

.cs-header-text h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--cs-text-light);
}

.cs-header-text p {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--cs-text-muted);
}

.cs-close-btn {
  background: transparent;
  border: none;
  color: var(--cs-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}

.cs-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--cs-text-light);
}

/* Step 1: Pre-chat Registration Form */
.cs-setup-view {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
  overflow-y: auto;
}

.cs-setup-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--cs-text-light);
  margin: 0 0 4px 0;
}

.cs-setup-subtitle {
  font-size: 12.5px;
  color: var(--cs-text-muted);
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.cs-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cs-form-group label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cs-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cs-form-input {
  background: var(--cs-bg-input);
  border: 1px solid var(--cs-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--cs-text-light);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s ease;
  font-family: inherit;
}

.cs-form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239ba49b'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 36px;
  cursor: pointer;
}

.cs-form-input:focus {
  border-color: var(--cs-primary);
}

.cs-start-btn {
  margin-top: 6px;
  background: var(--cs-primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  padding: 13px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.cs-start-btn:hover {
  background: var(--cs-primary-hover);
}

/* Step 2: Active Chat View Container */
.cs-chat-view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Scrollable Messages Container */
.cs-messages-list {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  scroll-behavior: smooth;
}

.cs-message {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
  word-break: break-word;
  position: relative;
  box-sizing: border-box;
}

.cs-message.cs-system {
  align-self: center;
  background: var(--cs-bg-card);
  color: var(--cs-text-muted);
  font-size: 11.5px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid var(--cs-border);
}

.cs-message.cs-user {
  align-self: flex-end;
  background: var(--cs-primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.cs-message.cs-agent {
  align-self: flex-start;
  background: var(--cs-bg-card);
  color: var(--cs-text-light);
  border: 1px solid var(--cs-border);
  border-bottom-left-radius: 4px;
}

.cs-msg-meta {
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.7;
  text-align: right;
}

/* Footer Container - Fixed at bottom */
.cs-footer {
  padding: 12px 16px;
  background: var(--cs-bg-card);
  border-top: 1px solid var(--cs-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cs-input-field {
  flex: 1;
  background: var(--cs-bg-input);
  border: 1px solid var(--cs-border);
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--cs-text-light);
  font-size: 13.5px;
  outline: none;
  resize: none;
  font-family: inherit;
  box-sizing: border-box;
}

.cs-input-field:focus {
  border-color: var(--cs-primary);
}

.cs-send-btn {
  background: var(--cs-primary);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.1s ease;
}

.cs-send-btn:hover {
  background: var(--cs-primary-hover);
  transform: scale(1.05);
}

.cs-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
  margin-left: 2px;
}

/* Mobile View Responsiveness - Elevated above Mobile Sticky Bottom Action Bar */
@media (max-width: 768px) {
  #cs-chat-launcher {
    bottom: 84px !important;
    right: 16px !important;
    width: 56px !important;
    height: 56px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  }

  #cs-chat-launcher svg {
    width: 24px !important;
    height: 24px !important;
  }

  #cs-chat-box {
    bottom: 80px !important;
    right: 12px !important;
    left: 12px !important;
    width: calc(100vw - 24px) !important;
    max-width: 100% !important;
    height: calc(100vh - 100px) !important;
    max-height: 560px !important;
    border-radius: 16px !important;
  }
}
