﻿/* Bot variable aliases — map to main.css :root for consistent theming */
:root {
  --primary: var(--color-primary, #1a73e8);
  --primary-dark: var(--color-primary-dark, #0d47a1);
  --primary-darker: var(--color-primary-darker, #0a3778);
  --primary-lightest: var(--color-primary-lightest, #e8f0fe);
  --bg-white: #ffffff;
  --bg-light: var(--color-bg-soft, #f8f9fa);
  --text-dark: var(--color-text, #202124);
  --border: var(--color-border, #dadce0);
  --border-light: var(--color-border-light, #e8eaed);
  --whatsapp: var(--color-whatsapp, #25d366);
  --alert: var(--color-alert, #ea4335);
}
  .igchat-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 100;
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: 3px solid var(--bg-white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(26, 115, 232, 0.45);
    transition: var(--transition);
    padding: 0;
    animation: chat-pulse 3s infinite;
  }
  .igchat-trigger svg { width: 28px; height: 28px; fill: var(--bg-white); }
  .igchat-trigger:hover { transform: scale(1.08); box-shadow: 0 10px 30px rgba(26, 115, 232, 0.6); }
  .igchat-trigger .igchat-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 14px; height: 14px;
    background: var(--alert);
    border: 2px solid var(--bg-white);
    border-radius: 50%;
    animation: chat-dot-pulse 1.8s infinite;
  }
  .igchat-trigger.open { animation: none; }
  .igchat-trigger.open svg { display: none; }
  .igchat-trigger.open::before {
    content: "✕";
    color: var(--bg-white);
    font-size: 24px;
    font-weight: 300;
  }
  @keyframes chat-pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(26, 115, 232, 0.45); }
    50% { box-shadow: 0 8px 24px rgba(26, 115, 232, 0.45), 0 0 0 14px rgba(26, 115, 232, 0.12); }
  }
  @keyframes chat-dot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.85; }
  }
  .igchat-window {
    position: fixed;
    bottom: 105px;
    right: 28px;
    z-index: 99;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 580px;
    max-height: calc(100vh - 140px);
    background: var(--bg-white);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
    font-family: 'Heebo', sans-serif;
    direction: rtl;
  }
  .igchat-window.open {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  .igchat-header {
    background: linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 100%);
    color: var(--bg-white);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
  }
  .igchat-header-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.4);
    flex-shrink: 0;
    background: var(--bg-white);
  }
  .igchat-header-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
  .igchat-header-info { flex: 1; min-width: 0; }
  .igchat-header-info strong { display: block; font-size: 15px; font-family: 'Rubik', sans-serif; font-weight: 700; }
  .igchat-header-info span { font-size: 12px; opacity: 0.88; display: flex; align-items: center; gap: 6px; }
  .igchat-header-info .igchat-online-dot { width: 8px; height: 8px; background: #34a853; border-radius: 50%; box-shadow: 0 0 0 2px rgba(52, 168, 83, 0.3); }
  .igchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: var(--bg-light);
    scroll-behavior: smooth;
  }
  .igchat-messages::-webkit-scrollbar { width: 5px; }
  .igchat-messages::-webkit-scrollbar-track { background: transparent; }
  .igchat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  .igchat-msg {
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    animation: msg-in 0.3s ease-out;
  }
  @keyframes msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .igchat-msg.bot { align-items: flex-end; }
  .igchat-msg.user { justify-content: flex-start; flex-direction: row-reverse; }
  .igchat-msg-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-white);
    font-size: 13px;
    font-weight: 700;
    font-family: 'Rubik', sans-serif;
  }
  .igchat-msg.bot .igchat-msg-avatar { background: transparent; }
  .igchat-msg.bot .igchat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
  .igchat-bubble {
    max-width: 80%;
    padding: 11px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
  }
  .igchat-msg.bot .igchat-bubble {
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
    border-bottom-right-radius: 4px;
  }
  .igchat-msg.user .igchat-bubble {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--bg-white);
    border-bottom-left-radius: 4px;
  }
  .igchat-bubble strong { color: var(--primary-dark); font-weight: 700; }
  .igchat-msg.user .igchat-bubble strong { color: var(--bg-white); }
  .igchat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 8px 38px;
  }
  .igchat-suggestion {
    background: var(--bg-white);
    border: 1.5px solid var(--primary-lightest);
    color: var(--primary-dark);
    padding: 7px 14px;
    border-radius: 50px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    text-align: right;
    line-height: 1.3;
  }
  .igchat-suggestion:hover {
    background: var(--primary-lightest);
    border-color: var(--primary);
    transform: translateY(-1px);
  }
  .igchat-escalate {
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }
  .igchat-escalate-btn {
    flex: 1;
    padding: 9px 10px;
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    border: none;
    cursor: pointer;
  }
  .igchat-escalate-btn.wa {
    background: var(--whatsapp);
    color: var(--bg-white);
  }
  .igchat-escalate-btn.phone {
    background: var(--primary);
    color: var(--bg-white);
  }
  .igchat-escalate-btn.form {
    background: var(--bg-white);
    color: var(--primary-dark);
    border: 1.5px solid var(--border);
  }
  .igchat-escalate-btn svg { width: 14px; height: 14px; }
  .igchat-escalate-btn:hover { transform: translateY(-2px); opacity: 0.95; }
  .igchat-form {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    background: var(--bg-white);
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
  }
  .igchat-form input {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: var(--bg-light);
    direction: rtl;
  }
  .igchat-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
  }
  .igchat-form button {
    width: 40px; height: 40px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: var(--bg-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
  }
  .igchat-form button svg { width: 16px; height: 16px; }
  .igchat-form button:hover { background: var(--primary-dark); transform: scale(1.05); }
  .igchat-footer-note {
    padding: 8px 14px;
    background: #fffbeb;
    border-top: 1px solid #fde68a;
    font-size: 11.5px;
    color: #92400e;
    text-align: center;
    line-height: 1.5;
    flex-shrink: 0;
  }
  .igchat-typing {
    display: flex;
    gap: 4px;
    padding: 14px 18px;
  }
  .igchat-typing span {
    width: 7px; height: 7px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.5;
    animation: typing 1.2s infinite;
  }
  .igchat-typing span:nth-child(2) { animation-delay: 0.2s; }
  .igchat-typing span:nth-child(3) { animation-delay: 0.4s; }
  @keyframes typing {
    0%, 60%, 100% { transform: scale(1); opacity: 0.5; }
    30% { transform: scale(1.3); opacity: 1; }
  }
  @media (max-width: 480px) {
    .igchat-window { bottom: 95px; right: 10px; left: 10px; width: auto; height: calc(100vh - 120px); }
    .igchat-trigger { width: 58px; height: 58px; bottom: 20px; right: 20px; }
  }