/**
 * AI-Переговорщик - Стили
 * Консистентный дизайн с Kuvalda+ (cards-fix.css)
 * 
 * @version 1.0.0
 * @date 2025-12-18
 */

/* ==================== OVERLAY & MODAL ==================== */

.ai-negotiator-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ai-negotiator-overlay.ai-negotiator-visible {
    opacity: 1;
}

.ai-negotiator-modal {
    background: #ffffff;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.ai-negotiator-visible .ai-negotiator-modal {
    transform: translateY(0);
}

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

.ai-negotiator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e4e4e4;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.ai-negotiator-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.ai-negotiator-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-negotiator-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== BODY ==================== */

.ai-negotiator-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ==================== INPUT SECTION ==================== */

.ai-negotiator-input-section {
    margin-bottom: 16px;
}

.ai-negotiator-input-section label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.ai-input-hint {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 12px;
    line-height: 1.4;
}

.ai-negotiator-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.ai-negotiator-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-negotiator-textarea::placeholder {
    color: #999;
}

.ai-negotiator-char-count {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

/* ==================== CONTEXT ==================== */

.ai-negotiator-context {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ai-context-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 13px;
    color: #666;
}

/* ==================== BUTTONS ==================== */

.ai-negotiator-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ai-negotiator-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
}

.ai-negotiator-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.ai-negotiator-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.ai-btn-loader {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== RESULT SECTION ==================== */

.ai-negotiator-result {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e4e4e4;
}

/* Error */
.ai-result-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    color: #dc2626;
    font-size: 14px;
}

/* Result Header */
.ai-result-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.ai-client-type {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
}

.ai-type-serious {
    background: #ecfdf5;
    color: #059669;
}

.ai-type-bargain {
    background: #fffbeb;
    color: #d97706;
}

.ai-type-waster {
    background: #fef2f2;
    color: #dc2626;
}

.ai-type-unknown {
    background: #f5f5f5;
    color: #666;
}

.ai-probabilities {
    display: flex;
    gap: 16px;
}

.ai-prob-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.ai-prob-label {
    color: #666;
}

.ai-prob-value {
    font-weight: 600;
    color: #333;
}

/* Result Sections */
.ai-result-section {
    margin-bottom: 16px;
}

.ai-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
}

/* Signal Lists */
.ai-signal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ai-signal-list li {
    position: relative;
    padding: 8px 12px 8px 28px;
    margin-bottom: 4px;
    border-radius: 8px;
    font-size: 14px;
}

.ai-signals-positive li {
    background: #ecfdf5;
    color: #065f46;
}

.ai-signals-positive li::before {
    content: '✓';
    position: absolute;
    left: 10px;
    color: #10b981;
    font-weight: bold;
}

.ai-signals-negative li {
    background: #fef2f2;
    color: #991b1b;
}

.ai-signals-negative li::before {
    content: '!';
    position: absolute;
    left: 12px;
    color: #ef4444;
    font-weight: bold;
}

/* Extracted Data */
.ai-extracted-data {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.ai-data-item {
    padding: 10px 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 13px;
}

.ai-data-label {
    display: block;
    color: #666;
    margin-bottom: 2px;
}

.ai-data-value {
    font-weight: 500;
    color: #333;
}

/* Strategy List */
.ai-strategy-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: strategy;
}

.ai-strategy-list li {
    position: relative;
    padding: 8px 12px 8px 36px;
    margin-bottom: 4px;
    background: #eff6ff;
    border-radius: 8px;
    font-size: 14px;
    color: #1e40af;
    counter-increment: strategy;
}

.ai-strategy-list li::before {
    content: counter(strategy);
    position: absolute;
    left: 10px;
    width: 20px;
    height: 20px;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Suggested Response */
.ai-response-section {
    background: #f0fdf4;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.ai-response-section .ai-section-title {
    color: #166534;
}

.ai-suggested-response {
    position: relative;
}

.ai-suggested-response p {
    margin: 0 0 12px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #166534;
    white-space: pre-wrap;
}

.ai-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #22c55e;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-copy-btn:hover {
    background: #16a34a;
}

/* Tips */
.ai-tips-section {
    background: #fefce8;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #fef08a;
}

.ai-tips-section .ai-section-title {
    color: #854d0e;
}

.ai-tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ai-tips-list li {
    padding: 6px 0;
    font-size: 13px;
    color: #854d0e;
}

.ai-tips-list li::before {
    content: '💡 ';
}

/* Meta */
.ai-result-meta {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    margin-top: 16px;
    border-top: 1px solid #e4e4e4;
    font-size: 12px;
    color: #999;
}

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

.ai-negotiator-fab {
    position: fixed;
    bottom: 80px;
    right: 16px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    z-index: 9999;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-negotiator-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.ai-negotiator-fab:active {
    transform: scale(0.95);
}

/* Tooltip */
.ai-negotiator-fab::after {
    content: 'AI-помощник';
    position: absolute;
    right: 100%;
    margin-right: 12px;
    padding: 6px 12px;
    background: #333;
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.ai-negotiator-fab:hover::after {
    opacity: 1;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 480px) {
    .ai-negotiator-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .ai-negotiator-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }

    .ai-probabilities {
        flex-direction: column;
        gap: 8px;
    }

    .ai-extracted-data {
        grid-template-columns: 1fr;
    }

    .ai-negotiator-fab {
        bottom: 70px;
        right: 20px;
        width: 64px;
        height: 64px;
        font-size: 36px;
    }
    
    .ai-fab-icon {
        width: 54px;
        height: 54px;
    }

    .ai-negotiator-fab::after {
        display: none;
    }
}

/* ==================== DARK MODE SUPPORT ==================== */

@media (prefers-color-scheme: dark) {
    /* 
     * Пока не включаем тёмную тему, 
     * т.к. Kuvalda+ использует светлую тему
     * Оставляем заготовку на будущее
     */
}
/**
 * AI-Переговорщик - Дополнительные стили v2.0
 * Добавить в конец ai-negotiator.css
 * 
 * @version 2.0.0
 * @date 2025-12-20
 */

/* ==================== ТИП СООБЩЕНИЯ (BADGE) ==================== */

.ai-message-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

.ai-msgtype-new {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.ai-msgtype-price {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.ai-msgtype-complaint {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.ai-msgtype-clarify {
    background: #f3e8ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
}

.ai-msgtype-positive {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.ai-msgtype-unknown {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #e0e0e0;
}

/* ==================== ДОПОЛНИТЕЛЬНЫЕ ТИПЫ КЛИЕНТОВ ==================== */

.ai-type-conflict {
    background: #fef2f2;
    color: #b91c1c;
}

.ai-type-satisfied {
    background: #ecfdf5;
    color: #047857;
}

/* ==================== АНАЛИЗ СИТУАЦИИ ==================== */

.ai-situation-section {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.ai-situation-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #475569;
}

/* ==================== ОЦЕНКА РИСКОВ ==================== */

.ai-risk-section {
    padding: 12px 16px;
    border-radius: 12px;
}

.ai-risk-low {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.ai-risk-low .ai-section-title {
    color: #047857;
}

.ai-risk-medium {
    background: #fffbeb;
    border: 1px solid #fcd34d;
}

.ai-risk-medium .ai-section-title {
    color: #b45309;
}

.ai-risk-high {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.ai-risk-high .ai-section-title {
    color: #b91c1c;
}

.ai-risk-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.ai-risk-list li {
    padding: 4px 0;
    font-size: 13px;
    color: inherit;
}

.ai-risk-list li::before {
    content: '• ';
}

/* ==================== ЧЕГО НЕ ДЕЛАТЬ ==================== */

.ai-donot-section {
    background: #fef2f2;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #fecaca;
}

.ai-donot-section .ai-section-title {
    color: #b91c1c;
}

.ai-donot-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.ai-donot-list li {
    position: relative;
    padding: 8px 12px 8px 28px;
    margin-bottom: 4px;
    background: #fff5f5;
    border-radius: 8px;
    font-size: 13px;
    color: #991b1b;
}

.ai-donot-list li::before {
    content: '✗';
    position: absolute;
    left: 10px;
    color: #ef4444;
    font-weight: bold;
}

/* ==================== СООБЩЕНИЕ С ПРЕТЕНЗИЕЙ ==================== */

.ai-type-complaint-msg {
    background: #fef3c7;
    color: #b45309;
}

/* ==================== АНИМАЦИЯ ПОКАЧИВАНИЯ FAB ==================== */

/*
 * НАСТРОЙКИ АНИМАЦИИ:
 * --fab-wave-amplitude: амплитуда (высота подъёма), по умолчанию 6px
 * --fab-wave-duration: длительность цикла, по умолчанию 3s (чем меньше - тем чаще)
 */

.ai-negotiator-fab {
    --fab-wave-amplitude: 6px;      /* ← Амплитуда: 4px (слабо) | 6px (средне) | 10px (сильно) */
    --fab-wave-duration: 3s;        /* ← Частота: 2s (быстро) | 3s (средне) | 5s (медленно) */
    
    animation: fabWaveFloat var(--fab-wave-duration) ease-in-out infinite;
}

@keyframes fabWaveFloat {
    0% {
        transform: translateY(0);
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    }
    50% {
        transform: translateY(calc(-1 * var(--fab-wave-amplitude)));
        box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5);
    }
    100% {
        transform: translateY(0);
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    }
}

/* Отключаем анимацию при наведении чтобы не конфликтовала */
.ai-negotiator-fab:hover {
    animation-play-state: paused;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

/* Отключаем анимацию при нажатии */
.ai-negotiator-fab:active {
    animation-play-state: paused;
    transform: scale(0.95);
}