/**
 * AI Chat Widget Styles
 * Современный чат-виджет для AI помощника SPB Tuning
 * 
 * Цветовая схема наследуется из app.css (тёмная тема с красным акцентом)
 */

/* ============================================
   CSS Variables для AI Chat
   ============================================ */
:root {
    /* Основные цвета чата */
    --ai-chat-bg: #1A1C1D;
    --ai-chat-header-bg: #202223;
    --ai-chat-input-bg: #252728;
    --ai-chat-message-user-bg: var(--primary-red);
    --ai-chat-message-ai-bg: #2A2C2D;
    --ai-chat-border: #333536;
    
    /* Размеры */
    --ai-chat-width: 600px;
    --ai-chat-height: 600px;
    --ai-chat-button-size: 60px;
    --ai-chat-border-radius: 16px;
    
    /* Тени */
    --ai-chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --ai-chat-button-shadow: 0 4px 20px rgba(207, 9, 57, 0.4);
    
    /* Анимации */
    --ai-chat-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Кнопка открытия чата (FAB)
   ============================================ */
.ai-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: var(--ai-chat-button-size);
    height: var(--ai-chat-button-size);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-red) 0%, #A00730 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--ai-chat-button-shadow);
    transition: all var(--ai-chat-transition);
    z-index: 10000;
    overflow: hidden;
}

.ai-chat-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(207, 9, 57, 0.5);
}

.ai-chat-button:active {
    transform: scale(0.95);
}

.ai-chat-button__icon {
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--ai-chat-transition);
}

.ai-chat-button.is-open .ai-chat-button__icon {
    transform: rotate(90deg);
}

/* Бейдж с количеством новых сообщений */
.ai-chat-button__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--green);
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: ai-badge-bounce 0.5s ease;
}

@keyframes ai-badge-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Пульсирующий эффект для привлечения внимания */
.ai-chat-button__pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary-red);
    opacity: 0;
    animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.ai-chat-button.is-open .ai-chat-button__pulse {
    display: none;
}

/* ============================================
   Окно чата
   ============================================ */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: var(--ai-chat-width);
    height: var(--ai-chat-height);
    max-height: calc(100vh - 140px);
    background: var(--ai-chat-bg);
    border-radius: var(--ai-chat-border-radius);
    box-shadow: var(--ai-chat-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid var(--ai-chat-border);
    
    /* Начальное состояние (скрыто) */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all var(--ai-chat-transition);
}

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

/* ============================================
   Заголовок чата
   ============================================ */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--ai-chat-header-bg);
    border-bottom: 1px solid var(--ai-chat-border);
    flex-shrink: 0;
}

.ai-chat-header__info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-header__avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-red) 0%, #A00730 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.ai-chat-header__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-chat-header__title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
}

.ai-chat-header__status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--special-gray);
}

.ai-chat-header__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: ai-status-pulse 2s infinite;
}

@keyframes ai-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ai-chat-header__status--typing .ai-chat-header__status-dot {
    background: var(--yellow);
}

.ai-chat-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-header__btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--special-gray);
    transition: all var(--ai-chat-transition);
}

.ai-chat-header__btn:hover {
    background: var(--btn-gray);
    color: var(--white);
}

.ai-chat-header__btn--close:hover {
    background: rgba(207, 9, 57, 0.2);
    color: var(--primary-red);
}

/* ============================================
   Область сообщений
   ============================================ */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Кастомный скроллбар */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: var(--btn-gray);
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--normal-gray);
}

/* ============================================
   Приветственное сообщение
   ============================================ */
.ai-chat-welcome {
    text-align: center;
    padding: 40px 20px;
}

.ai-chat-welcome__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(207, 9, 57, 0.2) 0%, rgba(160, 7, 48, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-red);
}

.ai-chat-welcome__title {
    font-size: 22px;
    font-weight: 600;
    color: var(--white);
    margin: 0 0 12px;
}

.ai-chat-welcome__text {
    font-size: 14px;
    color: var(--special-gray);
    line-height: 1.6;
    margin: 0 0 24px;
}

.ai-chat-welcome__suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chat-suggestion {
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--ai-chat-input-bg);
    border: 1px solid var(--ai-chat-border);
    color: var(--white);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all var(--ai-chat-transition);
}

.ai-chat-suggestion:hover {
    background: var(--btn-gray);
    border-color: var(--primary-red);
}

/* ============================================
   Сообщения пользователя и AI
   ============================================ */
.ai-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: ai-message-appear 0.3s ease;
}

@keyframes ai-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Сообщение пользователя */
.ai-chat-message--user {
    align-self: flex-end;
}

.ai-chat-message--user .ai-chat-message__content {
    background: linear-gradient(135deg, var(--primary-red) 0%, #A00730 100%);
    color: var(--white);
    border-radius: 16px 16px 4px 16px;
}

/* Сообщение AI */
.ai-chat-message--ai {
    align-self: flex-start;
}

.ai-chat-message--ai .ai-chat-message__content {
    background: var(--ai-chat-message-ai-bg);
    color: var(--white);
    border-radius: 16px 16px 16px 4px;
}

.ai-chat-message__content {
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

/* Markdown стили внутри сообщений AI */
.ai-chat-message--ai .ai-chat-message__content p {
    margin: 0 0 12px;
}

.ai-chat-message--ai .ai-chat-message__content p:last-child {
    margin-bottom: 0;
}

.ai-chat-message--ai .ai-chat-message__content strong {
    color: var(--white);
    font-weight: 600;
}

.ai-chat-message--ai .ai-chat-message__content em {
    color: var(--special-gray);
}

.ai-chat-message--ai .ai-chat-message__content ul,
.ai-chat-message--ai .ai-chat-message__content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-chat-message--ai .ai-chat-message__content li {
    margin-bottom: 6px;
    list-style: disc;
}

.ai-chat-message--ai .ai-chat-message__content ol li {
    list-style: decimal;
}

.ai-chat-message--ai .ai-chat-message__content a {
    color: var(--primary-red);
    text-decoration: none;
}

.ai-chat-message--ai .ai-chat-message__content a:hover {
    text-decoration: underline;
}

/* Ссылки на товары [1], [2] и т.д. */
.ai-chat-message--ai .ai-chat-message__content a.ai-product-ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 6px;
    margin: 0 2px;
    background: linear-gradient(135deg, var(--primary-red) 0%, #A00730 100%);
    color: var(--white);
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: all var(--ai-chat-transition);
    vertical-align: middle;
}

.ai-chat-message--ai .ai-chat-message__content a.ai-product-ref:hover {
    background: var(--light-gray, #4A4D4F);
    text-decoration: none;
}

.ai-chat-message--ai .ai-chat-message__content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Monaco', 'Consolas', monospace;
}

.ai-chat-message--ai .ai-chat-message__content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.ai-chat-message--ai .ai-chat-message__content pre code {
    background: none;
    padding: 0;
}

/* Время сообщения */
.ai-chat-message__time {
    font-size: 11px;
    color: var(--light-gray);
    margin-top: 6px;
    padding: 0 4px;
}

.ai-chat-message--user .ai-chat-message__time {
    text-align: right;
}

/* Feedback кнопки */
.ai-chat-message__feedback {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity var(--ai-chat-transition);
}

.ai-chat-message:hover .ai-chat-message__feedback {
    opacity: 1;
}

.ai-chat-feedback-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--ai-chat-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--ai-chat-transition);
}

.ai-chat-feedback-btn:hover {
    background: var(--btn-gray);
}

.ai-chat-feedback-btn.is-active {
    border-color: var(--primary-red);
}

.ai-chat-feedback-btn--positive.is-active {
    border-color: var(--green);
    background: rgba(24, 177, 77, 0.2);
}

.ai-chat-feedback-btn--negative.is-active {
    border-color: var(--primary-red);
    background: rgba(207, 9, 57, 0.2);
}

/* ============================================
   Карточки товаров в сообщениях
   ============================================ */
.ai-chat-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.ai-chat-products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.ai-chat-products-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--special-gray);
}

.ai-chat-products-more {
    font-size: 12px;
    color: var(--primary-red);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--ai-chat-transition);
}

.ai-chat-products-more:hover {
    color: var(--btn-hover);
}

/* Карточка товара (компактная версия) */
.ai-product-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--ai-chat-border);
    transition: all var(--ai-chat-transition);
}

.ai-product-card:hover {
    border-color: var(--primary-red);
    background: rgba(0, 0, 0, 0.3);
}

.ai-product-card__image {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--dark-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ai-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-product-card__no-image {
    color: var(--normal-gray);
}

.ai-product-card__discount {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--primary-red);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
}

.ai-product-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-product-card__title {
    font-size: 13px;
    font-weight: 500;
    color: var(--white);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.ai-product-card__title:hover {
    color: var(--primary-red);
}

.ai-product-card__vendor {
    font-size: 11px;
    color: var(--light-gray);
}

.ai-product-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}

.ai-product-card__price-block {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-product-card__price {
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
}

.ai-product-card__price-old {
    font-size: 11px;
    color: var(--light-gray);
    text-decoration: line-through;
}

.ai-product-card__stock {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-product-card__stock--in {
    color: var(--green);
}

.ai-product-card__stock--out {
    color: var(--yellow);
}

.ai-product-card__stock-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.ai-product-card__btn {
    display: none; /* Скрыто в компактном виде */
}

/* ============================================
   Typing индикатор
   ============================================ */
.ai-chat-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--ai-chat-bg);
}

.ai-chat-typing__avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-red) 0%, #A00730 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.ai-chat-typing__dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-chat-typing__dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--special-gray);
    animation: ai-typing-dot 1.4s infinite ease-in-out both;
}

.ai-chat-typing__dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-chat-typing__dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.ai-chat-typing__dots span:nth-child(3) {
    animation-delay: 0s;
}

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

.ai-chat-typing__text {
    font-size: 12px;
    color: var(--special-gray);
}

/* ============================================
   Форма ввода сообщения
   ============================================ */
.ai-chat-input-wrapper {
    padding: 16px 20px;
    background: var(--ai-chat-header-bg);
    border-top: 1px solid var(--ai-chat-border);
    flex-shrink: 0;
}

.ai-chat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--ai-chat-input-bg);
    border-radius: 14px;
    padding: 8px 12px;
    border: 1px solid var(--ai-chat-border);
    transition: border-color var(--ai-chat-transition);
}

.ai-chat-input-container:focus-within {
    border-color: var(--primary-red);
}

.ai-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--white);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    min-height: 30px;
    font-family: inherit;
}

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

.ai-chat-send {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    background: var(--primary-red);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    transition: all var(--ai-chat-transition);
}

.ai-chat-send:hover:not(:disabled) {
    background: var(--btn-hover);
    transform: scale(1.05);
}

.ai-chat-send:disabled {
    background: var(--btn-gray);
    cursor: not-allowed;
    opacity: 0.5;
}

.ai-chat-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.ai-chat-char-count {
    font-size: 11px;
    color: var(--light-gray);
}

.ai-chat-powered {
    font-size: 10px;
    color: var(--normal-gray);
}

/* ============================================
   Модальное окно с товарами
   ============================================ */
.ai-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all var(--ai-chat-transition);
}

.ai-chat-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.ai-chat-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.ai-chat-modal__content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    background: var(--ai-chat-bg);
    border-radius: var(--ai-chat-border-radius);
    border: 1px solid var(--ai-chat-border);
    box-shadow: var(--ai-chat-shadow);
    display: flex;
    flex-direction: column;
    transition: transform var(--ai-chat-transition);
}

.ai-chat-modal.is-open .ai-chat-modal__content {
    transform: translate(-50%, -50%) scale(1);
}

.ai-chat-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ai-chat-border);
}

.ai-chat-modal__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
}

.ai-chat-modal__close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--special-gray);
    transition: all var(--ai-chat-transition);
}

.ai-chat-modal__close:hover {
    background: var(--btn-gray);
    color: var(--white);
}

.ai-chat-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

/* Полная карточка товара в модальном окне */
.ai-chat-modal__body .ai-product-card {
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
}

.ai-chat-modal__body .ai-product-card__image {
    width: 100%;
    height: 140px;
    margin-bottom: 8px;
}

.ai-chat-modal__body .ai-product-card__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
    padding: 10px;
    background: var(--primary-red);
    border-radius: 8px;
    color: var(--white);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--ai-chat-transition);
}

.ai-chat-modal__body .ai-product-card__btn:hover {
    background: var(--btn-hover);
}

/* ============================================
   Сообщение об ошибке
   ============================================ */
.ai-chat-error {
    padding: 14px 18px;
    background: rgba(207, 9, 57, 0.15);
    border: 1px solid rgba(207, 9, 57, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-error__icon {
    width: 24px;
    height: 24px;
    color: var(--primary-red);
    flex-shrink: 0;
}

.ai-chat-error__text {
    font-size: 13px;
    color: var(--white);
    line-height: 1.5;
}

.ai-chat-error__retry {
    margin-top: 8px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--primary-red);
    border-radius: 6px;
    color: var(--primary-red);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--ai-chat-transition);
}

.ai-chat-error__retry:hover {
    background: var(--primary-red);
    color: var(--white);
}

/* ============================================
   Адаптивность для мобильных устройств
   ============================================ */
@media (max-width: 767.98px) {
    .ai-chat-button {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
    }

    .ai-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .ai-chat-window.is-open {
        transform: translateY(0);
    }

    .ai-chat-header {
        padding: 16px;
    }

    .ai-chat-messages {
        padding: 16px;
    }

    .ai-chat-input-wrapper {
        padding: 12px 16px;
        /* Учитываем safe area на iOS */
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .ai-chat-welcome {
        padding: 30px 16px;
    }

    .ai-chat-welcome__icon {
        width: 64px;
        height: 64px;
    }

    .ai-chat-welcome__title {
        font-size: 20px;
    }

    .ai-chat-modal__content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .ai-chat-modal__body {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .ai-chat-modal__body .ai-product-card__image {
        height: 100px;
    }
}

@media (max-width: 380px) {
    .ai-chat-modal__body {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Темная/светлая тема (опционально)
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .ai-chat-button,
    .ai-chat-window,
    .ai-chat-message,
    .ai-chat-modal {
        transition: none;
    }

    .ai-chat-button__pulse,
    .ai-chat-header__status-dot,
    .ai-chat-typing__dots span {
        animation: none;
    }
}

/* ============================================
   Состояние загрузки
   ============================================ */
.ai-chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.ai-chat-loading__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--ai-chat-border);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: ai-spin 0.8s linear infinite;
}

@keyframes ai-spin {
    to { transform: rotate(360deg); }
}
