/* ========================================== */
/* AI SEARCH STYLES                           */
/* Стили для ИИ поиска в service-control      */
/* ========================================== */

/* ИИ поиск в service-control */
.service-control__ai-search {
    display: flex;
    align-items: center;
    margin: auto;
    gap: 6px;
    flex: 0 0 auto;
    max-width: 350px;
    position: relative;
}

/* ========================================== */
/* AI MODEL SELECTOR                          */
/* Селектор выбора модели ИИ                  */
/* ========================================== */

.ai-model-selector {
    position: relative;
    display: flex;
    align-items: center;
}

.ai-model-selector__icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

.ai-model-selector__icon:hover {
    transform: scale(1.1);
}

.ai-model-selector__robot {
    width: 28px;
    height: 28px;
    color: #1a6b6d;
    transition: color 0.3s ease;
}

.ai-model-selector__icon:hover .ai-model-selector__robot {
    color: #7fc241;
}

.ai-model-selector__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #ffffff;
    border: 2px solid #1a6b6d;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.ai-model-selector:hover .ai-model-selector__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ai-model-selector__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(26, 107, 109, 0.1);
}

.ai-model-selector__option:last-child {
    border-bottom: none;
}

.ai-model-selector__option:hover {
    background: rgba(127, 194, 65, 0.1);
}

.ai-model-selector__option.active {
    background: rgba(26, 107, 109, 0.1);
}

.ai-model-selector__option-name {
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    font-family: Arial, sans-serif;
}

.ai-model-selector__option-check {
    color: #7fc241;
    font-size: 18px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ai-model-selector__option.active .ai-model-selector__option-check {
    opacity: 1;
}

.service-control__ai-input {
    flex: 1;
    height: 34px;
    padding: 0 12px;
 
    background: #ffffff;
    border: 1px solid #b0b0b0;
    border-radius: 6px;
    color: #333333;
    font-size: 13px;
    font-family: Arial, sans-serif;
    transition: all 0.2s ease;
    min-width: 400px;
}

.service-control__ai-input::placeholder {
    color: #999999;
}

.service-control__ai-input:focus {
    outline: none;
    background: #ffffff;
    border-color: #1a6b6d;
    box-shadow: 0 0 0 2px rgba(26, 107, 109, 0.1);
}

.service-control__ai-btn {
    height: 34px;
    width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-radius: 6px;
    color: #1a6b6d;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.service-control__ai-btn:hover {
    background: var(--yellow-btn);
    border-color: #1a6b6d;
    transform: scale(1.1);
}

.service-control__ai-btn:active {
    transform: scale(0.95);
}

/* ========================================== */
/* AI RESPONSE MODAL                          */
/* Модальное окно для ответа ИИ               */
/* ========================================== */

.ai-response-modal {
    display: none;
    position: relative;
    width: calc(100% + 30px);
    height: auto;
    min-height: 300px;
    max-height: calc(100vh - 262px);
    background: linear-gradient(135deg, rgba(26, 107, 109, 0.95) 0%, rgba(16, 16, 16, 0.98) 100%);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    margin: -15px -15px 50px -15px;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 500;
}

.ai-response-modal::-webkit-scrollbar {
    width: 8px;
}

.ai-response-modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.ai-response-modal::-webkit-scrollbar-thumb {
    background: rgba(127, 194, 65, 0.3);
    border-radius: 4px;
}

.ai-response-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(127, 194, 65, 0.5);
}

.ai-response-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        transparent 0%,
        #1a6b6d 20%,
        #7fc241 50%,
        #1a6b6d 80%,
        transparent 100%);
    animation: aiGradientMove 5s ease-in-out infinite;
}

@keyframes aiGradientMove {
    0%, 100% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
}

.ai-response-modal.active {
    display: block;
    opacity: 1;
}

.ai-response-modal__content {
    width: 100%;
    min-height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at top right, rgba(127, 194, 65, 0.05) 0%, transparent 50%);
}

.ai-response-modal__close {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(127, 194, 65, 0.3);
    border-radius: 8px;
    color: #7fc241;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ai-response-modal__close:hover {
    background: rgba(127, 194, 65, 0.2);
    border-color: #7fc241;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(127, 194, 65, 0.4);
}

.ai-response-modal__title {
    font-size: 28px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 32px;
    font-family: Arial, sans-serif;
    text-shadow: 0 2px 8px rgba(127, 194, 65, 0.3);
    letter-spacing: 0.5px;
    position: relative;
    display: inline-block;
}

.ai-response-modal__title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #7fc241 0%, transparent 100%);
    border-radius: 2px;
}

.ai-response-modal__messages {
    flex: 1 1 auto;
    padding-right: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-response-modal__loader {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.ai-response-modal__loader.hidden {
    display: none;
}

/* Сообщение пользователя */
.ai-message--user {
    color: rgba(255, 255, 255, 0.95);
    font-size: 15px;
    line-height: 1.6;
    font-family: Arial, sans-serif;
    padding: 16px 20px;
    background: rgba(127, 194, 65, 0.15);
    border-radius: 12px 12px 4px 12px;
    border-left: 3px solid #7fc241;
    margin-left: auto;
    max-width: 80%;
    animation: messageSlideIn 0.3s ease-out;
}

/* Сообщение ИИ */
.ai-message--ai {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    line-height: 1.8;
    font-family: Arial, sans-serif;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px 12px 12px 4px;
    border-left: 3px solid #1a6b6d;
    max-width: 90%;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================== */
/* AI INPUT WRAPPER                           */
/* Строка ввода для продолжения диалога       */
/* ========================================== */

.ai-response-modal__input-wrapper {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(127, 194, 65, 0.2);
    margin-top: auto;
    max-width: 90%;
}

.ai-response-modal__input-wrapper.visible {
    display: flex;
}

.ai-response-modal__input {
    flex: 1;
    height: 40px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(127, 194, 65, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-family: Arial, sans-serif;
    transition: all 0.2s ease;
}

.ai-response-modal__input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.ai-response-modal__input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: #7fc241;
    box-shadow: 0 0 0 2px rgba(127, 194, 65, 0.2);
}

.ai-response-modal__send-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #7fc241 0%, #1a6b6d 100%);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-response-modal__send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(127, 194, 65, 0.4);
}

.ai-response-modal__send-btn:active {
    transform: scale(0.95);
}

/* ========================================== */
/* AI LOADER ANIMATION                        */
/* Современная анимация загрузки              */
/* ========================================== */

.ai-loader {
    display: flex;
    gap: 16px;
    align-items: center;
    position: relative;
}

.ai-loader::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(127, 194, 65, 0.1) 0%, transparent 70%);
    animation: aiLoaderGlow 2s ease-in-out infinite;
}

@keyframes aiLoaderGlow {
    0%, 100% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.3;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.6;
    }
}

.ai-loader__dot {
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, #7fc241 0%, #1a6b6d 100%);
    border-radius: 50%;
    animation: aiLoaderPulse 1.4s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(127, 194, 65, 0.5);
    position: relative;
    z-index: 1;
}

.ai-loader__dot:nth-child(1) {
    animation-delay: 0s;
}

.ai-loader__dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-loader__dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes aiLoaderPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1.3);
        opacity: 1;
        box-shadow: 0 0 20px rgba(127, 194, 65, 0.8);
    }
}

/* ========================================== */
/* RESPONSIVE                                 */
/* ========================================== */

@media (max-width: 768px) {
    .service-control__ai-search {
        flex: 0 1 100%;
        max-width: 100%;
    }

    .ai-response-modal__content {
        padding: 24px 16px;
    }

    .ai-response-modal__title {
        font-size: 20px;
    }

    .ai-response-modal__text {
        font-size: 14px;
    }
}
