/* ============================================
   IntentLed Sales — Chatbot Widget Styles
   All classes prefixed with ils- to avoid collisions
   ============================================ */

:root {
  --ils-bg: #111118;
  --ils-bg-glass: rgba(18, 18, 26, 0.95);
  --ils-surface: #1e1e2e;
  --ils-surface-light: #2a2a3e;
  --ils-accent: #00e5ff;
  --ils-accent-dark: #00b8d4;
  --ils-accent-glow: rgba(0, 229, 255, 0.25);
  --ils-text: #ffffff;
  --ils-text-70: rgba(255, 255, 255, 0.7);
  --ils-text-50: rgba(255, 255, 255, 0.5);
  --ils-text-30: rgba(255, 255, 255, 0.3);
  --ils-border: rgba(255, 255, 255, 0.1);
  --ils-border-hover: rgba(0, 229, 255, 0.3);
  --ils-green: #10b981;
  --ils-red: #ef4444;
  --ils-radius: 28px;
}

/* ---- Hidden utility ---- */
.ils-hidden {
  display: none !important;
}

/* ---- Mobile Overlay ---- */
.ils-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.ils-overlay.ils-visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Launcher Button ---- */
.ils-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--ils-accent-dark), var(--ils-accent));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 229, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ils-launcher:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 32px rgba(34, 211, 238, 0.4), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.ils-launcher:active {
  transform: scale(0.95);
}
@keyframes ils-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.ils-launcher.ils-pulse {
  animation: ils-pulse 2.4s ease-in-out infinite;
}
.ils-launcher.ils-pulse:hover {
  animation: none;
  transform: scale(1.1);
}

/* ---- Chat Panel ---- */
.ils-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  z-index: 9999;
  width: 480px;
  height: calc(100vh - 110px);
  max-height: none;
  background: var(--ils-bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--ils-border);
  border-radius: var(--ils-radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 8px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
}
.ils-panel.ils-visible {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ---- Panel Header ---- */
.ils-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ils-border);
  background: rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}
.ils-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ils-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ils-accent-dark), var(--ils-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.ils-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ils-header-name {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--ils-text);
  margin: 0;
  line-height: 1.2;
}
.ils-header-sub {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--ils-text-50);
  margin: 0;
  line-height: 1.2;
}
.ils-header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ils-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ils-text-50);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.ils-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ils-text);
}

/* ---- Dropdown Menu ---- */
.ils-menu-wrap {
  position: relative;
}
.ils-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--ils-surface);
  border: 1px solid var(--ils-border);
  border-radius: 12px;
  padding: 4px;
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 10;
}
.ils-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--ils-text-70);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  text-align: left;
}
.ils-dropdown button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ils-text);
}
.ils-dropdown button.ils-danger {
  color: var(--ils-red);
}
.ils-dropdown button.ils-danger:hover {
  background: rgba(239, 68, 68, 0.1);
}
.ils-dropdown button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---- Pre-Chat Form ---- */
.ils-pre-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.ils-form-body {
  flex: 1;
  padding: 24px 20px;
  overflow-y: auto;
}
.ils-form-body h3 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ils-text);
  margin: 0 0 6px;
}
.ils-form-body > p {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--ils-text-50);
  margin: 0 0 20px;
  line-height: 1.5;
}
.ils-form-body label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--ils-text-70);
  margin-bottom: 14px;
}
.ils-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  background: var(--ils-surface);
  border: 1px solid var(--ils-border);
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color 0.2s ease;
}
.ils-input-wrap:focus-within {
  border-color: var(--ils-accent);
  box-shadow: 0 0 0 2px var(--ils-accent-glow);
}
.ils-input-wrap svg {
  width: 16px;
  height: 16px;
  color: var(--ils-text-30);
  flex-shrink: 0;
}
.ils-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ils-text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 0;
}
.ils-input-wrap input::placeholder {
  color: var(--ils-text-30);
}
.ils-form-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--ils-red);
}
.ils-form-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--ils-border);
  flex-shrink: 0;
}
.ils-submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 20px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--ils-accent-dark), var(--ils-accent));
  color: #fff;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 10px 30px rgba(0, 229, 255, 0.3);
}
.ils-submit-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.ils-submit-btn:active {
  transform: scale(0.98);
}
.ils-submit-btn svg {
  width: 16px;
  height: 16px;
}

/* ---- Chat Body ---- */
.ils-chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Messages Container ---- */
.ils-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.ils-messages::-webkit-scrollbar {
  width: 4px;
}
.ils-messages::-webkit-scrollbar-track {
  background: transparent;
}
.ils-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* ---- Welcome Card ---- */
.ils-welcome-card {
  background: var(--ils-surface);
  border: 1px solid var(--ils-border);
  border-radius: 14px;
  padding: 32px 24px;
  text-align: center;
}
.ils-welcome-card .ils-welcome-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ils-accent-dark), var(--ils-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.ils-welcome-card h3 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ils-text);
  margin: 0 0 6px;
}
.ils-welcome-card p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--ils-text-50);
  margin: 0 0 10px;
  line-height: 1.5;
}
.ils-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--ils-green);
}
.ils-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ils-green);
  animation: ils-dot-pulse 1.5s ease-in-out infinite;
}
@keyframes ils-dot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Suggested Chips ---- */
.ils-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
}
.ils-chip {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--ils-border);
  background: var(--ils-surface);
  color: var(--ils-text-70);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.ils-chip:hover {
  border-color: var(--ils-border-hover);
  background: var(--ils-surface-light);
  color: var(--ils-accent);
}

/* ---- Message Bubble ---- */
@keyframes ils-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ils-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: ils-msg-in 0.2s ease-out;
}
.ils-msg.ils-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ils-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ils-accent-dark), var(--ils-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.ils-msg-avatar svg {
  width: 14px;
  height: 14px;
}
.ils-msg-bubble {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ils-msg-content {
  padding: 10px 14px;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ils-text);
  word-break: break-word;
}
.ils-msg-user .ils-msg-content {
  background: linear-gradient(135deg, var(--ils-accent-dark), var(--ils-accent));
  border-bottom-right-radius: 4px;
}
.ils-msg-assistant .ils-msg-content {
  background: var(--ils-surface);
  border: 1px solid var(--ils-border);
  border-bottom-left-radius: 4px;
}
.ils-msg-time {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ils-text-30);
  padding: 0 4px;
}
.ils-msg-user .ils-msg-time {
  text-align: right;
}

/* Markdown inside messages */
.ils-msg-content p {
  margin: 0 0 8px;
}
.ils-msg-content p:last-child {
  margin-bottom: 0;
}
.ils-msg-content strong {
  font-weight: 600;
  color: #fff;
}
.ils-msg-content em {
  font-style: italic;
}
.ils-msg-content code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12.5px;
}
.ils-msg-content a {
  color: var(--ils-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ils-msg-content a:hover {
  opacity: 0.8;
}
.ils-msg-content ul,
.ils-msg-content ol {
  margin: 4px 0;
  padding-left: 18px;
}
.ils-msg-content li {
  margin-bottom: 3px;
}

/* ---- Typing Indicator ---- */
.ils-typing {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ils-typing-dots {
  display: flex;
  gap: 5px;
  padding: 14px 20px;
  background: var(--ils-surface-light);
  border: 1px solid var(--ils-border);
  border-radius: 20px;
  border-bottom-left-radius: 4px;
}
@keyframes ils-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-5px); opacity: 1; }
}
.ils-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ils-text-70);
  animation: ils-bounce 1.1s ease-in-out infinite;
}
.ils-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ils-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ---- Chat Input Area ---- */
.ils-input-area {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--ils-border);
  flex-shrink: 0;
}
.ils-input-outer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--ils-surface);
  border: 1px solid var(--ils-border);
  border-radius: 12px;
  padding: 4px 4px 4px 14px;
  transition: border-color 0.2s ease;
}
.ils-input-outer:focus-within {
  border-color: var(--ils-accent);
  box-shadow: 0 0 0 2px var(--ils-accent-glow);
}
.ils-input-area.ils-hidden {
  display: none !important;
}

/* ---- Ended Footer ---- */
.ils-ended-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--ils-border);
  flex-shrink: 0;
  display: none;
}
.ils-ended-footer.ils-visible {
  display: block;
}
.ils-start-new-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: #f02d5e;
  color: #fff;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.ils-start-new-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.ils-ended-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
  width: 100%;
}
.ils-ended-divider::before,
.ils-ended-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ils-border);
}
.ils-ended-divider span {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--ils-text-30);
  white-space: nowrap;
}
.ils-input-outer textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ils-text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 0;
  resize: none;
  max-height: 100px;
  overflow-y: auto;
}
.ils-input-outer textarea::placeholder {
  color: var(--ils-text-30);
}
.ils-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--ils-accent-dark), var(--ils-accent));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.ils-send-btn:hover:not(:disabled) {
  opacity: 0.85;
  transform: scale(1.05);
}
.ils-send-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.ils-char-count {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--ils-text-30);
  text-align: right;
  padding-top: 4px;
}
.ils-char-warn {
  color: #f59e0b;
}
.ils-char-danger {
  color: var(--ils-red);
}

/* ---- Toast ---- */
.ils-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ils-surface);
  color: var(--ils-text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--ils-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}
.ils-toast.ils-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Refresh Overlay ---- */
.ils-refresh-overlay {
  position: absolute;
  inset: 0;
  background: var(--ils-bg-glass);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.ils-refresh-overlay.ils-visible {
  opacity: 1;
  pointer-events: auto;
}
.ils-refresh-icon {
  width: 64px;
  height: 64px;
  color: var(--ils-accent);
  margin-bottom: 20px;
  animation: ils-spin 1s linear infinite;
}
.ils-refresh-text {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ils-text-70);
}
@keyframes ils-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---- End Chat Modal ---- */
.ils-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10005;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.ils-modal-backdrop.ils-visible {
  opacity: 1;
  pointer-events: auto;
}
.ils-modal {
  width: 90%;
  max-width: 320px;
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  color: #111;
  transform: scale(0.9);
  transition: transform 0.2s ease;
}
.ils-modal-backdrop.ils-visible .ils-modal {
  transform: scale(1);
}
.ils-modal h4 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
}
.ils-modal p {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #666;
  margin: 0 0 24px;
  line-height: 1.5;
}
.ils-modal-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.ils-modal-btn.ils-btn-danger {
  background: #d32f2f;
  color: #fff;
  margin-bottom: 8px;
}
.ils-modal-btn.ils-btn-light {
  background: #f1f3f4;
  color: #444;
}
.ils-modal-btn:hover {
  opacity: 0.9;
}

/* ---- Mobile Responsive ---- */
@media (max-width: 767px) {
  .ils-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border: none;
  }
  .ils-launcher {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
}
