/* ============================================
   ZENTER BOT - AI CHATBOT STYLES (FIXED)
   ============================================ */

/* Chatbot Trigger */
.chatbot-trigger {
    position: fixed;
    bottom: 32px;
    left: 32px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .chatbot-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6C63FF 0%, #00D4AA 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 8px 32px rgba(108, 99, 255, 0.5);
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    animation: chatbotPulse 3s ease infinite;
    flex-shrink: 0;
  }
  
  .chatbot-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(108, 99, 255, 0.6);
  }
  
  .chatbot-btn .bot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: #00D4AA;
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: white;
    animation: badgePing 2s ease infinite;
  }
  
  .chatbot-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px 14px 14px 4px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    box-shadow: var(--shadow-md);
    max-width: 190px;
    animation: bubbleFloat 3s ease-in-out infinite;
    cursor: pointer;
    white-space: nowrap;
  }
  
  .chatbot-bubble strong {
    color: var(--primary);
    display: block;
    font-size: 0.75rem;
  }
  
  /* ============================================
     CHATBOT WINDOW — FULLY SCROLLABLE FIX
     ============================================ */
  .chatbot-window {
    position: fixed;
    bottom: 100px;
    left: 32px;
    width: 360px;
  
    /* KEY FIX: use viewport height, not fixed height */
    height: auto;
    max-height: calc(100vh - 130px);
  
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  
    /* KEY FIX: flex column so each part sizes correctly */
    display: flex;
    flex-direction: column;
  
    z-index: 600;
    overflow: hidden;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom left;
  }
  
  .chatbot-window.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  /* ============================================
     CHATBOT HEADER — fixed height, no shrink
     ============================================ */
  .chatbot-header {
    background: linear-gradient(135deg, #6C63FF 0%, #5A52D5 100%);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0; /* never shrink */
    min-height: 70px;
  }
  
  .chatbot-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
  }
  
  .chatbot-header-info { flex: 1; min-width: 0; }
  
  .chatbot-header-info h4 {
    font-family: 'Poppins', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: white;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .chatbot-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.8);
  }
  
  .status-dot {
    width: 7px;
    height: 7px;
    background: #00D4AA;
    border-radius: 50%;
    animation: statusPulse 2s ease infinite;
    flex-shrink: 0;
  }
  
  .chatbot-header-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
  }
  
  .chatbot-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
  }
  
  .chatbot-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
  }
  
  /* ============================================
     LANGUAGE BAR — fixed height, no shrink
     ============================================ */
  .chatbot-lang-bar {
    background: var(--bg-secondary);
    padding: 7px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0; /* never shrink */
    overflow-x: auto;
    scrollbar-width: none;
    min-height: 38px;
  }
  
  .chatbot-lang-bar::-webkit-scrollbar { display: none; }
  
  .lang-btn {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-muted);
    white-space: nowrap;
    transition: all 0.2s;
    flex-shrink: 0;
  }
  
  .lang-btn.active,
  .lang-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }
  
  /* ============================================
     MESSAGES AREA — flex: 1, scrollable
     ============================================ */
  .chatbot-messages {
    flex: 1;          /* takes all remaining space */
    overflow-y: auto; /* scroll when content overflows */
    overflow-x: hidden;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    min-height: 0;    /* critical for flex overflow fix */
  }
  
  .chatbot-messages::-webkit-scrollbar { width: 3px; }
  .chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
  }
  
  /* ============================================
     MESSAGE BUBBLES
     ============================================ */
  .chat-message {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    animation: messageSlideIn 0.3s ease;
  }
  
  .chat-message.user {
    flex-direction: row-reverse;
  }
  
  .msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
  }
  
  .bot-avatar-msg {
    background: linear-gradient(135deg, #6C63FF, #00D4AA);
    color: white;
  }
  
  .user-avatar-msg {
    background: var(--primary);
    color: white;
  }
  
  .msg-bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.83rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
  }
  
  .bot-bubble {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-light);
  }
  
  .user-bubble {
    background: linear-gradient(135deg, #6C63FF, #5A52D5);
    color: white;
    border-bottom-right-radius: 4px;
  }
  
  .msg-time {
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 3px;
    display: block;
  }
  
  .user .msg-time { text-align: right; }
  
  /* Quick Reply Chips */
  .quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
  }
  
  .quick-chip {
    padding: 5px 12px;
    background: var(--primary-glow);
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
  }
  
  .quick-chip:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
  }
  
  /* Typing Indicator */
  .typing-indicator {
    display: flex;
    gap: 8px;
    align-items: flex-end;
  }
  
  .typing-dots {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px 16px 16px 4px;
    padding: 10px 14px;
    display: flex;
    gap: 4px;
    align-items: center;
  }
  
  .typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    animation: typingBounce 1.2s ease infinite;
    opacity: 0.4;
  }
  
  .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
  .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
  
  /* Bot Card */
  .bot-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 14px;
    overflow: hidden;
    margin-top: 6px;
    box-shadow: var(--shadow-sm);
    width: 100%;
  }
  
  .bot-card-header {
    background: linear-gradient(135deg, rgba(108,99,255,0.12), rgba(0,212,170,0.12));
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-light);
  }
  
  .bot-card-header i { color: var(--primary); font-size: 0.9rem; }
  .bot-card-header strong { font-size: 0.85rem; color: var(--text-primary); }
  
  .bot-card-body { padding: 10px 14px; }
  
  .bot-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8rem;
    gap: 8px;
  }
  
  .bot-card-row:last-child { border: none; }
  .bot-card-row span:first-child { color: var(--text-muted); flex-shrink: 0; }
  .bot-card-row span:last-child { font-weight: 600; color: var(--text-primary); text-align: right; }
  .bot-card-row .price-highlight { color: var(--primary); }
  
  .bot-card-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #6C63FF, #5A52D5);
    color: white;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-family: 'Inter', sans-serif;
  }
  
  .bot-card-btn:hover { opacity: 0.9; }
  
  /* Voice Button */
  .voice-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    flex-shrink: 0;
  }
  
  .voice-btn:hover { background: var(--primary); color: white; }
  .voice-btn.listening {
    background: var(--accent);
    color: white;
    animation: voicePulse 1s ease infinite;
  }
  
  /* ============================================
     CHATBOT FOOTER — fixed height, no shrink
     ============================================ */
  .chatbot-footer {
    padding: 12px 14px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
    flex-shrink: 0; /* never shrink */
  }
  
  .chatbot-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  
  .chatbot-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--border-light);
    border-radius: 22px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    min-width: 0;
  }
  
  .chatbot-input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px var(--primary-glow);
  }
  
  .chatbot-input::placeholder { color: var(--text-muted); font-size: 0.82rem; }
  
  .chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6C63FF, #5A52D5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--primary-glow);
  }
  
  .chatbot-send:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--primary-glow);
  }
  
  .chatbot-powered {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 6px;
  }
  
  .chatbot-powered span { color: var(--primary); font-weight: 600; }
  
  /* ============================================
     ANIMATIONS
     ============================================ */
  @keyframes chatbotPulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(108, 99, 255, 0.5); }
    50% { box-shadow: 0 8px 48px rgba(108, 99, 255, 0.8), 0 0 0 10px rgba(108, 99, 255, 0.08); }
  }
  
  @keyframes badgePing {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
  }
  
  @keyframes bubbleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
  }
  
  @keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
  }
  
  @keyframes messageSlideIn {
    from { transform: translateY(8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  
  @keyframes typingBounce {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-5px); opacity: 1; }
  }
  
  @keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
  }
  
  /* ============================================
     RESPONSIVE
     ============================================ */
  @media (max-width: 767px) {
    .chatbot-window {
      width: calc(100vw - 24px);
      left: 12px;
      right: 12px;
      bottom: 90px;
      max-height: calc(100vh - 110px);
      border-radius: 16px;
    }
  
    .chatbot-trigger {
      left: 16px;
      bottom: 20px;
    }
  
    .chatbot-bubble { display: none; }
  
    .chatbot-btn {
      width: 50px;
      height: 50px;
      font-size: 1.1rem;
    }
  }
  
  @media (max-width: 380px) {
    .chatbot-window {
      width: calc(100vw - 16px);
      left: 8px;
    }
  }
  
  /* Dark mode specific */
  [data-theme="dark"] .bot-bubble {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  [data-theme="dark"] .chatbot-lang-bar {
    background: rgba(255, 255, 255, 0.04);
  }