/* India Enterprises AI Sales Assistant — chatbot widget styles.
 * Loaded globally via /public/index.html. All classes are namespaced
 * with `ie-` so nothing inside our React app can be affected.
 */
:root {
  --ie-blue:      #0057B7;   /* brand primary */
  --ie-blue2:     #003E82;   /* deep brand */
  --ie-blue-lite: #E7F0FB;   /* subtle brand tint */
  --ie-deep:      #0B1F4D;
  --ie-light:     #F4F8FF;
  --ie-border:    #DBE6F8;
  --ie-text:      #12213F;
  --ie-muted:     #6E7D98;
  --ie-green:     #1D9C5A;
  --ie-wa:        #25D366;
  --ie-wa-dark:   #1EBE57;
}

#ie-chat-launcher,
#ie-chat-window,
#ie-chat-mini {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Arial, sans-serif;
  box-sizing: border-box;
}

/* ============================================================
 * Minimised tab (default state) — replaces the old round bubble.
 * Small, unobtrusive pill anchored bottom-right that expands to
 * the full chat window when clicked.
 * ============================================================ */
#ie-chat-mini {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999998;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px 11px 12px;
  background: linear-gradient(135deg, var(--ie-blue), var(--ie-blue2));
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    0 10px 22px rgba(0, 62, 130, 0.28),
    0 2px 4px rgba(0, 62, 130, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#ie-chat-mini:hover {
  transform: translateY(-1px);
  box-shadow:
    0 14px 28px rgba(0, 62, 130, 0.32),
    0 3px 6px rgba(0, 62, 130, 0.2);
}
#ie-chat-mini .ie-mini-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #7DF9FF;
  box-shadow: 0 0 0 2px rgba(125, 249, 255, 0.35);
  animation: ieMiniPulse 2s ease-in-out infinite;
}
@keyframes ieMiniPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.85); }
}
#ie-chat-mini .ie-mini-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
#ie-chat-mini .ie-mini-badge img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Chat window — hidden by default; the mini pill toggles it. */
#ie-chat-window {
  position: fixed;
  z-index: 999999;
  width: min(390px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 115px));
  background: white;
  border: 1px solid var(--ie-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(9, 35, 90, 0.28);
  display: none;
  flex-direction: column;
  /* JS sets `right` + `bottom` inline based on drag position. Defaults: */
  right: 22px;
  bottom: 84px;
}
#ie-chat-window.ie-open { display: flex; }

/* ============================================================
 * Header — draggable region + minimise + close controls.
 * ============================================================ */
.ie-chat-header {
  background: linear-gradient(135deg, var(--ie-blue), var(--ie-blue2));
  color: white;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.ie-chat-header.ie-dragging { cursor: grabbing; }

.ie-logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: white;
  color: var(--ie-blue);
  display: grid;
  place-items: center;
  font-weight: 900;
  flex-shrink: 0;
}
.ie-chat-header-title { font-weight: 800; font-size: 16px; line-height: 1.15; }
.ie-chat-header-sub   { font-size: 12px; opacity: 0.88; margin-top: 2px; }
.ie-chat-header-controls {
  margin-left: auto;
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.ie-chat-header-controls button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.ie-chat-header-controls button:hover { background: rgba(255, 255, 255, 0.2); }
.ie-chat-header-controls svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================
 * Message list
 * ============================================================ */
.ie-chat-messages {
  flex: 1;
  overflow-y: auto;
  background: #F8FBFF;
  padding: 13px;
}
.ie-msg {
  max-width: 85%;
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.ie-msg.bot  {
  background: white;
  color: var(--ie-text);
  border: 1px solid var(--ie-border);
  border-bottom-left-radius: 5px;
}
.ie-msg.user {
  margin-left: auto;
  background: var(--ie-blue);
  color: white;
  border-bottom-right-radius: 5px;
}
.ie-typing { opacity: 0.65; font-style: italic; }
.ie-source-row {
  font-size: 11px;
  margin: -2px 0 8px 2px;
  max-width: 88%;
  color: var(--ie-muted);
}
.ie-source-row a { color: #46658E; text-decoration: none; margin-right: 7px; }
.ie-source-row a:hover { text-decoration: underline; }

/* Quick-action chips */
.ie-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 13px 10px;
  background: #F8FBFF;
}
.ie-quick-actions button {
  border: 1px solid #BCD0F5;
  background: white;
  color: #174CA9;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ie-quick-actions button:hover {
  background: var(--ie-blue-lite);
  border-color: var(--ie-blue);
}

/* ============================================================
 * Primary action stack (new — 02 Feb 2026)
 *   Row 1: Chat with India Enterprises  (gradient primary CTA)
 *   Row 2: Call Now                     (secondary — brand outline)
 *   Row 3: Request Quote  |  WhatsApp Sales
 * ============================================================ */
.ie-primary-actions {
  padding: 12px 12px 6px;
  border-top: 1px solid var(--ie-border);
  background: white;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ie-primary-cta {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, var(--ie-blue) 0%, var(--ie-blue2) 100%);
  box-shadow:
    0 8px 20px rgba(0, 87, 183, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.ie-primary-cta:hover {
  transform: translateY(-1px);
  box-shadow:
    0 12px 26px rgba(0, 87, 183, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.ie-primary-cta:active { transform: translateY(0); }
.ie-primary-cta svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ie-call-cta {
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ie-blue2);
  background: var(--ie-blue-lite);
  border: 1px solid #C6DBF3;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ie-call-cta:hover {
  background: #D8E7F8;
  border-color: var(--ie-blue);
}
.ie-call-cta svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ie-action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 12px 8px;
  background: white;
}
.ie-action-bar button,
.ie-action-bar a {
  text-align: center;
  border-radius: 10px;
  padding: 9px 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.ie-action-bar svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ie-quote-btn {
  border: 1px solid var(--ie-blue);
  background: white;
  color: var(--ie-blue2);
}
.ie-quote-btn:hover { background: var(--ie-blue-lite); }
.ie-whatsapp-btn {
  border: 1px solid #9CD6B5;
  color: #137A43;
  background: #F1FFF7;
}
.ie-whatsapp-btn:hover { background: #DFF7EA; border-color: var(--ie-wa); }

/* ============================================================
 * Chat form + footer
 * ============================================================ */
.ie-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: white;
  border-top: 1px solid var(--ie-border);
}
.ie-chat-form textarea {
  flex: 1;
  height: 42px;
  max-height: 100px;
  resize: none;
  border: 1px solid #CCD9EE;
  border-radius: 11px;
  padding: 10px;
  outline: none;
  font: inherit;
  color: var(--ie-text);
}
.ie-chat-form textarea:focus { border-color: var(--ie-blue); }
.ie-chat-form button {
  border: 0;
  border-radius: 11px;
  background: var(--ie-blue);
  color: white;
  padding: 0 15px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.15s ease;
}
.ie-chat-form button:hover { background: var(--ie-blue2); }
.ie-chat-footer {
  padding: 5px 12px 10px;
  font-size: 11px;
  text-align: center;
  color: var(--ie-muted);
  background: white;
}

/* ============================================================
 * Lead-form modal
 * ============================================================ */
.ie-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  background: rgba(8, 24, 58, 0.42);
  display: grid;
  place-items: center;
  padding: 16px;
}
.ie-lead-modal {
  width: min(440px, calc(100vw - 32px));
  background: white;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
}
.ie-lead-modal h3 { margin: 0 0 5px; color: var(--ie-deep); }
.ie-lead-modal p  { margin: 0 0 13px; font-size: 13px; color: var(--ie-muted); }
.ie-lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ie-lead-grid .full { grid-column: 1 / -1; }
.ie-lead-modal input,
.ie-lead-modal textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #CCD9EE;
  border-radius: 9px;
  padding: 10px;
  font: inherit;
  font-size: 13px;
}
.ie-lead-modal textarea { min-height: 85px; resize: vertical; }
.ie-lead-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}
.ie-lead-actions button {
  border-radius: 9px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 700;
}
.ie-cancel { background: white; border: 1px solid #CCD9EE; color: var(--ie-text); }
.ie-submit { background: var(--ie-blue); border: 0; color: white; }
.ie-submit:hover { background: var(--ie-blue2); }
.ie-lead-status { font-size: 12px; margin-top: 8px; color: var(--ie-green); }

/* ============================================================
 * Mobile (≤ 520 px) — full-width chat, compact minimised pill.
 * ============================================================ */
@media (max-width: 520px) {
  #ie-chat-mini {
    right: 12px;
    bottom: 12px;
    padding: 9px 14px 9px 10px;
    font-size: 13px;
  }
  #ie-chat-window {
    right: 10px !important;
    left: 10px !important;
    top: 60px !important;
    bottom: 12px !important;
    width: auto !important;
    height: auto !important;
    max-width: none;
  }
  /* On mobile we disable free dragging entirely — the window snaps
     to fill the screen so users can't drag it into a broken spot. */
  .ie-chat-header { cursor: default; }
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  #ie-chat-mini,
  .ie-primary-cta,
  .ie-call-cta,
  .ie-quick-actions button,
  .ie-action-bar button,
  .ie-action-bar a {
    transition: none;
  }
  #ie-chat-mini .ie-mini-dot { animation: none; }
}
