/* =========================================================
   WP AI AGENT - FINAL STYLESHEET (V5.9)
   Includes: Size Fix for Inner Pages
   ========================================================= */

#wpaa-chat-window, #wpaa-chat-window * { box-sizing: border-box; font-family: inherit; }

/* 1. GLOBAL RESET & LINKS */
#wpaa-chat-window a { text-decoration: none; transition: opacity 0.2s; }
#wpaa-chat-window a:hover { opacity: 0.8; }

/* 2. SHARED COMPONENTS */
.wpaa-widget-container { position: fixed; bottom: 30px; right: 30px; z-index: 999999; }

.wpaa-launcher { cursor: pointer; transition: transform 0.3s; }
.wpaa-launcher:hover { transform: scale(1.1); }

.wpaa-launcher-circle {
    width: 65px; height: 65px; background-color: #0073aa; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.wpaa-launcher-circle svg { width: 32px; height: 32px; fill: white; }

/* --- התיקון לבאג הגודל בעמודים פנימיים --- */
.wpaa-launcher-custom-img {
    width: 120px !important;      /* חובה כדי למנוע מריחה */
    max-width: 120px !important;  /* הגנה כפולה */
    height: auto !important;      /* שמירה על פרופורציה */
    display: block;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.25));
}

/* 3. MESSAGES AREA */
.wpaa-messages-area {
    flex: 1; overflow-y: auto;
    display: flex; flex-direction: column; gap: 15px;
    padding-left: 10px; margin-bottom: 15px;
}
.wpaa-messages-area::-webkit-scrollbar { width: 6px; }
.wpaa-messages-area::-webkit-scrollbar-thumb { background-color: #e2e8f0; border-radius: 10px; }

/* 4. MESSAGE BUBBLES */
.wpaa-msg {
    padding: 14px 20px; border-radius: 18px;
    font-size: 15px; line-height: 1.6;
    max-width: 90%; position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    word-wrap: break-word;
}
.wpaa-msg.bot { background: #f7fafc; color: #2d3748; align-self: flex-start; border-bottom-right-radius: 2px; }
.wpaa-msg.user { background: #0073aa; color: white; align-self: flex-end; border-bottom-left-radius: 2px; font-weight: 500; }

/* Content Styling (Lists, Paragraphs) */
.wpaa-msg.bot p { margin: 0 0 10px 0; }
.wpaa-msg.bot p:last-child { margin-bottom: 0; }
.wpaa-msg.bot strong, .wpaa-msg.bot b { font-weight: 700; color: #1a202c; }

.wpaa-msg.bot ul, .wpaa-msg.bot ol {
    margin: 8px 0 15px 0 !important;
    padding: 0 !important;
    list-style: none !important;
}
.wpaa-msg.bot li {
    position: relative; padding-right: 20px; margin-bottom: 6px; line-height: 1.5;
}
.wpaa-msg.bot li::before {
    content: "•"; position: absolute; right: 0; top: 0;
    color: #0073aa; font-weight: bold; font-size: 18px; line-height: 1;
}
.wpaa-ltr .wpaa-msg.bot li { padding-right: 0; padding-left: 20px; }
.wpaa-ltr .wpaa-msg.bot li::before { right: auto; left: 0; }

.wpaa-product-img {
    max-width: 120px; height: auto; border-radius: 8px; margin: 10px 0; display: block;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); border: 1px solid #eee;
}
.wpaa-msg.bot a { text-decoration: underline; font-weight: bold; }

/* 5. PRELOADER */
.wpaa-large-loader-container { display: none; justify-content: center; padding: 20px; }
.wpaa-ripple-loader { display: inline-block; position: relative; width: 60px; height: 60px; }
.wpaa-ripple-loader div {
    position: absolute; border: 4px solid #0073aa; opacity: 1; border-radius: 50%;
    animation: wpaa-ripple 1.5s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}
.wpaa-ripple-loader div:nth-child(2) { animation-delay: -0.5s; }
@keyframes wpaa-ripple {
    0% { top: 28px; left: 28px; width: 4px; height: 4px; opacity: 0; }
    5% { opacity: 1; }
    100% { top: 0; left: 0; width: 60px; height: 60px; opacity: 0; }
}

/* 6. SUGGESTIONS & CUSTOM BUTTONS */
.wpaa-suggestions-container { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.wpaa-suggestion-chip {
    padding: 6px 12px; border-radius: 20px; font-size: 13px; cursor: pointer;
    background: #fff; border: 1px solid #0073aa; color: #0073aa; white-space: nowrap;
}
.wpaa-custom-link-btn { font-weight: bold; margin-bottom: 5px; }

/* 7. INPUT AREA */
.wpaa-input-inner {
    background: #f1f5f9; border-radius: 50px; padding: 5px 5px 5px 15px;
    display: flex; align-items: center; width: 100%; border: 1px solid #e2e8f0;
}
.wpaa-input-inner:focus-within { border-color: rgba(0,115,170,0.5); background: #fff; }

.wpaa-input-inner input {
    flex: 1; border: none !important; background: transparent !important;
    outline: none !important; font-size: 15px; color: #333;
    padding: 0 !important; margin: 0 !important; box-shadow: none !important;
}
.wpaa-input-inner button {
    width: 36px; height: 36px; border-radius: 50%; background: #0073aa;
    border: none; color: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center; padding: 0; margin: 0;
}

.wpaa-action-icon { color: #a0aec0; cursor: pointer; font-size: 18px; margin: 0 5px; }
.wpaa-action-icon:hover { color: #4a5568; }

/* 8. LEAD FORM */
.wpaa-lead-form-inline { background: #f8fafc; padding: 15px; border-radius: 10px; text-align: center; border: 1px solid #edf2f7; }
.wpaa-lead-form-inline h3 { margin-top: 0; font-size: 18px; }
.wpaa-lead-form-inline input { width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid #cbd5e0; border-radius: 4px; }
.wpaa-lead-submit { width: 100%; padding: 8px; border: none; border-radius: 4px; color: white; font-weight: bold; cursor: pointer; }


/* =========================================
   MODE 1: POPUP (Centered, Large)
   ========================================= */
.wpaa-mode-popup {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -45%) scale(0.9);
    width: 65%; min-width: 600px; max-width: 1100px; height: 600px;
    z-index: 999999; opacity: 0; pointer-events: none;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex; align-items: center; justify-content: center; overflow: visible;
}
.wpaa-mode-popup.active { opacity: 1; pointer-events: all; transform: translate(-50%, -50%) scale(1); }

.wpaa-mode-popup .wpaa-chat-card {
    background: #fff; width: 100%; height: 100%; border-radius: 30px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    display: flex; flex-direction: column;
    padding: 40px 300px 30px 40px !important; 
    position: relative; border: 1px solid rgba(0,0,0,0.05);
}
.wpaa-ltr .wpaa-mode-popup .wpaa-chat-card { padding: 40px 40px 30px 300px !important; }

.wpaa-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 999998; opacity: 0; pointer-events: none; transition: opacity 0.3s; backdrop-filter: blur(3px); }
.wpaa-overlay.active { opacity: 1; pointer-events: all; }

.wpaa-mascot-img { position: absolute; right: -40px; bottom: 0; height: auto; max-height: 95%; max-width: 350px; z-index: 10; opacity: 0; transform: translateY(50px); transition: all 0.5s ease 0.1s; pointer-events: none; }
.wpaa-ltr .wpaa-mascot-img { right: auto; left: -40px; }
.wpaa-mascot-img.show { opacity: 1; transform: translateY(0); }

.wpaa-floating-close { position: absolute; top: -20px; left: -20px; width: 45px; height: 45px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; cursor: pointer; box-shadow: 0 5px 15px rgba(0,0,0,0.15); z-index: 20; border: 3px solid #fff; }
.wpaa-ltr .wpaa-floating-close { left: auto; right: -20px; }

.wpaa-mode-popup .wpaa-header-section { margin-bottom: 20px; text-align: right; }
.wpaa-ltr .wpaa-mode-popup .wpaa-header-section { text-align: left; }
.wpaa-mode-popup .wpaa-main-title { margin: 0; font-size: 28px; font-weight: 900; color: #1a202c; letter-spacing: -0.5px; }
.wpaa-mode-popup .wpaa-sub-title { margin: 8px 0 0 0; font-size: 16px; color: #718096; line-height: 1.4; max-width: 90%; }
.wpaa-mode-popup .wpaa-footer-section { margin-top: auto; }
.wpaa-mode-popup .wpaa-bottom-actions { display: flex; gap: 15px; margin-top: 10px; justify-content: flex-end; padding-left: 10px; }

@media (max-width: 900px) {
    .wpaa-mode-popup { width: 95%; height: 85vh; min-width: 0; flex-direction: column; overflow: hidden; }
    .wpaa-mode-popup .wpaa-chat-card { padding: 20px !important; padding-top: 70px !important; }
    .wpaa-mascot-img { right: 20px; bottom: auto; top: -50px; height: 130px; max-width: none; transform: none !important; opacity: 1; }
    .wpaa-ltr .wpaa-mascot-img { right: auto; left: 20px; }
    .wpaa-floating-close { top: 10px; left: 10px; width: 40px; height: 40px; }
    .wpaa-ltr .wpaa-floating-close { right: 10px; left: auto; }
}


/* =========================================
   MODE 2: CLASSIC (Sidebar, Compact)
   ========================================= */
.wpaa-mode-classic {
    position: fixed; bottom: 100px; right: 20px;
    width: 350px; height: 500px; max-height: 70vh;
    background: #fff; border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    z-index: 999999; display: flex; flex-direction: column; overflow: hidden;
    transform: translateY(20px); opacity: 0; pointer-events: none;
    transition: all 0.3s ease; border: 1px solid #e2e8f0;
}
.wpaa-ltr .wpaa-mode-classic { right: auto; left: 20px; }
.wpaa-mode-classic.active { opacity: 1; pointer-events: all; transform: translateY(0); }

.wpaa-mode-classic .wpaa-header {
    padding: 15px; color: white; font-weight: bold;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.wpaa-mode-classic .wpaa-header-avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); }
.wpaa-mode-classic .wpaa-close { cursor: pointer; font-size: 24px; line-height: 1; }
.wpaa-mode-classic .wpaa-reset, .wpaa-mode-classic .wpaa-whatsapp { color: rgba(255,255,255,0.8); }

.wpaa-mode-classic .wpaa-messages-area { padding: 15px; }
.wpaa-mode-classic .wpaa-footer-section { padding: 10px; border-top: 1px solid #eee; background: #fff; }
.wpaa-mode-classic .wpaa-input-wrapper { margin-top: 5px; }

@media (max-width: 480px) {
    .wpaa-mode-classic { width: 90%; right: 5%; left: 5%; bottom: 80px; }
}