/* chat.css - стили для чата (главная страница, модальное окно, user_dashboard) */

/* Кнопка чата (плавающая) */
.chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    z-index: 999;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* Маленькая кнопка чата для user_dashboard */
.chat-fab-small {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.chat-fab-small:hover {
    transform: scale(1.05);
}

.chat-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f5576c;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Модальное окно чата */
.chat-modal {
    display: none;
    position: fixed;
    bottom: 95px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: 65vh;
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    z-index: 1000;
    flex-direction: column;
    overflow: hidden;
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-modal.open {
    display: flex;
}

.chat-modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-modal-header h3 {
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: auto;
}

.chat-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Авторизация в чате */
.chat-modal-auth {
    padding: 25px 20px;
    text-align: center;
}

.chat-modal-auth p {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
}

.chat-modal-auth input {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    font-size: 14px;
}

.chat-modal-auth button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 8px;
}

.chat-modal-auth button:hover {
    transform: translateY(-1px);
}

/* Область сообщений */
.chat-modal-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    font-size: 13px;
}

.chat-message-item {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
}

.chat-message-item.user {
    align-items: flex-end;
}

.chat-message-item.admin {
    align-items: flex-start;
}

.chat-message-bubble {
    max-width: 85%;
    padding: 8px 14px;
    border-radius: 18px;
    word-break: break-word;
    line-height: 1.4;
}

.chat-message-item.user .chat-message-bubble {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message-item.admin .chat-message-bubble {
    background: white;
    border: 1px solid #e0e0e0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.chat-message-time {
    font-size: 9px;
    color: #999;
    margin-top: 4px;
    margin-left: 10px;
    margin-right: 10px;
}

/* Статус рабочего времени */
.chat-working-hours {
    background: #e8f4fd;
    padding: 8px 12px;
    text-align: center;
    font-size: 11px;
    color: #0066cc;
    border-bottom: 1px solid #cce5ff;
}

.chat-working-hours.offline {
    background: #fff3cd;
    color: #856404;
    border-bottom-color: #ffc107;
}

/* Поле ввода */
.chat-modal-input {
    padding: 12px 15px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    background: white;
}

.chat-modal-input input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 13px;
    margin: 0;
}

.chat-modal-input input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-modal-input button {
    width: auto;
    padding: 0 18px;
    margin: 0;
    border-radius: 25px;
}

/* Ссылка на Telegram */
.telegram-link-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0088cc;
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 12px;
    margin-top: 10px;
}

/* Кнопка Telegram */
.btn-telegram {
    background: #0088cc;
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 500;
}

.btn-telegram:hover {
    background: #006699;
    transform: translateY(-1px);
}

/* Предупреждение об истекшей подписке */
.expired-warning {
    background: #fee2e2;
    border-left: 4px solid #dc2626;
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.expired-warning p {
    margin: 0 0 10px 0;
    color: #991b1b;
}

/* Группа кнопок */
.button-group-inline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 15px;
}

/* Скроллбар */
.chat-messages-list::-webkit-scrollbar {
    width: 5px;
}

.chat-messages-list::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 10px;
}

.chat-messages-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .chat-fab, .chat-fab-small {
        width: 50px;
        height: 50px;
        font-size: 22px;
        bottom: 15px;
        right: 15px;
    }
    
    .chat-modal {
        bottom: 80px;
        right: 10px;
        left: 10px;
        width: auto;
        height: 60vh;
    }
    
    .button-group-inline {
        flex-direction: column;
    }
    
    .btn-telegram {
        text-align: center;
        justify-content: center;
    }
}