/* ИИ Помощник - Чистые стили БЕЗ градиентов */

/* Кастомная прокрутка */
#chat-area::-webkit-scrollbar {
    width: 6px;
}

#chat-area::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

#chat-area::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

#chat-area::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Анимации для сообщений */
.message-appear {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Улучшенные стили для tooltips */
.tooltip {
    position: fixed;
    z-index: 99999;
    max-width: 250px;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    animation: tooltipPop 0.3s ease-out;
}

@keyframes tooltipPop {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tooltip-content {
    background: #1e293b;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
    line-height: 1.4;
    text-align: center;
    word-wrap: break-word;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    font-size: 14px;
    font-weight: 600;
    min-width: 120px;
}

.tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.tooltip.top .tooltip-arrow {
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid #1e293b;
}

.tooltip.bottom .tooltip-arrow {
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid #1e293b;
}

.tooltip.left .tooltip-arrow {
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 7px solid #1e293b;
}

.tooltip.right .tooltip-arrow {
    left: -7px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right: 7px solid #1e293b;
}

/* Стили для управления окном */
.ai-assistant.has-new-messages::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* Улучшенные hover эффекты для кнопок */
button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

button:active {
    transform: translateY(0) scale(0.98);
}

/* Специальные hover эффекты для tooltip кнопок */
.tooltip-trigger:hover {
    transform: translateY(-1px);
}

.tooltip-trigger:hover::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: rgba(59, 130, 246, 0.1);
    z-index: -1;
    opacity: 0;
    animation: hoverGlow 0.3s ease-in-out forwards;
}

@keyframes hoverGlow {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Стили для записи голоса */
.recording {
    animation: recordingPulse 1s infinite;
}

@keyframes recordingPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

/* Адаптивность */
@media (max-width: 640px) {
    .ai-assistant {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .space-x-3 > * + * {
        margin-left: 0.5rem;
    }
    
    .p-4 {
        padding: 1rem;
    }
    
    .text-lg {
        font-size: 1rem;
    }
    
    button {
        padding: 0.5rem;
    }
}

/* Стили для drag & drop файлов */
.drag-over {
    border: 2px dashed #10b981 !important;
    background-color: #ecfdf5 !important;
}

/* Стили для статуса подключения */
.status-indicator {
    position: relative;
}

.status-indicator.connected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #10b981;
    transform: translate(-50%, -50%) scale(0);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Стили для focus состояний */
button:focus,
textarea:focus,
input:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Анимация для печатающих точек */
.animate-bounce {
    animation: bounce 1s infinite;
}

.animate-bounce:nth-child(1) {
    animation-delay: 0ms;
}

.animate-bounce:nth-child(2) {
    animation-delay: 150ms;
}

.animate-bounce:nth-child(3) {
    animation-delay: 300ms;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Стили для свёрнутого окна */
.ai-assistant.minimized {
    height: 60px !important;
    overflow: hidden;
}

.ai-assistant.minimized main,
.ai-assistant.minimized footer {
    display: none;
}

/* Стили для развёрнутого окна */
.ai-assistant.maximized {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0 !important;
    z-index: 9999;
}

/* Улучшенные тени */
.shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Плавные переходы */
.transition-colors {
    transition-property: color, background-color, border-color;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}

/* Стили для файлов */
#file-preview {
    animation: slideDown 0.3s ease-out;
}

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

/* Убираем outline у кнопок при клике мышью */
button:focus:not(:focus-visible) {
    outline: none;
}

/* Стили для уведомлений */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    max-width: 300px;
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    transform: translateX(400px);
    transition: transform 0.3s ease-in-out;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background-color: #10b981;
}

.notification.error {
    background-color: #ef4444;
}

.notification.info {
    background-color: #3b82f6;
}

/* Скрытие элементов */
.hidden {
    display: none !important;
}

/* Стили для модальных окон */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25), 0 10px 20px rgba(0, 0, 0, 0.1);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-overlay.show .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 24px 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 16px;
    margin-bottom: 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    margin: 0;
}

.modal-close-btn {
    padding: 8px;
    border: none;
    background: #f8fafc;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: #475569;
    transform: scale(1.05);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid #f1f5f9;
    margin-top: 0;
}

/* Стили для кнопок модальных окон */
.btn-primary {
    background: #1e293b;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.btn-primary:hover {
    background: #334155;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.3);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #475569;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.98);
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-danger:active {
    transform: translateY(0) scale(0.98);
}

/* Анимации для модальных окон */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
}

/* Адаптивность для модальных окон */
@media (max-width: 640px) {
    .modal-container {
        margin: 20px;
        max-width: calc(100vw - 40px);
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 20px 20px 0 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 12px 20px 20px 20px;
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        justify-content: center;
    }
}

/* Улучшенная типографика */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Стили для активных состояний */
.active {
    background-color: #1e293b !important;
    color: white !important;
}

/* Стили для disabled состояний */
.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}