/* ============================================================
   ICA Chatbot Widget Styles
   ============================================================ */

:root {
  --ica-blue:       #1A3A6B;
  --ica-blue-dark:  #122a50;
  --ica-light-blue: #D5E8F0;
  --ica-white:      #FFFFFF;
  --ica-text-dark:  #1A1A1A;
  --ica-text-muted: #666666;
  --ica-success:    #2E7D32;
  --ica-error:      #c62828;
  --ica-radius:     12px;
  --ica-shadow:     0 4px 24px rgba(0,0,0,0.15);
  --font-primary:   'Inter', 'Arial', sans-serif;
}

/* ── Toggle Button ─────────────────────────────────────────── */
#ica-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--ica-blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--ica-shadow);
  z-index: 9998;
  transition: background 0.2s, transform 0.2s;
}
#ica-chat-toggle:hover {
  background: var(--ica-blue-dark);
  transform: scale(1.07);
}
#ica-chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: var(--ica-white);
  transition: opacity 0.15s;
}
#ica-chat-toggle .ica-icon-close { display: none; }
#ica-chat-toggle.open .ica-icon-chat  { display: none; }
#ica-chat-toggle.open .ica-icon-close { display: block; }

/* Unread badge */
#ica-chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #e53935;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
#ica-chat-badge.visible { display: block; }

/* ── Chat Panel ────────────────────────────────────────────── */
#ica-chat-panel {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: var(--ica-white);
  border-radius: var(--ica-radius);
  box-shadow: var(--ica-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9997;
  overflow: hidden;
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transition: transform 0.22s cubic-bezier(.4,0,.2,1), opacity 0.22s ease;
  font-family: var(--font-primary);
}
#ica-chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Panel Header ──────────────────────────────────────────── */
#ica-chat-header {
  background: var(--ica-blue);
  color: var(--ica-white);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.ica-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ica-light-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ica-avatar svg {
  width: 26px;
  height: 26px;
  fill: none;
  overflow: visible;
}
.ica-header-text { flex: 1; }
.ica-header-text strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}
.ica-header-text span {
  font-size: 0.75rem;
  opacity: 0.8;
}
#ica-chat-header button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  font-size: 1.3rem;
  border-radius: 4px;
  transition: color 0.15s;
}
#ica-chat-header button:hover { color: #fff; }

/* ── Messages Area ─────────────────────────────────────────── */
#ica-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
#ica-messages::-webkit-scrollbar { width: 4px; }
#ica-messages::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Bubbles */
.ica-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.875rem;
  line-height: 1.5;
  word-break: break-word;
}
.ica-msg.bot {
  background: var(--ica-light-blue);
  color: var(--ica-text-dark);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.ica-msg.user {
  background: var(--ica-blue);
  color: var(--ica-white);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Typing indicator */
.ica-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--ica-light-blue);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}
.ica-typing span {
  width: 7px;
  height: 7px;
  background: var(--ica-blue);
  border-radius: 50%;
  animation: ica-bounce 1.2s infinite ease-in-out;
}
.ica-typing span:nth-child(2) { animation-delay: 0.2s; }
.ica-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ica-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Lead Capture Form ─────────────────────────────────────── */
.ica-lead-form {
  background: #f7fafd;
  border: 1px solid var(--ica-light-blue);
  border-radius: var(--ica-radius);
  padding: 14px;
  margin-top: 4px;
  align-self: stretch;
}
.ica-lead-form p {
  font-size: 0.8rem;
  color: var(--ica-text-muted);
  margin-bottom: 10px;
}
.ica-lead-form input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #c8d8e8;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--font-primary);
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.15s;
}
.ica-lead-form input:focus { border-color: var(--ica-blue); }
.ica-lead-form input::placeholder { color: #aaa; }
.ica-lead-form button {
  width: 100%;
  padding: 9px;
  background: var(--ica-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-primary);
  transition: background 0.2s;
}
.ica-lead-form button:hover { background: var(--ica-blue-dark); }
.ica-lead-form button:disabled { opacity: 0.6; cursor: default; }
.ica-lead-error {
  font-size: 0.78rem;
  color: var(--ica-error);
  margin-top: -4px;
  margin-bottom: 6px;
  display: none;
}
.ica-lead-success {
  font-size: 0.85rem;
  color: var(--ica-success);
  font-weight: 600;
  text-align: center;
  padding: 8px 0 4px;
}

/* ── WhatsApp Button ───────────────────────────────────────── */
.ica-wa-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-primary);
  text-decoration: none;
  align-self: flex-start;
  margin-top: 2px;
  transition: background 0.2s;
}
.ica-wa-btn:hover { background: #1ebe5d; }
.ica-wa-btn svg { width: 18px; height: 18px; fill: #fff; flex-shrink: 0; }

/* ── Input Row ─────────────────────────────────────────────── */
#ica-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e8eef4;
  flex-shrink: 0;
  background: #fff;
}
#ica-user-input {
  flex: 1;
  border: 1px solid #c8d8e8;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 0.875rem;
  font-family: var(--font-primary);
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.15s;
}
#ica-user-input:focus { border-color: var(--ica-blue); }
#ica-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ica-blue);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  transition: background 0.2s;
}
#ica-send-btn:hover { background: var(--ica-blue-dark); }
#ica-send-btn:disabled { opacity: 0.5; cursor: default; }
#ica-send-btn svg { width: 18px; height: 18px; fill: #fff; }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #ica-chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    transform-origin: bottom center;
  }
  #ica-chat-toggle {
    bottom: 16px;
    right: 16px;
  }
}
