/* =========================================================
   ZIZIGOLO AI PRODUCT CHAT
   ========================================================= */

:root {
    --zg-ai-blue: #1769ff;
    --zg-ai-blue-dark: #0f55d9;
    --zg-ai-blue-light: #edf4ff;

    --zg-ai-red: #ef3340;
    --zg-ai-green: #19b87a;

    --zg-ai-bg: #ffffff;
    --zg-ai-card: #f8fafc;

    --zg-ai-text: #172033;
    --zg-ai-muted: #758096;

    --zg-ai-border: #e8edf4;

    --zg-ai-radius: 22px;

    --zg-ai-shadow:
        0 25px 70px rgba(20, 40, 80, 0.16);
}


/* =========================================================
   PRODUCT QUESTION BOX
   ========================================================= */

.zg-product-ai-box {
    width: 100%;
    min-height: 66px;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 8px 10px 8px 16px;

    background: #ffffff;

    border: 1px solid var(--zg-ai-border);

    border-radius: 18px;

    box-shadow:
        0 8px 28px rgba(30, 60, 110, 0.07);

    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.25s ease;

    direction: rtl;

    box-sizing: border-box;
}


.zg-product-ai-box:focus-within {

    border-color: rgba(23, 105, 255, 0.45);

    box-shadow:
        0 10px 35px rgba(23, 105, 255, 0.12);

    transform: translateY(-1px);
}


/* AI Icon */

.zg-ai-mini-icon {

    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 13px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--zg-ai-blue),
            #5a8eff
        );

    font-size: 17px;

    box-shadow:
        0 7px 18px rgba(23, 105, 255, 0.20);
}


/* Input Wrapper */

.zg-ai-input-wrap {
    flex: 1;
    min-width: 0;
}


/* Input */

.zg-ai-input {

    width: 100%;

    border: 0 !important;
    outline: 0 !important;

    background: transparent !important;

    box-shadow: none !important;

    color: var(--zg-ai-text);

    font-size: 14px;

    font-weight: 500;

    direction: rtl;

    padding: 8px 0;

    font-family: inherit;

}


.zg-ai-input::placeholder {
    color: #98a2b3;
}


/* Send Button */

.zg-ai-send-btn {

    width: 45px;
    height: 45px;

    flex: 0 0 45px;

    border: 0;

    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--zg-ai-blue),
            #5287ff
        );

    cursor: pointer;

    font-size: 15px;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;

}


.zg-ai-send-btn:hover {

    transform: scale(1.05);

    box-shadow:
        0 8px 20px rgba(23, 105, 255, 0.25);
}


.zg-ai-send-btn:active {
    transform: scale(0.95);
}


/* =========================================================
   FLOATING BUTTON
   ========================================================= */

.zg-ai-floating-btn {

    position: fixed;

    right: 24px;
    bottom: 24px;

    z-index: 9997;

    height: 58px;

    display: flex;
    align-items: center;

    gap: 10px;

    padding: 6px 10px 6px 18px;

    border: 0;

    border-radius: 18px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            #1769ff,
            #4f89ff
        );

    box-shadow:
        0 14px 40px rgba(23, 105, 255, 0.30);

    cursor: pointer;

    font-family: inherit;

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;

    direction: rtl;
}


.zg-ai-floating-btn:hover {

    transform: translateY(-3px);

    box-shadow:
        0 18px 45px rgba(23, 105, 255, 0.38);

}


.zg-floating-icon {

    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 13px;

    background: rgba(255,255,255,0.16);

    font-size: 17px;

}


.zg-floating-text {

    font-size: 13px;

    font-weight: 700;

    white-space: nowrap;

}


/* =========================================================
   OVERLAY
   ========================================================= */

.zg-ai-overlay {

    position: fixed;

    inset: 0;

    z-index: 9998;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 24px;

    background:
        rgba(12, 24, 48, 0.42);

    backdrop-filter:
        blur(8px);

    -webkit-backdrop-filter:
        blur(8px);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.28s ease,
        visibility 0.28s ease;

    direction: rtl;
}


.zg-ai-overlay.active {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

}


/* =========================================================
   CHAT MODAL
   ========================================================= */

.zg-ai-modal {

    width: min(720px, 100%);

    height: min(720px, 88vh);

    background: #ffffff;

    border-radius: 28px;

    overflow: hidden;

    display: flex;

    flex-direction: column;

    box-shadow:
        0 30px 100px rgba(10, 30, 70, 0.25);

    transform:
        translateY(18px)
        scale(0.97);

    opacity: 0;

    transition:
        transform 0.30s ease,
        opacity 0.30s ease;

}


.zg-ai-overlay.active .zg-ai-modal {

    transform:
        translateY(0)
        scale(1);

    opacity: 1;

}


/* =========================================================
   HEADER
   ========================================================= */

.zg-ai-header {

    min-height: 78px;

    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 14px 18px;

    border-bottom: 1px solid var(--zg-ai-border);

    background: #ffffff;

    direction: rtl;

}


.zg-ai-header-info {

    display: flex;

    align-items: center;

    gap: 12px;

}


/* Avatar */

.zg-ai-avatar {

    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 15px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--zg-ai-blue),
            #668fff
        );

    font-size: 18px;

    box-shadow:
        0 8px 20px rgba(23, 105, 255, 0.20);

}


/* Header Text */

.zg-ai-header-text h3 {

    margin: 0 0 4px;

    color: var(--zg-ai-text);

    font-size: 15px;

    font-weight: 800;

}


.zg-ai-header-text span {

    color: var(--zg-ai-muted);

    font-size: 11px;

    font-weight: 500;

}


/* Close */

.zg-ai-close {

    width: 40px;
    height: 40px;

    border: 0;

    border-radius: 12px;

    background: #f5f7fa;

    color: #6f7b8f;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;

}


.zg-ai-close:hover {

    background: #eef2f7;

    color: #172033;

    transform: rotate(5deg);

}


/* =========================================================
   CHAT BODY
   ========================================================= */

.zg-ai-chat-body {

    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding: 24px;

    background:
        linear-gradient(
            180deg,
            #fbfcfe 0%,
            #f7f9fc 100%
        );

    scroll-behavior: smooth;

}


/* scrollbar */

.zg-ai-chat-body::-webkit-scrollbar {
    width: 6px;
}


.zg-ai-chat-body::-webkit-scrollbar-thumb {

    background: #d4dbe5;

    border-radius: 20px;

}


/* =========================================================
   WELCOME
   ========================================================= */

.zg-ai-welcome {

    max-width: 540px;

    margin: 30px auto;

    text-align: center;

}


.zg-ai-welcome-icon {

    width: 62px;
    height: 62px;

    margin: 0 auto 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 19px;

    color: var(--zg-ai-blue);

    background: var(--zg-ai-blue-light);

    font-size: 23px;

}


.zg-ai-welcome h4 {

    margin: 0 0 8px;

    color: var(--zg-ai-text);

    font-size: 22px;

    font-weight: 850;

}


.zg-ai-welcome p {

    max-width: 420px;

    margin: 0 auto;

    line-height: 1.9;

    color: var(--zg-ai-muted);

    font-size: 13px;

}


/* =========================================================
   SUGGESTIONS
   ========================================================= */

.zg-ai-suggestions {

    display: flex;

    justify-content: center;

    flex-wrap: wrap;

    gap: 8px;

    margin-top: 22px;

}


.zg-ai-suggestions button {

    border: 1px solid #e1e7f0;

    background: #ffffff;

    color: #4d5970;

    border-radius: 12px;

    padding: 9px 12px;

    font-family: inherit;

    font-size: 11px;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        color 0.2s ease,
        background 0.2s ease;

}


.zg-ai-suggestions button:hover {

    border-color: rgba(23,105,255,0.35);

    color: var(--zg-ai-blue);

    background: #f7faff;

}


/* =========================================================
   MESSAGE ROW
   ========================================================= */

.zg-ai-message {

    display: flex;

    margin-bottom: 18px;

}


.zg-ai-message.user {

    justify-content: flex-start;

}


.zg-ai-message.assistant {

    justify-content: flex-end;

}


/* Message bubble */

.zg-ai-bubble {

    max-width: min(78%, 520px);

    padding: 13px 15px;

    border-radius: 17px;

    font-size: 13px;

    line-height: 1.9;

    direction: rtl;

}


/* User */

.zg-ai-message.user .zg-ai-bubble {

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--zg-ai-blue),
            #4c83ff
        );

    border-bottom-left-radius: 5px;

}


/* Assistant */

.zg-ai-message.assistant .zg-ai-bubble {

    color: #303b4f;

    background: #ffffff;

    border: 1px solid #e6ebf2;

    box-shadow:
        0 4px 16px rgba(30, 55, 90, 0.05);

    border-bottom-right-radius: 5px;

}


/* =========================================================
   TYPING INDICATOR
   ========================================================= */

.zg-ai-typing {

    display: flex;

    align-items: center;

    gap: 4px;

    min-width: 54px;

}


.zg-ai-typing span {

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #aab4c3;

    animation:
        zgTyping 1.2s infinite ease-in-out;

}


.zg-ai-typing span:nth-child(2) {
    animation-delay: 0.15s;
}


.zg-ai-typing span:nth-child(3) {
    animation-delay: 0.30s;
}


@keyframes zgTyping {

    0%,
    60%,
    100% {

        transform: translateY(0);

        opacity: 0.45;
    }

    30% {

        transform: translateY(-4px);

        opacity: 1;
    }

}


/* =========================================================
   FOOTER
   ========================================================= */

.zg-ai-footer {

    padding: 14px 18px 15px;

    background: #ffffff;

    border-top: 1px solid var(--zg-ai-border);

}


.zg-ai-footer-input {

    display: flex;

    align-items: flex-end;

    gap: 8px;

    padding: 7px 7px 7px 8px;

    background: #f5f7fa;

    border: 1px solid #e7ebf1;

    border-radius: 16px;

}


.zg-ai-footer-input textarea {

    flex: 1;

    min-height: 40px;
    max-height: 100px;

    resize: none;

    border: 0 !important;

    outline: 0 !important;

    box-shadow: none !important;

    background: transparent !important;

    padding: 9px 8px;

    color: var(--zg-ai-text);

    font-family: inherit;

    font-size: 13px;

    line-height: 1.7;

    direction: rtl;

}


.zg-ai-footer-input textarea::placeholder {
    color: #9aa4b4;
}


/* Chat send */

.zg-ai-chat-send {

    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    border: 0;

    border-radius: 12px;

    color: #ffffff;

    background:
        linear-gradient(
            135deg,
            var(--zg-ai-blue),
            #598aff
        );

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;

}


.zg-ai-chat-send:hover {

    transform: scale(1.05);

    box-shadow:
        0 7px 18px rgba(23, 105, 255, 0.23);

}


/* Footer note */

.zg-ai-footer-note {

    display: flex;

    justify-content: center;

    align-items: center;

    gap: 5px;

    margin-top: 8px;

    color: #98a2b3;

    font-size: 9px;

}


.zg-ai-footer-note i {

    font-size: 9px;

    color: var(--zg-ai-green);

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

    .zg-ai-floating-btn {

        right: 15px;

        bottom: 75px;

        height: 52px;

        padding: 5px 8px 5px 14px;

        border-radius: 16px;

    }

    .zg-floating-icon {

        width: 40px;
        height: 40px;

        border-radius: 12px;

    }

    .zg-floating-text {
        font-size: 12px;
    }


    .zg-ai-overlay {
        align-items: flex-end;
        margin-bottom: 80px;
        padding: 0;
    }


    .zg-ai-modal {

        width: 100%;

        height: 92vh;

        border-radius:
            25px 25px 0 0;

        transform:
            translateY(30px);

    }


    .zg-ai-overlay.active .zg-ai-modal {

        transform:
            translateY(0);

    }


    .zg-ai-header {

        min-height: 70px;

        padding:
            12px 14px;

    }


    .zg-ai-avatar {

        width: 43px;
        height: 43px;

        flex-basis: 43px;

        border-radius: 13px;

    }


    .zg-ai-header-text h3 {

        font-size: 14px;

    }


    .zg-ai-header-text span {

        font-size: 10px;

    }


    .zg-ai-chat-body {

        padding: 18px 15px;

    }


    .zg-ai-bubble {

        max-width: 88%;

        font-size: 12px;

    }


    .zg-ai-footer {

        padding:
            10px 12px 12px;

    }

}


@media (max-width: 480px) {

    .zg-product-ai-box {

        min-height: 58px;

        padding:
            7px 8px 7px 12px;

    }


    .zg-ai-mini-icon {

        width: 37px;
        height: 37px;

        flex-basis: 37px;

        border-radius: 11px;

        font-size: 14px;

    }


    .zg-ai-send-btn {

        width: 40px;
        height: 40px;

        flex-basis: 40px;

        border-radius: 12px;

    }


    .zg-ai-input {

        font-size: 12px;

    }


    .zg-ai-floating-btn {

        right: 12px;

        bottom: 70px;

    }


    .zg-ai-welcome {

        margin:
            15px auto;

    }


    .zg-ai-welcome h4 {

        font-size: 19px;

    }


    .zg-ai-welcome p {

        font-size: 12px;

        line-height: 1.8;

    }

}
@keyframes zgSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.zg-spin {
    animation: zgSpin 1s linear infinite;
}
@keyframes zgPulseFade {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.3;
        transform: scale(0.85);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.zg-pulse {
    animation: zgPulseFade 1.2s ease-in-out infinite;
}
@media (max-width: 768px) {

    .zg-ai-overlay {
        position: fixed;
        inset: 0; /* کل صفحه */
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(0,0,0,0.5);
        z-index: 99999;
    }

    .zg-ai-modal {
        width: 100%;
        height: 60vh;
        max-height: 60vh;
        border-radius: 20px 20px 0 0;
        overflow: hidden;
        transform: translateY(100%);
        animation: slideUp 0.35s ease forwards;
    }
}

@keyframes slideUp {
    to {
        transform: translateY(0);
    }
}