/* AI Assistant Styles */

.ai-chat-container {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    height: calc(100vh - 200px); /* Высота страницы минус header/footer */
    min-height: 500px; /* Минимальная высота */
    max-height: 800px; /* Максимальная высота */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-header {
    background: linear-gradient(135deg, #527496 0%, #a8d5f3 100%);
    color: white !important;
    padding: 20px;
    text-align: center;
    border: none;
}

.ai-chat-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
}

.ai-chat-header p {
    margin: 5px 0 0 0;
    opacity: 0.9;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
}

.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.ai-welcome-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4c5e70 0%, #0056b3 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 15px;
    flex-shrink: 0;
}

.ai-message {
    background: white;
    padding: 15px 20px;
    border-radius: 20px 20px 20px 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 80%;
    word-wrap: break-word;
}

.user-message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    justify-content: flex-end;
}

.user-message .ai-message {
    background: linear-gradient(135deg, #1f73a3 0%, #4c6779 100%);
    color: white;
    border-radius: 20px 20px 5px 20px;
    margin-right: 15px;
    margin-left: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #6c757d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.ai-chat-input {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.ai-chat-input .input-group {
    margin-bottom: 10px;
}

.ai-chat-input .form-control {
    border-radius: 25px;
    border: 2px solid #e9ecef;
    padding: 12px 20px;
    font-size: 14px;
}

.ai-chat-input .form-control:focus {
    border-color: #39699c;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.ai-chat-input .btn {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #315b86 0%, #0056b3 100%);
    border: none;
}

.ai-chat-input .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
}

.ai-chat-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.ai-chat-actions .btn {
    border-radius: 20px;
    font-size: 13px;
    padding: 10px 20px;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 100px;
}

.ai-chat-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Боковая панель */
.ai-sidebar {
    padding: 20px;
}

.ai-suggestions {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ai-suggestions h5 {
    color: #3e6691;
    margin-bottom: 15px;
    font-weight: 600;
}

.suggestion-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    line-height: 1.4;
}

.suggestion-item:hover {
    background: #3e638b;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.suggestion-item i {
    margin-right: 8px;
    color: #3b5f86;
}

.suggestion-item:hover i {
    color: white;
}

.ai-company-info {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ai-company-info h5 {
    color: #406791;
    margin-bottom: 15px;
    font-weight: 600;
}

.company-details p {
    margin-bottom: 8px;
    font-size: 14px;
}

.company-details i {
    color: #406791;
    margin-right: 8px;
    width: 16px;
}

.ai-stats {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.ai-stats h5 {
    color: #406791;
    margin-bottom: 15px;
    font-weight: 600;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
    font-size: 14px;
}

.stats-item:last-child {
    border-bottom: none;
}

.stats-label {
    color: #6c757d;
}

.stats-value {
    font-weight: 600;
    color: #406791;
}

/* Индикатор загрузки */
.ai-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 3rem;
    color: #406791;
    margin-bottom: 15px;
}

.loading-spinner p {
    margin: 0;
    color: #6c757d;
    font-size: 16px;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message, .user-message {
    animation: fadeIn 0.5s ease;
}

/* Стили для ссылок в сообщениях AI */
.ai-link {
    color: #406791;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
    word-break: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: inline-block;
}

.ai-link:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
    text-decoration: none;
}

.ai-link:visited {
    color: #354b63;
}

/* Стили для кода в сообщениях */
.ai-message code {
    background: #f8f9fa;
    color: #bd7829;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid #e9ecef;
}

/* Стили для жирного текста */
.ai-message strong {
    font-weight: 600;
    color: #495057;
}

/* Стили для курсива */
.ai-message em {
    font-style: italic;
    color: #6c757d;
}

/* Адаптивность */
@media (max-width: 768px) {
    .ai-chat-container {
        height: calc(100vh - 120px);
        min-height: 400px;
        max-height: none;
        margin: 10px;
        border-radius: 10px;
    }
    
    .ai-chat-header {
        padding: 10px 15px;
    }
    
    .ai-chat-header h2 {
        font-size: 1.5rem;
        margin: 0;
    }
    
    .ai-chat-header p {
        margin: 3px 0 0 0;
        font-size: 1.3rem;
    }
    
    .ai-chat-messages {
        padding: 10px;
    }
    
    .ai-welcome-message {
        margin-bottom: 15px;
    }
    
    .ai-avatar {
        width: 32px;
        height: 32px;
        margin-right: 10px;
    }
    
    .ai-message {
        max-width: 85%;
        padding: 10px 12px;
        font-size: 1.1rem;
        line-height: 1.4;
    }
    
    .user-message {
        margin-bottom: 15px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
    }
    
    .ai-chat-input {
        padding: 10px;
    }
    
    .ai-chat-input .form-control {
        padding: 10px 15px;
        font-size: 14px;
        border-radius: 20px;
    }
    
    .ai-chat-input .btn {
        width: 40px;
        height: 40px;
    }
    
    .ai-chat-actions {
        gap: 10px;
        margin-top: 10px;
        flex-wrap: wrap;
    }
    
    .ai-chat-actions .btn {
        font-size: 12px;
        padding: 8px 12px;
        min-width: 80px;
    }
    
    .ai-sidebar {
        padding: 10px;
    }
    
    .ai-suggestions,
    .ai-company-info,
    .ai-stats {
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 10px;
    }
    
    .ai-suggestions h5,
    .ai-company-info h5,
    .ai-stats h5 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .suggestion-item {
        padding: 8px 10px;
        margin-bottom: 8px;
        font-size: 13px;
    }
    
    .company-details p {
        margin-bottom: 6px;
        font-size: 13px;
    }
    
    .stats-item {
        padding: 6px 0;
        font-size: 13px;
    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 480px) {
    .ai-chat-container {
        height: calc(100vh - 100px);
        margin: 5px;
        border-radius: 8px;
    }
    
    .ai-chat-header {
        padding: 8px 12px;
    }
    
    .ai-chat-header h2 {
        font-size: 1.1rem;
    }
    
    .ai-chat-header p {
        font-size: 0.8rem;
    }
    
    .ai-chat-messages {
        padding: 8px;
    }
    
    .ai-message {
        max-width: 90%;
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .ai-chat-input {
        padding: 8px;
    }
    
    .ai-chat-input .form-control {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .ai-chat-input .btn {
        width: 36px;
        height: 36px;
    }
    
    .ai-chat-actions .btn {
        font-size: 11px;
        padding: 6px 10px;
        min-width: 70px;
    }
    
    .ai-sidebar {
        padding: 8px;
    }
    
    .ai-suggestions,
    .ai-company-info,
    .ai-stats {
        padding: 10px;
        margin-bottom: 8px;
    }
}

/* Скроллбар */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}
