/* =========================================================
   ELASC AI CHATBOT
========================================================= */

#elascAiChat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: 'Inter', sans-serif;
}


/* =========================================================
   FLOATING BUTTON
========================================================= */

.elasc-ai-toggle {
    display: flex;
    align-items: center;
    gap: 10px;

    min-height: 58px;
    padding: 0 22px;

    border: none;
    border-radius: 999px;

    background: linear-gradient(
        135deg,
        #161616,
        #2a2a2a
    );

    color: #ffffff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    box-shadow:
        0 14px 35px rgba(0, 0, 0, 0.22);

    transition: all 0.25s ease;
}

.elasc-ai-toggle:hover {
    transform: translateY(-2px);

    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.28);
}

.elasc-ai-toggle-icon {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #ffffff;

    color: #111111;

    font-size: 16px;
    font-weight: 700;
}

.elasc-ai-toggle-text {
    white-space: nowrap;
}


/* =========================================================
   CHAT WINDOW
========================================================= */

.elasc-ai-window {
    position: absolute;

    right: 0;
    bottom: 74px;

    width: 410px;
    max-width: calc(100vw - 32px);

    height: 650px;
    max-height: calc(100vh - 115px);

    display: none;
    flex-direction: column;

    overflow: hidden;

    background: #ffffff;

    border: 1px solid rgba(0, 0, 0, 0.08);

    border-radius: 24px;

    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.22);
}

.elasc-ai-window.open {
    display: flex;

    animation: elascChatOpen 0.25s ease;
}

@keyframes elascChatOpen {

    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* =========================================================
   HEADER
========================================================= */

.elasc-ai-header {
    min-height: 86px;

    padding: 16px 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background:
        linear-gradient(
            135deg,
            #111111,
            #262626
        );

    color: #ffffff;
}

.elasc-ai-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.elasc-ai-avatar {
    width: 48px;
    height: 48px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            #f0e3c6,
            #d1b986
        );

    color: #161616;

    font-family: 'Cormorant Garamond', serif;

    font-size: 24px;
    font-weight: 700;

    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.35);
}

.elasc-ai-title {
    font-family: 'Cormorant Garamond', serif;

    font-size: 21px;
    line-height: 1;

    font-weight: 600;
    letter-spacing: 0.3px;
}

.elasc-ai-status {
    margin-top: 7px;

    display: flex;
    align-items: center;

    color: rgba(255,255,255,0.72);

    font-size: 11px;
    font-weight: 400;
}

.elasc-ai-status-dot {
    width: 7px;
    height: 7px;

    margin-right: 6px;

    border-radius: 50%;

    background: #3ecf8e;

    box-shadow:
        0 0 0 3px rgba(62,207,142,0.12);
}

.elasc-ai-close {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 50%;

    background: rgba(255,255,255,0.08);

    color: #ffffff;

    font-size: 24px;
    line-height: 1;

    cursor: pointer;

    transition: all 0.2s ease;
}

.elasc-ai-close:hover {
    background: rgba(255,255,255,0.16);
}


/* =========================================================
   MESSAGE AREA
========================================================= */

.elasc-ai-messages {
    flex: 1;

    padding: 20px;

    overflow-y: auto;

    background:
        linear-gradient(
            180deg,
            #faf9f6 0%,
            #f7f7f5 100%
        );

    scroll-behavior: smooth;
}

.elasc-ai-messages::-webkit-scrollbar {
    width: 6px;
}

.elasc-ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

.elasc-ai-messages::-webkit-scrollbar-thumb {
    background: #d8d8d4;
    border-radius: 20px;
}


/* =========================================================
   MESSAGE BUBBLES
========================================================= */

.elasc-ai-message {
    display: flex;

    margin-bottom: 14px;
}

.elasc-ai-message.bot {
    justify-content: flex-start;
}

.elasc-ai-message.user {
    justify-content: flex-end;
}

.elasc-ai-bubble {
    max-width: 84%;

    padding: 12px 15px;

    font-size: 13px;
    line-height: 1.6;

    word-break: break-word;
    white-space: pre-wrap;
}

.elasc-ai-message.bot .elasc-ai-bubble {
    background: #ffffff;

    color: #292929;

    border:
        1px solid rgba(0,0,0,0.07);

    border-radius:
        17px 17px 17px 5px;

    box-shadow:
        0 5px 18px rgba(0,0,0,0.04);
}

.elasc-ai-message.user .elasc-ai-bubble {
    background:
        linear-gradient(
            135deg,
            #1e1e1e,
            #303030
        );

    color: #ffffff;

    border-radius:
        17px 17px 5px 17px;

    box-shadow:
        0 5px 18px rgba(0,0,0,0.10);
}


/* =========================================================
   GUEST NAME SECTION
========================================================= */

.elasc-ai-name-section {
    padding: 16px;

    background: #ffffff;

    border-top:
        1px solid #ecebea;
}

.elasc-ai-name-title {
    margin-bottom: 9px;

    color: #313131;

    font-size: 12px;
    font-weight: 600;
}

.elasc-ai-name-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.elasc-ai-name-input {
    flex: 1;

    min-width: 0;
    height: 44px;

    padding: 0 13px;

    border:
        1px solid #deddd9;

    border-radius: 12px;

    background: #ffffff;

    color: #222222;

    font-size: 13px;

    outline: none;

    transition: all 0.2s ease;
}

.elasc-ai-name-input:focus {
    border-color: #b79b63;

    box-shadow:
        0 0 0 3px rgba(183,155,99,0.10);
}

.elasc-ai-name-button {
    height: 44px;

    padding: 0 16px;

    border: none;
    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            #222222,
            #383838
        );

    color: #ffffff;

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;

    transition: all 0.2s ease;
}

.elasc-ai-name-button:hover {
    transform: translateY(-1px);

    background:
        linear-gradient(
            135deg,
            #161616,
            #2b2b2b
        );
}

.elasc-ai-name-error {
    margin-top: 7px;

    color: #b42318;

    font-size: 11px;
}


/* =========================================================
   TYPING INDICATOR
========================================================= */

.elasc-ai-typing {
    padding: 8px 20px 12px;

    background: #f7f7f5;
}

.elasc-ai-typing span {
    width: 7px;
    height: 7px;

    display: inline-block;

    margin-right: 4px;

    border-radius: 50%;

    background: #9f9f9a;

    animation:
        elascTyping 1.3s infinite ease-in-out;
}

.elasc-ai-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.elasc-ai-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes elascTyping {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}


/* =========================================================
   QUICK SUGGESTIONS
========================================================= */

.elasc-ai-suggestions {
    padding: 12px 14px 10px;

    display: flex;
    gap: 8px;

    overflow-x: auto;

    background: #ffffff;

    border-top:
        1px solid #ecebea;
}

.elasc-ai-suggestions::-webkit-scrollbar {
    display: none;
}

.elasc-ai-suggestions button {
    flex-shrink: 0;

    padding: 8px 12px;

    border:
        1px solid #ddd8cd;

    border-radius: 999px;

    background: #faf8f3;

    color: #4a4335;

    font-size: 11px;
    font-weight: 500;

    cursor: pointer;

    transition: all 0.2s ease;
}

.elasc-ai-suggestions button:hover {
    background: #f1eadc;

    border-color: #cdb887;

    transform: translateY(-1px);
}


/* =========================================================
   INPUT AREA
========================================================= */

.elasc-ai-input-area {
    padding: 12px 14px;

    display: flex;
    align-items: flex-end;
    gap: 10px;

    background: #ffffff;

    border-top:
        1px solid #ecebea;
}

.elasc-ai-input-area textarea {
    flex: 1;

    min-height: 44px;
    max-height: 120px;

    resize: none;

    padding: 11px 14px;

    border:
        1px solid #deddd9;

    border-radius: 14px;

    background: #fbfbfa;

    color: #252525;

    font-family: 'Inter', sans-serif;

    font-size: 13px;
    line-height: 1.45;

    outline: none;

    transition: all 0.2s ease;
}

.elasc-ai-input-area textarea:focus {
    background: #ffffff;

    border-color: #b79b63;

    box-shadow:
        0 0 0 3px rgba(183,155,99,0.10);
}

.elasc-ai-input-area textarea::placeholder {
    color: #a0a09b;
}

.elasc-ai-send {
    width: 44px;
    height: 44px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            #1c1c1c,
            #333333
        );

    color: #ffffff;

    font-size: 18px;

    cursor: pointer;

    box-shadow:
        0 5px 14px rgba(0,0,0,0.15);

    transition: all 0.2s ease;
}

.elasc-ai-send:hover {
    transform: translateY(-1px);
}

.elasc-ai-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}


/* =========================================================
   PROJECT OPTION BUTTONS
========================================================= */

.elasc-ai-options {
    display: flex;
    flex-direction: column;
    gap: 8px;

    margin:
        -2px 0 16px 0;
}

.elasc-ai-option-btn {
    width: 100%;

    padding: 11px 13px;

    border:
        1px solid #ded8ca;

    border-radius: 12px;

    background: #ffffff;

    color: #302c24;

    text-align: left;

    font-size: 12px;
    font-weight: 500;

    cursor: pointer;

    box-shadow:
        0 4px 12px rgba(0,0,0,0.03);

    transition: all 0.2s ease;
}

.elasc-ai-option-btn:hover {
    border-color: #bca36c;

    background: #fbf8f1;

    transform: translateY(-1px);
}


/* =========================================================
   PLOT CARDS
========================================================= */

.elasc-ai-plots {
    display: flex;
    flex-direction: column;
    gap: 11px;

    margin-bottom: 16px;
}

.elasc-ai-plot-card {
    padding: 14px;

    border:
        1px solid #e2ded4;

    border-radius: 15px;

    background: #ffffff;

    box-shadow:
        0 6px 18px rgba(0,0,0,0.045);
}

.elasc-ai-plot-title {
    margin-bottom: 9px;

    color: #232323;

    font-family:
        'Cormorant Garamond',
        serif;

    font-size: 18px;
    font-weight: 600;
}

.elasc-ai-plot-detail {
    display: flex;
    justify-content: space-between;
    gap: 12px;

    padding: 4px 0;

    font-size: 11px;
}

.elasc-ai-plot-label {
    color: #8a867d;
}

.elasc-ai-plot-value {
    color: #2f2f2f;

    font-weight: 500;

    text-align: right;
}

.elasc-ai-plot-actions {
    margin-top: 12px;

    padding-top: 10px;

    border-top:
        1px solid #f0eee8;
}

.elasc-ai-interested-btn {
    width: 100%;

    height: 38px;

    border: none;
    border-radius: 10px;

    background:
        #1f1f1f;

    color: #ffffff;

    font-size: 11px;
    font-weight: 600;

    cursor: pointer;

    transition: all 0.2s ease;
}

.elasc-ai-interested-btn:hover {
    background: #393939;
}


/* =========================================================
   FOOTER
========================================================= */

.elasc-ai-footer {
    padding: 8px 14px 10px;

    background: #ffffff;

    color: #a09e98;

    text-align: center;

    font-size: 9px;
    line-height: 1.4;
}


/* =========================================================
   DISABLED STATES
========================================================= */

.elasc-ai-name-button:disabled,
.elasc-ai-option-btn:disabled,
.elasc-ai-suggestions button:disabled,
.elasc-ai-interested-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 768px) {

    #elascAiChat {
        right: 16px;
        bottom: 16px;
    }

    .elasc-ai-window {
        width: 390px;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 576px) {

    #elascAiChat {
        right: 12px;
        bottom: 12px;
    }


    /*
     * Floating button becomes circular
     */
    .elasc-ai-toggle {
        width: 58px;
        height: 58px;

        min-height: 58px;

        padding: 0;

        justify-content: center;
    }

    .elasc-ai-toggle-text {
        display: none;
    }

    .elasc-ai-toggle-icon {
        width: 34px;
        height: 34px;
    }


    /*
     * Full-screen style chat
     */
    .elasc-ai-window {
        position: fixed;

        left: 8px;
        right: 8px;
        bottom: 8px;

        width: auto;
        height: calc(100vh - 16px);

        max-width: none;
        max-height: none;

        border-radius: 20px;
    }

    .elasc-ai-header {
        min-height: 78px;

        padding:
            14px 15px;
    }

    .elasc-ai-avatar {
        width: 43px;
        height: 43px;

        font-size: 21px;
    }

    .elasc-ai-title {
        font-size: 19px;
    }

    .elasc-ai-messages {
        padding: 15px;
    }

    .elasc-ai-bubble {
        max-width: 88%;

        font-size: 12px;
    }

    .elasc-ai-name-input-wrapper {
        flex-direction: column;
    }

    .elasc-ai-name-input,
    .elasc-ai-name-button {
        width: 100%;
    }

    .elasc-ai-suggestions {
        padding:
            10px 12px;
    }

    .elasc-ai-input-area {
        padding:
            10px 12px;
    }

    .elasc-ai-footer {
        font-size: 8px;
    }
}