/* =========================================================
   AI SHOPPING ASSISTANT
   ========================================================= */

.ai-chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
}


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

.ai-chat-toggle {
    width: 58px;
    height: 58px;

    border: none;
    border-radius: 50%;

    background-color: var(--color-dark);
    color: var(--color-gold);

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

    font-size: 1.35rem;

    box-shadow: 0 8px 25px rgba(43, 37, 32, 0.25);

    cursor: pointer;

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.ai-chat-toggle:hover {
    transform: translateY(-3px);

    box-shadow:
        0 12px 30px rgba(43, 37, 32, 0.3);
}


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

.ai-chat-window {
    position: absolute;

    right: 0;
    bottom: 74px;

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

    background-color: var(--color-white);

    border: 1px solid var(--color-champagne);

    box-shadow:
        0 20px 50px rgba(43, 37, 32, 0.18);

    overflow: hidden;

    opacity: 0;
    visibility: hidden;

    transform:
        translateY(15px) scale(0.97);

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
}


/* Open state */

.ai-chat-window.active {
    opacity: 1;
    visibility: visible;

    transform:
        translateY(0) scale(1);
}


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

.ai-chat-header {
    padding: 18px 20px;

    background-color: var(--color-dark);
    color: var(--color-white);

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

.ai-chat-title {
    display: block;

    font-family: Georgia, "Times New Roman", serif;

    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.ai-chat-subtitle {
    display: block;

    margin-top: 3px;

    color: var(--color-champagne);

    font-size: 0.75rem;
}

.ai-chat-close {
    width: 32px;
    height: 32px;

    border: none;
    background: transparent;

    color: var(--color-champagne);

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

    cursor: pointer;

    transition: color 0.2s ease;
}

.ai-chat-close:hover {
    color: var(--color-gold);
}


/* =========================================================
   CHAT MESSAGES
   ========================================================= */

.ai-chat-messages {
    height: 360px;

    padding: 18px;

    overflow-y: auto;

    background-color: var(--color-ivory);
}


/* AI message */

.ai-message {
    display: flex;

    justify-content: flex-start;

    margin-bottom: 12px;
}

.ai-message-bubble {
    max-width: 82%;

    padding: 11px 14px;

    background-color: var(--color-white);

    border: 1px solid var(--color-champagne);

    color: var(--color-espresso);

    font-size: 0.9rem;
    line-height: 1.5;

    box-shadow:
        0 3px 10px rgba(43, 37, 32, 0.05);
}


/* Customer message */

.user-message {
    display: flex;

    justify-content: flex-end;

    margin-bottom: 12px;
}

.user-message-bubble {
    max-width: 82%;

    padding: 11px 14px;

    background-color: var(--color-dark);

    color: var(--color-white);

    font-size: 0.9rem;
    line-height: 1.5;
}


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

.ai-chat-input-area {
    padding: 12px;

    background-color: var(--color-white);

    border-top: 1px solid var(--color-champagne);
}

#aiChatForm {
    display: flex;

    gap: 8px;
}

.ai-chat-input {
    flex: 1;

    min-width: 0;

    padding: 10px 13px;

    border: 1px solid var(--color-champagne);

    background-color: var(--color-ivory);

    color: var(--color-espresso);

    font-size: 0.9rem;

    outline: none;
}

.ai-chat-input:focus {
    border-color: var(--color-gold);

    box-shadow:
        0 0 0 2px rgba(184, 155, 94, 0.12);
}

.ai-chat-input::placeholder {
    color: var(--color-muted);
}


/* Send button */

.ai-chat-send {
    width: 42px;

    border: none;

    background-color: var(--color-dark);

    color: var(--color-gold);

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

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.ai-chat-send:hover {
    background-color: var(--color-espresso);

    color: var(--color-white);
}


/* =========================================================
   LOADING MESSAGE
   ========================================================= */

.ai-typing {
    display: inline-flex;

    align-items: center;

    gap: 4px;
}

.ai-typing span {
    width: 5px;
    height: 5px;

    border-radius: 50%;

    background-color: var(--color-gold);

    animation: aiTyping 1.2s infinite ease-in-out;
}

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

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

@keyframes aiTyping {

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

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


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

@media (max-width: 575.98px) {

    .ai-chat-widget {
        right: 16px;
        bottom: 16px;
    }

    .ai-chat-window {
        right: 0;
        bottom: 70px;

        width: calc(100vw - 32px);
    }

    .ai-chat-messages {
        height: 330px;
    }

    .ai-chat-toggle {
        width: 54px;
        height: 54px;
    }
}

/* =========================================================
   AI PRODUCT CARDS
   ========================================================= */

.ai-product-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;

    width: 100%;
    margin-top: 12px;
}


/* Product card */

.ai-product-card {
    display: block;

    overflow: hidden;

    background-color: var(--color-white);

    border: 1px solid var(--color-champagne);

    color: inherit;
    text-decoration: none;

    cursor: pointer;

    box-shadow:
        0 4px 14px rgba(43, 37, 32, 0.07);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}


.ai-product-card:hover {
    transform: translateY(-2px);

    border-color: var(--color-gold);

    box-shadow:
        0 8px 22px rgba(43, 37, 32, 0.12);
}


/* Product image */

.ai-product-image {
    display: block;

    width: 100%;
    height: 165px;

    object-fit: cover;

    background-color: var(--color-champagne);
}


/* Product information */

.ai-product-info {
    padding: 13px 14px 14px;
}


/* Product name */

.ai-product-name {
    display: block;

    margin-bottom: 6px;

    color: var(--color-espresso);

    font-family:
        Georgia,
        "Times New Roman",
        serif;

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

    line-height: 1.3;

    text-decoration: none;

    transition:
        color 0.2s ease;
}


.ai-product-name:hover {
    color: var(--color-gold);
}


/* Normal product price */

.ai-product-price {
    color: var(--color-gold);

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

    letter-spacing: 0.01em;
}


/* Variants */

.ai-product-variants {
    display: flex;
    flex-direction: column;

    gap: 4px;

    margin-top: 6px;
}


.ai-product-variant {
    color: var(--color-muted);

    font-size: 13px;

    line-height: 1.4;
}


/* View product */

.ai-product-view {
    display: inline-flex;
    align-items: center;

    gap: 6px;

    margin-top: 11px;

    color: var(--color-muted);

    font-size: 10px;

    font-weight: 600;

    letter-spacing: 0.08em;

    text-transform: uppercase;

    transition:
        color 0.2s ease;
}


.ai-product-view i {
    font-size: 10px;

    transition:
        transform 0.2s ease;
}


.ai-product-card:hover .ai-product-view {
    color: var(--color-gold);
}


.ai-product-card:hover .ai-product-view i {
    transform: translateX(3px);
}


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

.ai-chat-toggle {
    width: 62px;
    height: 62px;

    border: 1px solid rgba(184, 155, 94, 0.65);
    border-radius: 50%;

    background: var(--color-dark);
    color: var(--color-gold);

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

    font-size: 1.65rem;

    box-shadow:
        0 8px 24px rgba(43, 37, 32, 0.25),
        0 0 0 5px rgba(184, 155, 94, 0.10);

    transition: all 0.3s ease;
}

.ai-chat-toggle:hover {
    transform: translateY(-4px);

    color: var(--color-white);

    box-shadow:
        0 12px 30px rgba(43, 37, 32, 0.3),
        0 0 0 6px rgba(184, 155, 94, 0.14);
}

.ai-chat-toggle:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 5px;
}

@media (max-width: 575.98px) {
    .ai-chat-toggle {
        width: 56px;
        height: 56px;
    }
}



/* =========================================================
   ELANORA — REFINED AI SHOPPING ASSISTANT
   ========================================================= */

/* Chat window */
.ai-chat-window {
    width: 380px;
    max-width: calc(100vw - 32px);

    border: 1px solid rgba(184, 155, 94, 0.35);
    border-radius: 12px;

    background: var(--color-white);

    box-shadow:
        0 18px 55px rgba(43, 37, 32, 0.20),
        0 3px 12px rgba(43, 37, 32, 0.06);
}

/* Chat header */
.ai-chat-header {
    position: relative;

    padding: 21px 20px;

    background:
        linear-gradient(135deg,
            var(--color-dark),
            var(--color-espresso));

    color: var(--color-white);
}

/* Small gold accent */
.ai-chat-header::after {
    content: "";

    position: absolute;

    left: 20px;
    bottom: 0;

    width: 42px;
    height: 2px;

    background: var(--color-gold);
}

.ai-chat-title {
    font-family: Georgia, "Times New Roman", serif;

    font-size: 1.12rem;
    font-weight: 500;

    letter-spacing: 0.025em;
}

.ai-chat-subtitle {
    margin-top: 5px;

    color: rgba(239, 232, 220, 0.82);

    font-size: 0.73rem;
    letter-spacing: 0.035em;
}

.ai-chat-close {
    width: 34px;
    height: 34px;

    border-radius: 50%;

    color: var(--color-champagne);

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--color-gold);
}

/* Messages area */
.ai-chat-messages {
    height: 370px;

    padding: 22px 17px;

    background:
        linear-gradient(180deg,
            #FAF8F4 0%,
            var(--color-ivory) 100%);

    scrollbar-width: thin;
    scrollbar-color: var(--color-champagne) transparent;
}

/* AI message */
.ai-message {
    margin-bottom: 16px;
}

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

    padding: 13px 15px;

    background: var(--color-white);

    border: 1px solid rgba(184, 155, 94, 0.22);
    border-radius: 3px 13px 13px 13px;

    color: var(--color-espresso);

    font-size: 0.87rem;
    line-height: 1.65;

    box-shadow: 0 3px 12px rgba(43, 37, 32, 0.045);
}

/* Customer message */
.user-message {
    margin-bottom: 16px;
}

.user-message-bubble {
    max-width: 85%;

    padding: 12px 15px;

    background: var(--color-dark);

    border: 1px solid rgba(184, 155, 94, 0.18);
    border-radius: 13px 3px 13px 13px;

    color: var(--color-white);

    font-size: 0.87rem;
    line-height: 1.65;

    box-shadow: 0 3px 10px rgba(43, 37, 32, 0.10);
}

/* Input area */
.ai-chat-input-area {
    padding: 15px;

    background: var(--color-white);

    border-top: 1px solid rgba(184, 155, 94, 0.18);
}

#aiChatForm {
    gap: 9px;
    align-items: stretch;
}

.ai-chat-input {
    min-height: 45px;

    padding: 11px 14px;

    border: 1px solid #E8E0D3;
    border-radius: 5px;

    background: #FAF8F4;

    color: var(--color-espresso);

    font-size: 0.85rem;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.ai-chat-input:focus {
    border-color: var(--color-gold);

    background: var(--color-white);

    box-shadow: 0 0 0 3px rgba(184, 155, 94, 0.10);
}

.ai-chat-input::placeholder {
    color: #958A7D;
}

.ai-chat-send {
    flex: 0 0 46px;

    width: 46px;
    min-height: 45px;

    border: 1px solid var(--color-dark);
    border-radius: 5px;

    background: var(--color-dark);
    color: var(--color-gold);

    font-size: 1rem;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.ai-chat-send:hover {
    background: var(--color-gold);
    border-color: var(--color-gold);

    color: var(--color-dark);

    transform: translateY(-1px);
}

/* Typing indicator */
.ai-typing {
    padding: 3px 2px;
    gap: 5px;
}

.ai-typing span {
    width: 6px;
    height: 6px;
}

/* Product recommendations */
.ai-product-cards {
    gap: 12px;
    margin-top: 13px;
}

.ai-product-card {
    border: 1px solid rgba(184, 155, 94, 0.25);
    border-radius: 8px;

    background: var(--color-white);

    box-shadow: 0 3px 12px rgba(43, 37, 32, 0.055);
}

.ai-product-card:hover {
    border-color: var(--color-gold);

    box-shadow: 0 8px 20px rgba(43, 37, 32, 0.10);

    transform: translateY(-2px);
}

.ai-product-image {
    height: 175px;

    background: var(--color-champagne);
}

.ai-product-info {
    padding: 14px 15px 15px;
}

.ai-product-name {
    margin-bottom: 7px;

    font-size: 1rem;
    font-weight: 500;

    line-height: 1.4;
}

.ai-product-price {
    color: #9B7C42;

    font-size: 0.88rem;
    font-weight: 600;
}

.ai-product-variant {
    font-size: 0.78rem;
    line-height: 1.5;
}

.ai-product-view {
    margin-top: 12px;

    color: #8C7855;

    font-size: 0.68rem;
    letter-spacing: 0.09em;
}

/* Mobile refinement */
@media (max-width: 575.98px) {
    .ai-chat-window {
        width: calc(100vw - 32px);

        border-radius: 10px;
    }

    .ai-chat-header {
        padding: 18px 17px;
    }

    .ai-chat-messages {
        height: 340px;

        padding: 18px 14px;
    }

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

    .ai-product-image {
        height: 155px;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {

    .ai-chat-window,
    .ai-chat-toggle,
    .ai-chat-close,
    .ai-chat-send,
    .ai-product-card {
        transition: none;
    }

    .ai-typing span {
        animation: none;
    }
}