.ai-chat-fab {
    position: fixed;
    bottom: 1.4rem;
    right: 1.4rem;
    left: auto;
    z-index: 1200;
    width: 72px;
    height: 72px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, #A8FFFE, #6FFFFE);
    color: #003980;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0, 104, 181, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    padding: 0.35rem 0.4rem 0.45rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ai-chat-fab > i {
    line-height: 1;
    position: relative;
    z-index: 1;
}
.ai-chat-fab-label {
    position: relative;
    z-index: 1;
    font-family: 'Cairo', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.05;
    color: #003980;
    letter-spacing: 0;
    max-width: 92%;
    text-align: center;
}
.ai-chat-fab-label span {
    display: block;
}
.ai-chat-fab:hover { transform: translateY(-3px) scale(1.04); }
.ai-chat-fab-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(0, 104, 181, 0.7);
    animation: chatPulse 2s ease-out infinite;
    pointer-events: none;
}
@keyframes chatPulse {
    0% { transform: scale(0.85); opacity: 0.8; }
    100% { transform: scale(1.25); opacity: 0; }
}
.ai-chat-panel {
    position: fixed;
    bottom: 5.8rem;
    right: 1.4rem;
    left: auto;
    z-index: 1201;
    width: min(380px, calc(100vw - 1.6rem));
    height: min(560px, calc(100vh - 7.5rem));
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(0, 57, 128, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #E8EDF3;
}
.ai-chat-panel[hidden] {
    display: none !important;
}
.ai-chat-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    background: linear-gradient(135deg, #003980, #0068B5);
    color: #fff;
}
.ai-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(0, 104, 181, 0.2);
    color: #6FFFFE;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.ai-chat-head strong { display: block; font-size: 0.98rem; }
.ai-chat-head small { color: rgba(255,255,255,0.72); font-size: 0.78rem; }
.ai-chat-close {
    margin-inline-start: auto;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}
.ai-chat-head-text { min-width: 0; flex: 1; }
.ai-chat-reset {
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.ai-chat-reset[hidden] { display: none !important; }
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #F4F6F8;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.ai-chat-row {
    display: flex;
    align-items: flex-end;
    gap: 0.45rem;
    max-width: 100%;
}
.ai-chat-row.bot { align-self: stretch; justify-content: flex-start; }
.ai-chat-row.user { align-self: stretch; justify-content: flex-end; }
.ai-chat-mini-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #003980;
    color: #6FFFFE;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.ai-chat-mini-avatar.user { background: #0068B5; color: #fff; }
.ai-chat-bubble {
    max-width: min(86%, 280px);
    padding: 0.75rem 0.9rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.ai-chat-bubble a,
.ai-chat-link {
    color: #00A8B8;
    font-weight: 700;
    text-decoration: underline;
    word-break: break-all;
}
.ai-chat-bubble.bot {
    background: #fff;
    border: 1px solid #E5EAF0;
    color: #1E2A3A;
    border-bottom-right-radius: 6px;
}
html[dir="rtl"] .ai-chat-bubble.bot { border-bottom-right-radius: 16px; border-bottom-left-radius: 6px; }
.ai-chat-bubble.user {
    background: linear-gradient(135deg, #003980, #0068B5);
    color: #fff;
    border: 0;
    border-bottom-left-radius: 6px;
}
html[dir="rtl"] .ai-chat-bubble.user { border-bottom-left-radius: 16px; border-bottom-right-radius: 6px; }
.ai-chat-bubble.user a { color: #fff; }
.ai-chat-bubble.err {
    background: #FEF2F2;
    color: #991B1B;
    border-color: #FECACA;
}
.ai-chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding-inline-start: 2.1rem;
}
.ai-chat-chip {
    border: 1.5px solid #003980;
    background: #fff;
    color: #003980;
    border-radius: 14px;
    padding: 0.55rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.ai-chat-chip:hover:not(:disabled) {
    border-color: #0068B5;
    background: #EAF8FF;
    color: #003980;
    box-shadow: 0 4px 12px rgba(0, 57, 128, 0.12);
}
.ai-chat-chip.selected {
    border-color: #003980;
    background: linear-gradient(135deg, #003980, #0068B5);
    color: #6FFFFE;
}
.ai-chat-chip:disabled { opacity: 0.55; cursor: default; }
.ai-chat-summary {
    display: grid;
    gap: 0.25rem;
    margin-bottom: 0.45rem;
}
.ai-chat-summary-ready { margin-top: 0.45rem; color: #5B6B7C; }
.ai-chat-pkg-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    width: 100%;
}
.ai-chat-pkg-list .ai-chat-row {
    width: 100%;
}
.ai-chat-pkg-card {
    display: flex;
    flex-direction: column;
    width: min(100%, 290px);
    background: #fff;
    border: 1px solid #E5EAF0;
    border-radius: 18px;
    overflow: hidden;
    color: #1E2A3A;
    box-shadow: 0 8px 22px rgba(16, 24, 40, 0.08);
    flex: 1;
    min-height: 280px;
}
.ai-chat-pkg-img {
    width: 100%;
    height: 148px;
    object-fit: cover;
    display: block;
    background: #EEF2F6;
}
.ai-chat-pkg-body {
    padding: 0.85rem 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1;
}
.ai-chat-pkg-title {
    color: #123;
    font-size: 0.95rem;
    line-height: 1.45;
    font-weight: 800;
}
.ai-chat-pkg-meta {
    display: grid;
    gap: 0.35rem;
    color: #5B6B7C;
    font-size: 0.82rem;
    line-height: 1.4;
}
.ai-chat-pkg-meta i {
    width: 1rem;
    color: #0068B5;
    margin-inline-end: 0.25rem;
}
.ai-chat-pkg-price {
    color: #003980 !important;
    font-weight: 800;
}
.ai-chat-pkg-actions {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: auto;
}
.ai-chat-pkg-cta {
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #003980, #0068B5);
    color: #6FFFFE;
    font-weight: 800;
    font-size: 0.88rem;
    font-family: inherit;
    padding: 0.7rem 0.85rem;
    cursor: pointer;
    width: 100%;
    text-align: center;
    text-decoration: none;
}
.ai-chat-pkg-cta:hover { filter: brightness(1.05); }
.ai-chat-pkg-pdf {
    border: 1.5px solid #003980;
    border-radius: 12px;
    background: #fff;
    color: #003980;
    font-weight: 800;
    font-size: 0.88rem;
    font-family: inherit;
    padding: 0.65rem 0.85rem;
    cursor: pointer;
    width: 100%;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.ai-chat-pkg-pdf:hover {
    background: #EAF8FF;
}
.ai-chat-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 0.7rem 0.9rem;
}
.ai-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #6FFFFE;
    animation: chatDot 1s infinite ease-in-out;
}
.ai-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}
.ai-chat-form {
    display: flex;
    gap: 0.45rem;
    padding: 0.75rem;
    border-top: 1px solid #E8EDF3;
    background: #fff;
}
.ai-chat-form input {
    flex: 1;
    border: 1.5px solid #E8EDF3;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    outline: none;
}
.ai-chat-form input:focus { border-color: #6FFFFE; }
.ai-chat-form button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #6FFFFE;
    color: #003980;
    cursor: pointer;
}
@media (max-width: 640px) {
    .ai-chat-fab {
        width: 64px;
        height: 64px;
        right: 0.9rem;
        bottom: calc(0.85rem + env(safe-area-inset-bottom));
        font-size: 0.95rem;
        transition: none;
        gap: 0.04rem;
    }
    .ai-chat-fab:hover { transform: none; }
    .ai-chat-fab-label {
        font-size: 0.58rem;
        line-height: 1.02;
    }
    .ai-chat-fab-pulse {
        animation: none;
        display: none;
    }
    body.nav-open .ai-chat-fab {
        opacity: 0;
        pointer-events: none;
    }
    #ai-chat-root:has(.ai-chat-panel:not([hidden])) .ai-chat-fab {
        opacity: 0;
        pointer-events: none;
    }
    .ai-chat-panel {
        inset: auto 0 0 0;
        width: 100%;
        height: min(88dvh, 640px);
        border-radius: 22px 22px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
        overscroll-behavior: contain;
    }
    .ai-chat-form input { font-size: 16px; }
}

/* WhatsApp floating button — left side */
.wa-fab {
    position: fixed;
    bottom: 1.4rem;
    left: 1.4rem;
    right: auto;
    z-index: 1200;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    font-size: 2rem;
    display: grid;
    place-items: center;
    text-decoration: none;
    box-shadow: 0 12px 30px rgba(37, 211, 102, 0.45);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.wa-fab:hover {
    transform: translateY(-3px) scale(1.04);
    color: #fff;
    box-shadow: 0 16px 36px rgba(37, 211, 102, 0.55);
}
.wa-fab > i {
    position: relative;
    z-index: 1;
    line-height: 1;
}
.wa-fab-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, 0.7);
    animation: chatPulse 2s ease-out infinite;
    pointer-events: none;
}
@media (max-width: 640px) {
    .wa-fab {
        width: 64px;
        height: 64px;
        left: 0.9rem;
        bottom: calc(0.85rem + env(safe-area-inset-bottom));
        font-size: 1.75rem;
        transition: none;
    }
    .wa-fab:hover { transform: none; }
    .wa-fab-pulse {
        animation: none;
        display: none;
    }
    body.nav-open .wa-fab {
        opacity: 0;
        pointer-events: none;
    }
}
