/* ============================================
   AI CHAT ASSISTANT PRO - MODERN ANIMATIONS
   Version: 3.0 - Premium Edition
   ============================================ */

/* ============================================
   CHAT CONTAINER & BUTTON
   ============================================ */
#aica-chat-container {
    position: fixed;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#aica-chat-container.aica-position-right { right: 20px; }
#aica-chat-container.aica-position-left { left: 20px; }

/* Animated Chat Button */
#aica-chat-button {
    /* Larger bubble + resilient icon sizing (Elementor/themes often override img/button rules) */
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    padding: 0 !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    /* If the icon is rendered as a background-image, force its visible size */
    background-size: 66px 66px !important;
}

/* Pulse animation for attention */
#aica-chat-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: inherit;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    opacity: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.15); }
}

/* Hover effects */
#aica-chat-button:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

#aica-chat-button:active {
    transform: scale(0.95);
}

#aica-chat-button img {
    /* Bigger icon (some themes override img sizing) */
    width: 56px !important;
    height: 56px !important;
    object-fit: contain;
    max-width: none !important;
    max-height: none !important;
    transition: transform 0.3s ease;
    display: block;
}

/* Bigger default SVG icon too */
#aica-chat-button svg {
    width: 32px !important;
    height: 32px !important;
    display: block;
}

#aica-chat-button:hover img {
    transform: rotate(15deg) scale(1.1);
}

/* ============================================
   CHAT WINDOW - SLIDING ANIMATIONS
   ============================================ */
#aica-chat-window {
    position: fixed;
    bottom: 100px;
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#aica-chat-container.aica-position-right #aica-chat-window { right: 20px; }
#aica-chat-container.aica-position-left #aica-chat-window { left: 20px; }

#aica-chat-window.active {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}


/* ============================================
   HARD RESET INSIDE WIDGET (AVOID THEME OVERRIDES)
   ============================================ */
#aica-chat-window, 
#aica-chat-window * {
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#aica-chat-window h1,
#aica-chat-window h2,
#aica-chat-window h3,
#aica-chat-window h4,
#aica-chat-window p {
    margin: 0 !important;
}

#aica-chat-window button {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    line-height: 1;
}

#aica-chat-window svg {
    display: block !important;
}



/* Allow WordPress Dashicons inside widget (our hard reset overrides font-family) */
#aica-chat-window .dashicons,
#aica-chat-window .dashicons:before {
    font-family: dashicons !important;
    font-weight: normal !important;
    font-style: normal !important;
    speak: none !important;
    text-decoration: inherit !important;
    text-transform: none !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* ============================================
   AICA OVERRIDE GUARD
   Prevent Elementor/theme typography from overriding widget
   ============================================ */
#aica-chat-window .aica-header-content h3 {
    font-size: 17px !important;
    font-weight: 600 !important;
    letter-spacing: -0.2px !important;
    line-height: 1.2 !important;
    color: #ffffff !important;
}

#aica-chat-window .aica-header-content p {
    font-size: 12px !important;
    opacity: 0.9 !important;
    line-height: 1.2 !important;
    color: #ffffff !important;
}

#aica-chat-window .aica-step-content h3 {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    letter-spacing: -0.3px !important;
}

#aica-chat-window .aica-step-content p {
    font-size: 14px !important;
    color: #666 !important;
    line-height: 1.6 !important;
}

/* ============================================
   LARGE CHANNEL ICONS (WHATSAPP/EMAIL/CALL)
   ============================================ */
#aica-chat-window .aica-channel-icon-large{
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 6px auto 14px;
    color: var(--primary-color, #0084ff);
}

#aica-chat-window .aica-channel-icon-large svg{
    width: 34px;
    height: 34px;
    display: block;
}

/* WhatsApp gets its brand green */
#aica-chat-window #aica-step-whatsapp .aica-channel-icon-large{
    color: #25D366;
}

#aica-chat-window .aica-success-message{
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}



#aica-chat-window .aica-form-group label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

#aica-chat-window .aica-form-group input,
#aica-chat-window .aica-form-group textarea {
    font-size: 14px !important;
}

/* ============================================
   HEADER - GRADIENT & ANIMATIONS
   ============================================ */
.aica-chat-header {
    padding: 24px 20px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color, #0084ff) 0%, var(--primary-color-dark, #0066cc) 100%);
}

#aica-chat-window .aica-chat-header h3,
#aica-chat-window .aica-chat-header p {
    color: #ffffff !important;
}

/* Animated background gradient */
.aica-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: headerGlow 8s linear infinite;
    pointer-events: none;
}

@keyframes headerGlow {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(50%, 50%) rotate(360deg); }
}

.aica-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    position: relative;
    z-index: 1;
}

/* Animated Avatar */
.aica-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    animation: avatarBounce 2s ease-in-out infinite;
}

@keyframes avatarBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.aica-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aica-header-content h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.aica-header-content p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Online indicator pulse */
.aica-header-content p::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4caf50;
    animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

/* Close button with smooth transition */
.aica-close-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 0 !important; /* avoid theme padding */
    border-radius: 999px !important;
    opacity: 0.9;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
}


.aica-back-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}
.aica-close-button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.aica-close-button svg {
    display: block;
    pointer-events: none;
}

/* ============================================
   CONTENT AREA - SMOOTH TRANSITIONS
   ============================================ */
#aica-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #ffffff;
}

.aica-step {
    display: none;
    height: 100%;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.aica-step.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateX(0);
}

/* Specific fix for chat step */
#aica-step-chat {
    display: none;
}

#aica-step-chat.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.aica-step-content {
    padding: 28px 24px;
    overflow-y: auto;
    flex: 1;
}

.aica-step-content::-webkit-scrollbar {
    width: 6px;
}

.aica-step-content::-webkit-scrollbar-track {
    background: transparent;
}

.aica-step-content::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

.aica-step-content::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

.aica-step-content h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: -0.3px;
}

.aica-step-content p {
    margin: 0 0 24px;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================
   FORM ELEMENTS - MODERN INPUTS
   ============================================ */
.aica-form-group {
    margin-bottom: 20px;
}

.aica-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    letter-spacing: 0.2px;
}

.aica-form-group input,
.aica-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafafa;
}

.aica-form-group input:focus,
.aica-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color, #0084ff);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 132, 255, 0.1);
    transform: translateY(-1px);
}

.aica-form-group input::placeholder,
.aica-form-group textarea::placeholder {
    color: #999;
}

/* Animated Submit Button */
.aica-submit-button {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
}

.aica-submit-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.aica-submit-button:hover::before {
    width: 300px;
    height: 300px;
}

.aica-submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 132, 255, 0.4);
}

.aica-submit-button:active {
    transform: translateY(0);
}

/* ============================================
   CHANNEL SELECTION - CARD ANIMATIONS
   ============================================ */
#aica-channels-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 24px;
}

.aica-channel-option {
    background: #ffffff;
    border: 2px solid #f0f0f0;
    border-radius: 16px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.aica-channel-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color, #0084ff) 0%, var(--primary-color-dark, #0066cc) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.aica-channel-option:hover {
    border-color: var(--primary-color, #0084ff);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 132, 255, 0.2);
}

.aica-channel-option:hover::before {
    opacity: 0.05;
}

.aica-channel-option:active {
    transform: translateY(-2px) scale(0.98);
}

.aica-channel-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.aica-channel-option:hover .aica-channel-icon {
    transform: scale(1.1) rotate(5deg);
    background: linear-gradient(135deg, var(--primary-color, #0084ff) 0%, var(--primary-color-dark, #0066cc) 100%);
}

.aica-channel-icon .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #666;
    transition: color 0.3s ease;
}

.aica-channel-option:hover .aica-channel-icon .dashicons {
    color: #ffffff;
}

.aica-channel-option h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    position: relative;
    z-index: 1;
    letter-spacing: 0.2px;
}

/* ============================================
   CHAT MESSAGES - SMOOTH ANIMATIONS
   ============================================ */
.aica-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
    scroll-behavior: smooth;
    min-height: 0; /* Important for flex */
}

.aica-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.aica-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.aica-chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

.aica-message {
    margin-bottom: 16px;
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.aica-message.user {
    flex-direction: row-reverse;
}

.aica-message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: linear-gradient(135deg, #e8e8e8 0%, #d0d0d0 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.aica-message.assistant .aica-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aica-message-content {
    max-width: 75%;
    padding: 13px 18px;
    border-radius: 20px;
    line-height: 1.5;
    font-size: 14px;
    background: #ffffff;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    word-wrap: break-word;
}

.aica-message.assistant .aica-message-content {
    border-bottom-left-radius: 4px;
}

.aica-message.user .aica-message-content {
    background: linear-gradient(135deg, var(--primary-color, #0084ff) 0%, var(--primary-color-dark, #0066cc) 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 132, 255, 0.3);
}

/* ============================================
   TYPING INDICATOR - ANIMATED DOTS
   ============================================ */
.aica-typing {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.aica-typing.active {
    display: flex;
    animation: messageSlideIn 0.4s ease-out;
}

.aica-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 20px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.aica-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.aica-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.aica-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ============================================
   INPUT AREA - FLOATING SEND BUTTON
   ============================================ */
.aica-chat-input-area {
    padding: 16px 20px;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0; /* Never shrink */
    position: relative;
    z-index: 10;
}

#aica-message-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #f0f0f0;
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    min-height: 44px;
    transition: all 0.3s ease;
    background: #fafafa;
    line-height: 1.4;
}

#aica-message-input:focus {
    outline: none;
    border-color: var(--primary-color, #0084ff);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 132, 255, 0.1);
}

#aica-send-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 132, 255, 0.3);
    padding: 0;
}

#aica-send-button:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 16px rgba(0, 132, 255, 0.4);
}

#aica-send-button:active {
    transform: scale(0.95);
}

#aica-send-button svg {
    width: 20px;
    height: 20px;
    display: block;
}


/* ============================================
   MOBILE RESPONSIVE (CARD STYLE, NOT FULLSCREEN)
   ============================================ */
@media (max-width: 480px) {

    /* Respect iOS safe areas + keep floating button reachable */
    #aica-chat-container {
        bottom: calc(16px + env(safe-area-inset-bottom)) !important;
    }
    #aica-chat-container.aica-position-right { right: 16px !important; }
    #aica-chat-container.aica-position-left { left: 16px !important; }

    /* Chat window as a card with margins + rounded corners */
    #aica-chat-window {
        width: calc(100vw - 24px) !important;
        max-width: 420px !important;
        height: min(640px, calc(100dvh - 140px)) !important;
        max-height: calc(100dvh - 140px) !important;

        /* Keep above the floating bubble */
        bottom: calc(92px + env(safe-area-inset-bottom)) !important;

        /* Safe margins */
        left: 12px !important;
        right: 12px !important;

        border-radius: 22px !important;
        box-shadow: 0 14px 50px rgba(0, 0, 0, 0.25) !important;
    }

    /* Header sizing like your reference */
    .aica-chat-header {
        padding: 18px 16px !important;
    }

    .aica-avatar {
        width: 42px !important;
        height: 42px !important;
        animation: none !important; /* avoid jitter on mobile */
    }

    .aica-header-content h3 {
        font-size: 16px !important;
        line-height: 1.2 !important;
        max-width: 240px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .aica-header-content p {
        font-size: 12px !important;
        gap: 6px !important;
    }

    /* Back / Close buttons must stay circular (avoid theme styles) */
    .aica-close-button {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        border-radius: 999px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Content padding like the mock */
    .aica-step-content {
        padding: 22px 18px !important;
    }

    /* Single column channels on mobile */
    #aica-channels-list {
        grid-template-columns: 1fr !important;
    }

    /* Inputs spacing */
    .aica-form-group input {
        border-radius: 12px !important;
        padding: 12px 14px !important;
    }

    .aica-submit-button {
        border-radius: 12px !important;
        padding: 14px 16px !important;
    }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */
.aica-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.aica-slide-up {
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   SUCCESS/ERROR STATES
   ============================================ */
.aica-success-message,
.aica-error-message {
    padding: 12px 16px;
    border-radius: 12px;
    margin: 10px 0;
    animation: messageSlideIn 0.4s ease-out;
    font-size: 14px;
}

.aica-success-message {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.aica-error-message {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

/* ============================================
   HUMAN AGENT REQUEST BUTTON
   ============================================ */
.aica-human-agent-section {
    padding: 12px 20px;
    background: linear-gradient(to bottom, #ffffff 0%, #fafafa 100%);
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.aica-request-human-button {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.aica-request-human-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.aica-request-human-button:hover::before {
    width: 300px;
    height: 300px;
}

.aica-request-human-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.aica-request-human-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.aica-request-human-button .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.aica-request-human-button .button-text {
    position: relative;
    z-index: 1;
}

/* Button states */
.aica-request-human-button.waiting {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    cursor: wait;
}

.aica-request-human-button.waiting .dashicons {
    animation: pulseIcon 1.5s ease-in-out infinite;
}

.aica-request-human-button.connected {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.aica-request-human-button.unavailable {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
}

.aica-request-human-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Hide button when with agent */
.aica-step-chat.with-agent .aica-human-agent-section {
    display: none;
}

/* Agent connected indicator */
.aica-agent-indicator {
    display: none;
    padding: 10px 20px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.aica-agent-indicator.active {
    display: block;
}

.aica-agent-indicator .dashicons {
    vertical-align: middle;
    margin-right: 5px;
}


/* FORCE WHITE HEADER TEXT (theme-proof) */
#aica-chat-window .aica-chat-header h3,
#aica-chat-window .aica-chat-header p {
    color: #ffffff !important;
}

/* ============================================================
   VOICE ENGINE — botón micrófono + indicador de estado
   ============================================================ */

/* Botón de voz: mismo tamaño que send-button, tono neutro */
#aica-voice-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    border: 2px solid #e8e8e8;
    background: #f5f5f5;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s ease;
    padding: 0;
}

#aica-voice-button:hover {
    background: #ebebeb;
    border-color: #ccc;
    color: #555;
}

/* Modo voz activo: usa el color primario del plugin */
#aica-voice-button.aica-voice-active {
    background: var(--primary-color, #0084ff);
    border-color: var(--primary-color, #0084ff);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 132, 255, 0.35);
}

/* --- Estado ESCUCHANDO: pulso continuo --- */
#aica-voice-button.aica-voice-listening {
    background: var(--primary-color, #0084ff);
    border-color: var(--primary-color, #0084ff);
    color: #fff;
    animation: aica-mic-pulse 1.4s ease-in-out infinite;
}

@keyframes aica-mic-pulse {
    0%  { box-shadow: 0 0 0 0   rgba(0, 132, 255, 0.55); }
    60% { box-shadow: 0 0 0 10px rgba(0, 132, 255, 0);    }
    100%{ box-shadow: 0 0 0 0   rgba(0, 132, 255, 0);     }
}

/* --- Estado PROCESANDO: giro suave --- */
#aica-voice-button.aica-voice-processing {
    background: #ff9800;
    border-color: #ff9800;
    color: #fff;
    animation: aica-mic-spin 1s linear infinite;
}

@keyframes aica-mic-spin {
    to { transform: rotate(360deg); }
}

/* --- Estado RESPONDIENDO (TTS): onda --- */
#aica-voice-button.aica-voice-speaking {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
    animation: aica-speak-wave 0.7s ease-in-out infinite alternate;
}

@keyframes aica-speak-wave {
    from { transform: scale(1);    box-shadow: 0 2px 6px rgba(76,175,80,0.3); }
    to   { transform: scale(1.12); box-shadow: 0 4px 14px rgba(76,175,80,0.5); }
}

/* Indicador de texto sobre el input */
#aica-voice-indicator {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-align: center;
    padding: 4px 12px;
    border-radius: 12px;
    display: none;
    margin: 0 20px 4px;
    transition: all 0.2s ease;
}

#aica-voice-indicator.aica-vi-listening {
    background: rgba(0, 132, 255, 0.1);
    color: #0070e0;
}

#aica-voice-indicator.aica-vi-processing {
    background: rgba(255, 152, 0, 0.1);
    color: #e68000;
}

#aica-voice-indicator.aica-vi-speaking {
    background: rgba(76, 175, 80, 0.1);
    color: #388e3c;
}

/* ============================================================
   v2 REDESIGN — Header channels · Tabs · Voice tab · Voice orb
   ============================================================ */

/* ── Header layout ──────────────────────────────────────────── */
.aica-chat-header {
    flex-direction: column !important;
    padding-bottom: 0 !important;
    gap: 0 !important;
}

.aica-header-main {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 14px 16px 10px;
    box-sizing: border-box;
    gap: 8px;
}

/* ── Header channel buttons ─────────────────────────────────── */
.aica-header-channels {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px 10px;
    overflow-x: auto;
    scrollbar-width: none;
}
.aica-header-channels::-webkit-scrollbar { display: none; }

.aica-hchan-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.12);
    border: 1.5px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    transition: all 0.2s ease;
    min-width: 52px;
}
.aica-hchan-btn svg { flex-shrink: 0; }
.aica-hchan-btn span { line-height: 1; }
.aica-hchan-btn:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
    transform: translateY(-1px);
}
.aica-hchan-btn.active {
    background: rgba(255,255,255,0.25) !important;
    border-color: rgba(255,255,255,0.6) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ── Chat/Voice tabs ─────────────────────────────────────────── */
.aica-tabs {
    display: flex;
    border-bottom: 1.5px solid #f0f0f0;
    background: #fff;
    flex-shrink: 0;
    padding: 0 4px;
}

.aica-tab-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    font-size: 13px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1.5px;
    white-space: nowrap;
}
.aica-tab-btn:hover  { color: #555; }
.aica-tab-btn.active { color: #0084ff; border-bottom-color: #0084ff; }

.aica-tab-panel              { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.aica-tab-panel.active       { display: flex; }

/* Restore text panel messages area */
#aica-tab-text {
    height: 100%;
    overflow: hidden;
}
#aica-tab-text #aica-messages {
    flex: 1;
    overflow-y: auto;
}

/* ── Voice tab ───────────────────────────────────────────────── */
#aica-tab-voice { overflow-y: auto; }

.aica-voice-tab-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 24px;
    gap: 0;
    min-height: 100%;
    box-sizing: border-box;
}

/* Orb container + rings */
.aica-orb-container {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.aica-orb-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(0, 132, 255, 0.3);
    display: none;
    animation: orbRing 2s ease-out infinite;
}
.aica-orb-ring.r1 { width: 130px; height: 130px; animation-delay: 0s;    }
.aica-orb-ring.r2 { width: 152px; height: 152px; animation-delay: 0.5s;  }
.aica-orb-ring.r3 { width: 174px; height: 174px; animation-delay: 1.0s;  }

@keyframes orbRing {
    0%   { transform: scale(0.85); opacity: 0.9; }
    100% { transform: scale(1.2);  opacity: 0;   }
}

/* Central orb button */
.aica-voice-orb {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* color set by inline PHP */
}
.aica-voice-orb:hover  { transform: scale(1.06); }
.aica-voice-orb:active { transform: scale(0.96); }

/* Orb states */
.aica-voice-orb.orb-listening {
    animation: orbPulse 1.6s ease-in-out infinite;
}
@keyframes orbPulse {
    0%,100% { box-shadow: 0 6px 24px rgba(0,132,255,.45); }
    50%      { box-shadow: 0 6px 40px rgba(0,132,255,.75), 0 0 0 12px rgba(0,132,255,.12); }
}

.aica-voice-orb.orb-processing {
    animation: orbSpin 1.2s linear infinite;
}
@keyframes orbSpin {
    to { transform: rotate(360deg) scale(1.04); }
}

.aica-voice-orb.orb-speaking {
    animation: orbWave 0.7s ease-in-out infinite alternate;
}
@keyframes orbWave {
    from { transform: scale(1);    box-shadow: 0 4px 20px rgba(76,175,80,.4); }
    to   { transform: scale(1.1);  box-shadow: 0 8px 32px rgba(76,175,80,.65); }
}

/* Orb state colors */
.aica-voice-orb.orb-listening  { background: linear-gradient(135deg,#1565c0,#0084ff) !important; }
.aica-voice-orb.orb-processing { background: linear-gradient(135deg,#e65100,#ff9800) !important; box-shadow:0 6px 24px rgba(255,152,0,.5) !important; }
.aica-voice-orb.orb-speaking   { background: linear-gradient(135deg,#2e7d32,#4caf50) !important; box-shadow:0 6px 24px rgba(76,175,80,.5) !important; }

/* Status text */
.aica-orb-status {
    font-size: 14px;
    font-weight: 600;
    color: #444;
    margin: 4px 0 10px;
    text-align: center;
    min-height: 20px;
}

/* Mini transcript */
.aica-orb-transcript {
    width: 100%;
    min-height: 52px;
    background: #f7f8fa;
    border-radius: 12px;
    padding: 10px 14px;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.55;
    color: #444;
    text-align: center;
    margin-bottom: 14px;
    border: 1px solid #eee;
}
.aica-orb-transcript:empty::before {
    content: 'El texto de la conversación aparecerá aquí…';
    color: #bbb;
    font-style: italic;
}
.orb-user { color: #0060cc; font-style: italic; }
.orb-ai   { color: #333; }

/* Language selector */
.aica-voice-settings {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.aica-voice-settings label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #777;
    font-weight: 500;
}
.aica-voice-settings select {
    padding: 5px 8px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 12px;
    color: #444;
    background: #fafafa;
    cursor: pointer;
    outline: none;
}
.aica-voice-settings select:focus { border-color: #0084ff; }

/* Voice hint text */
.aica-voice-hint {
    font-size: 11px;
    color: #bbb;
    text-align: center;
    line-height: 1.6;
    margin: 0;
}

/* ── Mic button in text tab ─────────────────────────────────── */
#aica-voice-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    border: 1.5px solid #e0e0e0;
    background: #f5f5f5;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.2s ease;
}
#aica-voice-button:hover { background: #ebebeb; color: #555; }

#aica-voice-button.aica-voice-active   { background: #0084ff; border-color: #0084ff; color: #fff; }
#aica-voice-button.aica-voice-listening{ animation: aica-mic-pulse 1.4s ease-in-out infinite; background:#0084ff; border-color:#0084ff; color:#fff; }
#aica-voice-button.aica-voice-processing{ animation: aica-mic-spin 1s linear infinite; background:#ff9800; border-color:#ff9800; color:#fff; }
#aica-voice-button.aica-voice-speaking { animation: aica-speak-wave 0.7s ease-in-out infinite alternate; background:#4caf50; border-color:#4caf50; color:#fff; }

@keyframes aica-mic-pulse  { 0%{box-shadow:0 0 0 0 rgba(0,132,255,.55)}60%{box-shadow:0 0 0 10px rgba(0,132,255,0)}100%{box-shadow:0 0 0 0 rgba(0,132,255,0)} }
@keyframes aica-mic-spin   { to{transform:rotate(360deg)} }
@keyframes aica-speak-wave { from{transform:scale(1);box-shadow:0 2px 6px rgba(76,175,80,.3)}to{transform:scale(1.12);box-shadow:0 4px 14px rgba(76,175,80,.5)} }

/* Voice indicator strip */
#aica-voice-indicator { font-size:11px;font-weight:600;letter-spacing:.4px;text-align:center;padding:4px 12px;border-radius:12px;display:none;margin:0 20px 4px;transition:all .2s ease }
.aica-vi-listening { background:rgba(0,132,255,.1); color:#0070e0; }
.aica-vi-processing{ background:rgba(255,152,0,.1);  color:#e68000; }
.aica-vi-speaking  { background:rgba(76,175,80,.1);  color:#388e3c; }

/* Step-chat needs to be flex column for tabs */
#aica-step-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}


/* ============================================================
   CHANNEL BAR — icon-only pills below header
   ============================================================ */
.aica-channel-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px 8px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.aica-chan-pill {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--chan-color, #666);
    color: #fff;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 0;
    position: relative;
}
.aica-chan-pill:hover {
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}
.aica-chan-pill:active { transform: scale(0.95); }
.aica-chan-pill.active {
    border-color: #fff;
    box-shadow: 0 0 0 3px var(--chan-color, #666), 0 4px 12px rgba(0,0,0,0.2);
}

/* Tooltip on hover */
.aica-chan-pill::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.aica-chan-pill:hover::after { opacity: 1; }

/* Remove old header-channels styles */
.aica-header-channels { display: none !important; }

/* ============================================================
   MOBILE RESPONSIVE — full widget on small screens
   ============================================================ */
@media (max-width: 520px) {

    /* Full-screen chat on mobile */
    #aica-chat-window {
        width: 100vw !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        right: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        top: 0 !important;
        position: fixed !important;
    }

    #aica-chat-container.aica-position-right #aica-chat-window,
    #aica-chat-container.aica-position-left  #aica-chat-window {
        right: 0 !important;
        left:  0 !important;
        bottom: 0 !important;
    }

    /* Launcher button */
    #aica-chat-button {
        width: 52px !important;
        height: 52px !important;
        bottom: 16px !important;
        right: 16px !important;
    }

    /* Header */
    .aica-header-main { padding: 12px 12px 8px !important; }
    .aica-header-content h3 { font-size: 15px !important; }
    .aica-header-content p  { font-size: 11px !important; }

    /* Channel bar */
    .aica-channel-bar { gap: 8px; padding: 8px 12px 6px; }
    .aica-chan-pill { width: 40px; height: 40px; }

    /* Tabs */
    .aica-tab-btn { padding: 8px 12px; font-size: 12px; }

    /* Messages */
    .aica-chat-messages { padding: 12px !important; }
    .aica-message-content { font-size: 13px !important; max-width: 85% !important; }

    /* Input area */
    .aica-chat-input-area { padding: 10px 12px !important; gap: 8px !important; }
    #aica-message-input { font-size: 14px !important; padding: 10px 14px !important; }
    #aica-send-button { width: 40px !important; height: 40px !important; min-width: 40px !important; }
    #aica-voice-button { width: 36px !important; height: 36px !important; min-width: 36px !important; }

    /* Voice tab orb */
    .aica-voice-orb { width: 90px !important; height: 90px !important; }
    .aica-orb-container { width: 130px !important; height: 130px !important; }
    .aica-orb-ring.r1 { width: 105px !important; height: 105px !important; }
    .aica-orb-ring.r2 { width: 122px !important; height: 122px !important; }
    .aica-orb-ring.r3 { width: 139px !important; height: 139px !important; }

    /* Step content */
    .aica-step-content { padding: 16px !important; }
    .aica-form-group input { padding: 10px 12px !important; }

    /* Prevent iOS bounce scroll */
    #aica-chat-window { -webkit-overflow-scrolling: touch; }
    #aica-content { overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 380px) {
    .aica-tabs { gap: 0; }
    .aica-tab-btn { padding: 8px 10px; font-size: 11px; }
    .aica-chan-pill { width: 36px; height: 36px; }
}

/* ============================================================
   FIX v3 — Channel bar transparent + half-width + compact tabs
   ============================================================ */

/* Channel bar: transparent, centered, half width */
.aica-channel-bar {
    background: transparent !important;
    border-bottom: none !important;
    padding: 6px 0 4px !important;
    justify-content: center !important;
}

/* Pill group: limit to ~50% widget width, centered */
#aica-chat-window .aica-channel-bar {
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important;
    width: 100% !important;
}

/* Shrink pills: tighter, half the bar area */
.aica-chan-pill {
    width: 38px !important;
    height: 38px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,.18) !important;
    transition: transform .18s ease, box-shadow .18s ease !important;
}

/* Group pills together so they span ~50% */
.aica-channel-bar::before,
.aica-channel-bar::after {
    content: '';
    flex: 1;
}

/* Tab bar: icon-only Chat tab narrower, Voz IA tab keeps text */
.aica-tab-btn[data-tab="text"] {
    flex: 0 0 auto !important;
    min-width: 44px !important;
    padding: 10px 14px !important;
}
.aica-tab-btn[data-tab="voice"] {
    flex: 1 !important;
    padding: 10px 16px !important;
}

/* Tabs bar: subtle, no heavy border */
.aica-tabs {
    border-bottom: 1px solid #eee !important;
}

/* ============================================================
   FIX v4 — Clean design: transparent bar, fix orange square
   ============================================================ */

/* Kill the orange square: the active tab border was showing as a block */
.aica-tabs {
    background: transparent !important;
    border-bottom: none !important;
    padding: 0 8px !important;
    gap: 4px !important;
    align-items: center !important;
}

/* Both tabs: icon-sized, no text border artifact */
.aica-tab-btn {
    border-bottom: none !important;
    border-radius: 20px !important;
    padding: 5px 12px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #aaa !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    transition: all .2s !important;
    margin: 5px 0 !important;
}
.aica-tab-btn:hover { color: #555 !important; background: rgba(0,0,0,.05) !important; }
.aica-tab-btn.active {
    background: rgba(249,115,22,.12) !important;
    color: #ea6207 !important;
    border-bottom: none !important;
}

/* Chat tab: icon only - very compact */
.aica-tab-btn[data-tab="text"] {
    min-width: 36px !important;
    padding: 5px 10px !important;
    flex: 0 0 auto !important;
}

/* Voice tab: icon + text */
.aica-tab-btn[data-tab="voice"] { flex: 1 !important; }

/* Channel bar: fully transparent, centered pills */
.aica-channel-bar {
    background: transparent !important;
    border-bottom: none !important;
    padding: 6px 0 2px !important;
    gap: 12px !important;
    justify-content: center !important;
}
.aica-channel-bar::before,
.aica-channel-bar::after { content: ''; flex: 1; }

/* Pill reset - colors now set via inline style in JS */
.aica-chan-pill {
    width: 40px !important;
    height: 40px !important;
    background: #ccc !important; /* fallback only - JS overrides */
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #fff !important;
    transition: transform .18s ease !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}
.aica-chan-pill:hover { transform: translateY(-3px) scale(1.1) !important; }

/* Overall chat window: slightly transparent look */
#aica-chat-window {
    background: rgba(255,255,255,0.97) !important;
    backdrop-filter: blur(8px) !important;
}

/* ============================================================
   FIX v5 — Remove tab buttons, keep chat panel always active
   ============================================================ */
.aica-tabs          { display: none !important; }
#aica-tab-voice     { display: none !important; }
#aica-tab-text      { display: flex !important; flex-direction: column; flex: 1; overflow: hidden; }

/* ============================================================
   REDESIGN v6 — Clean modern look, remove back arrow, fix pills
   ============================================================ */

/* 1. Remove back arrow permanently */
#aica-back-button { display: none !important; }

/* 2. Fix pill color bug — remove !important from fallback */
.aica-chan-pill {
    background: #999 !important; /* JS inline style will override this */
}
/* Force inline style priority — this makes JS style="background:X" win */
#aica-chat-window .aica-channel-bar button[style] {
    background: revert !important; /* Safari/Chrome: let inline style win */
}

/* 3. Better header — more compact, cleaner */
.aica-chat-header {
    padding: 0 !important;
    flex-shrink: 0;
}
.aica-header-main {
    padding: 12px 16px 8px !important;
    min-height: 56px !important;
}
.aica-header-text h3 {
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: -0.3px !important;
}
.aica-header-content p {
    font-size: 11px !important;
    font-weight: 500 !important;
}

/* Online pulse animation */
.aica-header-content p::before {
    animation: onlinePulse 2s ease-in-out infinite !important;
}
@keyframes onlinePulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .6; transform: scale(1.3); }
}

/* 4. Messages area — cleaner bubbles */
.aica-chat-messages {
    background: #f7f8fa !important;
    padding: 16px 14px !important;
    gap: 12px !important;
}

/* AI bubble: white card */
.aica-message.assistant .aica-message-content {
    background: #ffffff !important;
    border: 1px solid #eceef0 !important;
    border-radius: 18px 18px 18px 4px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,.06) !important;
    color: #1a1a2e !important;
    font-size: 13.5px !important;
    line-height: 1.6 !important;
    padding: 10px 14px !important;
}

/* User bubble: orange */
.aica-message.user .aica-message-content {
    border-radius: 18px 18px 4px 18px !important;
    font-size: 13.5px !important;
    line-height: 1.6 !important;
    padding: 10px 14px !important;
}

/* Avatars smaller */
.aica-message-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
    margin-top: 4px !important;
}

/* 5. Input area — cleaner */
.aica-chat-input-area {
    padding: 10px 14px !important;
    background: #fff !important;
    border-top: 1px solid #eceef0 !important;
    gap: 8px !important;
}
#aica-message-input {
    border-radius: 22px !important;
    border: 1.5px solid #e2e5ea !important;
    background: #f7f8fa !important;
    font-size: 13px !important;
    padding: 10px 16px !important;
    transition: border-color .2s, background .2s !important;
}
#aica-message-input:focus {
    background: #fff !important;
    border-color: #f97316 !important;
    box-shadow: 0 0 0 3px rgba(249,115,22,.1) !important;
}

/* 6. Channel bar — transparent, pills with correct colors */
.aica-channel-bar {
    background: rgba(0,0,0,.03) !important;
    border-bottom: 1px solid rgba(0,0,0,.06) !important;
    padding: 7px 0 7px !important;
}
.aica-chan-pill {
    width: 38px !important;
    height: 38px !important;
}

/* 7. Typing indicator */
.aica-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 18px;
    border: 1px solid #eceef0;
    width: fit-content;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.aica-typing span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #bbb;
    display: inline-block;
    animation: typingDot 1.2s ease-in-out infinite;
}
.aica-typing span:nth-child(2) { animation-delay: .2s; }
.aica-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typingDot {
    0%,60%,100% { transform: translateY(0); background: #ccc; }
    30%          { transform: translateY(-6px); background: #999; }
}

/* 8. Chat window card shadow */
#aica-chat-window {
    box-shadow: 0 8px 40px rgba(0,0,0,.18), 0 0 0 0.5px rgba(0,0,0,.06) !important;
    border-radius: 20px !important;
}
