/* Iris Chat Widget v4 - with Anastasia avatar */
.iris-chat-widget {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

.iris-chat-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #6B4C9A;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(107, 76, 154, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.iris-chat-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(107, 76, 154, 0.5);
}

.iris-chat-button img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.iris-chat-tooltip {
    position: absolute;
    left: 76px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    max-width: 220px;
    white-space: normal;
    line-height: 1.4;
}

.iris-chat-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-style: solid;
    border-color: transparent #fff transparent transparent;
}

.iris-chat-button:hover .iris-chat-tooltip,
.iris-chat-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.iris-chat-window {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 360px;
    max-width: calc(100vw - 48px);
    height: 500px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

.iris-chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.iris-chat-header {
    background: #6B4C9A;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.iris-chat-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    object-fit: cover;
}

.iris-chat-header-info {
    flex: 1;
}

.iris-chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.iris-chat-header-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.8;
}

.iris-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.iris-chat-close:hover {
    background: rgba(255,255,255,0.2);
}

.iris-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.iris-chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.iris-chat-message.bot {
    align-self: flex-start;
    background: #F3F0F8;
    color: #333;
    border-bottom-left-radius: 4px;
}

.iris-chat-message.user {
    align-self: flex-end;
    background: #6B4C9A;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.iris-chat-message a {
    color: #6B4C9A;
    text-decoration: underline;
}

.iris-chat-message.bot a {
    color: #6B4C9A;
}

.iris-chat-message.user a {
    color: #fff;
    text-decoration: underline;
}

.iris-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.iris-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.iris-chat-input:focus {
    border-color: #6B4C9A;
}

.iris-chat-send {
    background: #6B4C9A;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.iris-chat-send:hover {
    background: #5a3f85;
}

.iris-chat-send svg {
    width: 20px;
    height: 20px;
}

.iris-chat-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
}

.iris-chat-typing span {
    width: 8px;
    height: 8px;
    background: #6B4C9A;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.iris-chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.iris-chat-typing span:nth-child(2) { animation-delay: -0.16s; }
.iris-chat-typing span:nth-child(3) { animation-delay: 0; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Notification dot */
.iris-chat-notification {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #FF4757;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .iris-chat-window {
        width: calc(100vw - 32px);
        left: 16px;
        right: 16px;
        height: calc(100vh - 100px);
    }
}

/* Markdown styles */
.iris-chat-message strong {
    font-weight: 600;
    color: #6B4C9A;
}

.iris-chat-message em {
    font-style: italic;
    color: #555;
}

.iris-chat-message ul {
    margin: 8px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.iris-chat-message ul li {
    margin: 4px 0;
    line-height: 1.4;
}

.iris-chat-message h1,
.iris-chat-message h2,
.iris-chat-message h3 {
    margin: 12px 0 8px 0;
    font-weight: 600;
    color: #333;
}

.iris-chat-message h1 {
    font-size: 18px;
}

.iris-chat-message h2 {
    font-size: 16px;
}

.iris-chat-message h3 {
    font-size: 15px;
    color: #6B4C9A;
}

.iris-chat-message br {
    display: block;
    content: "";
    margin: 4px 0;
}

/* Product card with image */
.product-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 8px 0;
    align-items: flex-start;
}

.product-card .product-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.product-card .product-info {
    flex: 1;
}

.product-card .product-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.product-card .product-price {
    font-size: 16px;
    font-weight: 600;
    color: #6B4C9A;
    margin-bottom: 8px;
}

.product-card .product-link {
    display: inline-block;
    padding: 6px 12px;
    background: #6B4C9A;
    color: #fff;
    text-decoration: none;
    border-radius: 20px;
    font-size: 12px;
}

/* Product card with image - VISUAL */
.product-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    margin: 12px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(107, 76, 154, 0.2);
}

.product-card .product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.product-card .product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-card .product-name {
    font-weight: 700;
    font-size: 15px;
    color: #333;
    line-height: 1.3;
}

.product-card .product-price {
    font-size: 18px;
    font-weight: 700;
    color: #6B4C9A;
}

.product-card .product-link {
    display: inline-block;
    padding: 12px 20px;
    background: #6B4C9A;
    color: #fff;
    text-decoration: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s, transform 0.2s;
    margin-top: 4px;
}

.product-card .product-link:hover {
    background: #5a3f85;
    transform: scale(1.02);
}

/* Product grid in chat */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin: 12px 0;
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .product-card .product-image {
        height: 220px;
    }
    .product-card .product-name {
        font-size: 16px;
    }
    .product-card .product-link {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* Product card in chat */
.iris-chat-product {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 8px 0;
}

.iris-chat-product img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.iris-chat-product-info {
    flex: 1;
}

.iris-chat-product-info h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: #333;
}

.iris-chat-product-info .price {
    font-size: 16px;
    font-weight: 600;
    color: #6B4C9A;
    margin-bottom: 8px;
}

.iris-chat-product-info a {
    display: inline-block;
    padding: 6px 12px;
    background: #6B4C9A;
    color: #fff;
    text-decoration: none;
    border-radius: 20px;
    font-size: 12px;
}
