/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10001;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* Убираем любой фон и padding */
    background: transparent;
    padding: 0;
    margin: 0;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    background: #f70f4d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(48, 72, 109, 0.4);
    transition: all 0.3s ease;
    position: relative;
    /* Убираем квадратную обводку, делаем только круглую тень */
    outline: none;
    border: none;
    /* Убираем любые отступы и фон */
    padding: 0;
    margin: 0;
    background-clip: padding-box;
}

.chat-toggle:hover {
    background: #f70f4d;
    transform: scale(1.1);
}

.chat-toggle:focus {
    outline: none;
    border: none;
    box-shadow: 0 4px 20px rgba(48, 72, 109, 0.4);
}

.chat-toggle.open {
    background: #f70f4d;
}

.chat-toggle.open:hover {
    background: #d60e3d;
}

.chat-toggle i {
    color: black;
    font-size: 24px;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 520px;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 80px;
}

/* Desktop specific styles */
@media (min-width: 769px) {
    .chat-container {
        width: 350px !important;
        height: 520px !important;
        position: absolute !important;
        bottom: 80px !important;
        right: 0 !important;
        left: auto !important;
    }
    

    
    .chat-input-wrapper {
        padding: 10px 15px !important;
        min-height: 45px !important;
    }
    
    .chat-input {
        padding: 8px 10px !important;
        font-size: 14px !important;
    }
    
    .send-button {
        width: 35px !important;
        height: 35px !important;
        margin-left: 8px !important;
    }
}

.chat-header {
    background: #f70f4d;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.chat-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-logo i {
    font-size: 24px;
}

.chat-text {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.chat-title {
    color: black;
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 2px;
}

.chat-subtitle {
    color: black;
    font-size: 12px;
    opacity: 0.9;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: white;
    scroll-behavior: smooth;
    max-height: 380px;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message-time {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin-bottom: 3px;
}

.message-sender {
    font-size: 11px;
    color: #999;
    margin-bottom: 3px;
}

.message-bubble {
    background: #f0f0f0;
    padding: 12px 15px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
    font-size: 14px;
    line-height: 1.4;
}

.message-bubble.user {
    background: #30486d;
    color: white;
    align-self: flex-end;
    margin-left: auto;
}

.message-bubble.support {
    background: #f0f0f0;
    color: #333;
    align-self: flex-start;
}


.typing-indicator {
    position: absolute;
    bottom: 80px;
    left: 0;
    right: 0;
    padding: 10px 15px;
    color: #999;
    font-style: italic;
    font-size: 13px;
    background: #f8f8f8;
    border-top: 1px solid #eee;
}

.welcome-message {
    text-align: center;
    color: #666;
    font-size: 13px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 10px;
}

.chat-input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0px 15px 15px 15px;
    background: white;
    border-top: 1px solid #eee;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

/* Скрываем поле ввода когда нет сообщений */
.chat-input-container.hidden {
    display: none;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    background: #f8f8f8;
    border-radius: 25px;
    padding: 10px 15px;
    min-height: 45px;
    width: 100%;
    box-sizing: border-box;
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    padding: 8px 10px;
    color: #333;
    min-height: 20px;
    width: 100%;
    box-sizing: border-box;
}

.chat-input::placeholder {
    color: #999;
}

.send-button {
    background: #f70f4d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.send-button:hover {
    background: #d60e3d;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.send-button i {
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-container {
        position: fixed !important;
        width: calc(100vw - 30px) !important;
        height: calc(100vh - 100px) !important;
        bottom: 85px !important;
        right: 15px !important;
        left: 15px !important;
        max-height: calc(100vh - 100px) !important;
    }
    
    
    .chat-messages {
        max-height: calc(100vh - 220px) !important;
    }
    
   
    
    .chat-input-wrapper {
        padding: 8px 12px;
        min-height: 40px;
    }
    
    .chat-input {
        padding: 6px 8px;
        font-size: 13px;
    }
    
    .send-button {
        width: 32px;
        height: 32px;
        margin-left: 6px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-container {
        position: fixed !important;
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 80px) !important;
        bottom: 70px !important;
        right: 10px !important;
        left: 10px !important;
        max-height: calc(100vh - 80px) !important;
    }
    
    .chat-messages {
        max-height: calc(100vh - 200px) !important;
    }
    

    
    .chat-input-wrapper {
        padding: 6px 10px;
        min-height: 36px;
    }
    
    .chat-input {
        padding: 5px 6px;
        font-size: 12px;
    }
    
    .send-button {
        width: 30px;
        height: 30px;
        margin-left: 5px;
    }
    
    .chat-toggle {
        width: 55px;
        height: 55px;
    }
    
    .chat-toggle i {
        font-size: 20px;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}