/* ============================================================
   ЧАТ-БОТ - ОБНОВЛЕННЫЙ ДИЗАЙН
   ============================================================ */

/* ===== КНОПКА-ТРИГГЕР ===== */
.chatbot-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4a853, #e8c878);
    color: #1a1510;
    border: none;
    box-shadow: 0 4px 20px rgba(212, 168, 83, 0.4);
    cursor: pointer;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    backdrop-filter: blur(10px);
}

.chatbot-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 32px rgba(212, 168, 83, 0.6);
}

.chatbot-trigger:active {
    transform: scale(0.9);
}

.chatbot-trigger .notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-badge 2s infinite;
    border: 2px solid #1a1510;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ===== ОСНОВНОЕ ОКНО ЧАТА ===== */
.chatbot-overlay {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 540px;
    max-height: calc(100vh - 140px);
    background: #1a1613;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(212, 168, 83, 0.05);
    border: 1px solid rgba(212, 168, 83, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    animation: slideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chatbot-overlay.open {
    display: flex;
}

.chatbot-overlay.closing {
    animation: slideDown 0.3s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(30px) scale(0.92);
    }
}

/* ===== ШАПКА ЧАТА ===== */
.chatbot-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a2a4a, #2c3e66);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 2px solid rgba(212, 168, 83, 0.2);
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d4a853, #e8c878);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(212, 168, 83, 0.3);
}

.chatbot-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-header-info {
    display: flex;
    flex-direction: column;
}

.chatbot-header-title {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.3px;
}

.chatbot-header-status {
    font-size: 0.7rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-header-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    display: inline-block;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: rotate(90deg);
}

/* ===== ОБЛАСТЬ СООБЩЕНИЙ ===== */
.chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #12100e;
    scroll-behavior: smooth;
}

/* Кастомизация скроллбара */
.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(212, 168, 83, 0.3);
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 168, 83, 0.5);
}

/* ===== СООБЩЕНИЯ ===== */
.chatbot-message {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: messageIn 0.3s ease;
}

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

.chatbot-message.user {
    background: linear-gradient(135deg, #2c3e66, #1a2a4a);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(44, 62, 102, 0.2);
}

.chatbot-message.bot {
    background: rgba(255, 255, 255, 0.06);
    color: #ede4d8;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(212, 168, 83, 0.06);
}

.chatbot-message.bot .message-sender {
    font-size: 0.65rem;
    color: #d4a853;
    margin-bottom: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.chatbot-message .message-text {
    margin: 0;
}

.chatbot-message .message-text br {
    display: block;
    content: '';
    margin: 4px 0;
}

.chatbot-message .message-text a {
    color: #e8c878;
    text-decoration: underline;
}

.chatbot-message .message-text a:hover {
    color: #d4a853;
}

/* ===== ПРИВЕТСТВЕННОЕ СООБЩЕНИЕ ===== */
.chatbot-message.welcome {
    background: rgba(212, 168, 83, 0.06);
    border: 1px solid rgba(212, 168, 83, 0.1);
    max-width: 92%;
    border-radius: 16px;
}

.chatbot-message.welcome .message-sender {
    color: #e8c878;
}

.chatbot-message.welcome .welcome-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #e8c878;
    margin-bottom: 4px;
}

/* ===== ИНДИКАТОР ПЕЧАТИ ===== */
.chatbot-typing {
    align-self: flex-start;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(212, 168, 83, 0.04);
}

.chatbot-typing .dot {
    width: 8px;
    height: 8px;
    background: rgba(212, 168, 83, 0.5);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.chatbot-typing .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ===== БЫСТРЫЕ КНОПКИ ===== */
.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px 16px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    flex-shrink: 0;
}

.chatbot-quick-btn {
    background: rgba(212, 168, 83, 0.08);
    border: 1px solid rgba(212, 168, 83, 0.1);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 0.7rem;
    color: #b8a994;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-family: inherit;
    letter-spacing: 0.3px;
}

.chatbot-quick-btn:hover {
    background: rgba(212, 168, 83, 0.18);
    border-color: rgba(212, 168, 83, 0.25);
    color: #ede4d8;
    transform: translateY(-1px);
    box-shadow: 0 2px 12px rgba(212, 168, 83, 0.1);
}

.chatbot-quick-btn:active {
    transform: scale(0.95);
}

/* ===== ПОЛЕ ВВОДА ===== */
.chatbot-input-area {
    padding: 10px 16px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 25px;
    color: #ede4d8;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.chatbot-input::placeholder {
    color: #5a4f44;
}

.chatbot-input:focus {
    border-color: #d4a853;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.04);
}

.chatbot-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-send-btn {
    background: linear-gradient(135deg, #d4a853, #c8983f);
    color: #1a1510;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(212, 168, 83, 0.15);
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(212, 168, 83, 0.3);
    background: linear-gradient(135deg, #e8c878, #d4a853);
}

.chatbot-send-btn:active:not(:disabled) {
    transform: scale(0.9);
}

.chatbot-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== АДАПТИВ ===== */
@media (max-width: 768px) {
    .chatbot-overlay {
        bottom: 80px;
        right: 12px;
        left: 12px;
        width: auto;
        height: calc(100vh - 120px);
        max-height: calc(100vh - 120px);
        border-radius: 16px;
    }
    
    .chatbot-trigger {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .chatbot-header {
        padding: 14px 16px;
    }
    
    .chatbot-messages {
        padding: 12px;
    }
    
    .chatbot-input-area {
        padding: 8px 12px 12px;
    }
    
    .chatbot-quick-actions {
        padding: 6px 12px 8px;
        gap: 4px;
    }
    
    .chatbot-quick-btn {
        font-size: 0.65rem;
        padding: 4px 10px;
    }
}

@media (max-width: 480px) {
    .chatbot-overlay {
        bottom: 70px;
        right: 8px;
        left: 8px;
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
        border-radius: 12px;
    }
    
    .chatbot-trigger {
        bottom: 12px;
        right: 12px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* ===== СВЕТЛАЯ ТЕМА (для систем со светлой темой) ===== */
@media (prefers-color-scheme: light) {
    .chatbot-overlay {
        background: #ffffff;
        border-color: rgba(0, 0, 0, 0.08);
    }
    
    .chatbot-messages {
        background: #f8f6f4;
    }
    
    .chatbot-message.bot {
        background: #e9ecef;
        color: #1a1e24;
        border-color: rgba(0, 0, 0, 0.04);
    }
    
    .chatbot-message.user {
        background: linear-gradient(135deg, #2c3e66, #1a2a4a);
    }
    
    .chatbot-message.welcome {
        background: rgba(212, 168, 83, 0.06);
        border-color: rgba(212, 168, 83, 0.15);
    }
    
    .chatbot-input {
        background: #f0efed;
        color: #1a1e24;
        border-color: #ddd;
    }
    
    .chatbot-input::placeholder {
        color: #999;
    }
    
    .chatbot-input:focus {
        border-color: #d4a853;
        background: #fff;
    }
    
    .chatbot-quick-actions {
        background: rgba(0, 0, 0, 0.02);
        border-top: 1px solid #e8e6e4;
    }
    
    .chatbot-input-area {
        background: rgba(0, 0, 0, 0.01);
        border-top: 1px solid #e8e6e4;
    }
    
    .chatbot-quick-btn {
        background: rgba(212, 168, 83, 0.06);
        border-color: rgba(212, 168, 83, 0.1);
        color: #5a4f44;
    }
    
    .chatbot-quick-btn:hover {
        background: rgba(212, 168, 83, 0.12);
        border-color: rgba(212, 168, 83, 0.2);
        color: #1a1510;
    }
}