/* ============================================
   CHAT SECTION
   ============================================ */

.chat-section {
    padding: 100px 20px;
    background-color: var(--bg-light);
}

.chat-container {
    max-width: 1200px;   /* как у services */
    margin: 0 auto;
}

.chat-wrapper {
    width: 100%;
    background: linear-gradient(180deg, #ffffff 0%, #fcfcfc 100%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 24px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.06),
        0 24px 60px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.chat-wrapper:hover {
    transform: translateY(-2px);
    box-shadow:
        0 14px 36px rgba(0, 0, 0, 0.08),
        0 28px 70px rgba(204, 255, 0, 0.10);
}

/* Header */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 28px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.header-left h2 {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-dark);
}

.session-info {
    margin: 0;
    color: #777;
    font-size: 14px;
}

.header-right {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn-icon {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    transform: translateY(-2px);
    border-color: rgba(204, 255, 0, 0.45);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.btn-icon.danger:hover {
    background: #fff2f2;
    border-color: #ffb3b3;
}

/* Messages */
.chat-messages {
    height: 420px;
    overflow-y: auto;
    padding: 28px;
    background: linear-gradient(180deg, #fcfcfc 0%, #f9f9f9 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    animation: messageFadeIn 0.25s ease;
}

@keyframes messageFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.message.user .message-content {
    background: var(--primary-color);
    color: var(--text-dark);
    border-bottom-right-radius: 8px;
}

.message.assistant .message-content {
    background: #f1f1f1;
    color: var(--text-dark);
    border-bottom-left-radius: 8px;
}

/* Input area */
.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    resize: none;
    min-height: 48px;
    max-height: 160px;
    padding: 12px 16px;
    border: 2px solid var(--gray-medium);
    border-radius: 16px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    transition: var(--transition);
    background: #fff;
    overflow-y: auto;
    max-height: 140px;
}

/* MOBILE CHAT LAYOUT */
@media (max-width: 768px) {

    .chat-input-area {
        flex-direction: column;
        gap: 10px;
    }

    .chat-input {
        width: 100%;
        flex: none;
    }

    .send-chat-btn {
        width: 100%;
    }

}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(204, 255, 0, 0.12);
}

.send-btn {
    min-width: 110px;
    height: 52px;
    align-self: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 16px;
    font-weight: 700;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(204, 255, 0, 0.28);
}

.send-icon {
    font-size: 18px;
}

/* Footer */
.chat-footer {
    padding: 0 24px 20px;
    color: #777;
    background: #fff;
}

.typing-message .message-content {
    opacity: 0.8;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-section {
        padding: 80px 20px;
    }

    .chat-header,
    .chat-input-area {
        flex-direction: column;
    }

    .header-right {
        width: 100%;
        justify-content: flex-start;
    }

    .send-btn {
        width: 100%;
    }

    .message-content {
        max-width: 90%;
    }

    .header-left h2 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .chat-section {
        padding: 60px 12px;
    }

    .chat-wrapper {
        border-radius: 18px;
    }

    .chat-messages {
        padding: 18px;
    }

    .chat-header {
        padding: 20px;
    }

    .chat-input-area {
        padding: 16px;
    }
}