/* ========== ЧАТ ========== */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.chat-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.chat-tab-btn {
    padding: 8px 16px;
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9em;
}

.chat-tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
}

/* Видимый скроллбар как в достижениях */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd6, #6a4190);
}

.chat-message {
    margin-bottom: 8px;
    padding: 8px 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-message.system {
    background: #e9ecef;
    text-align: center;
    font-style: italic;
    color: #666;
}

/* ========== HEADER СООБЩЕНИЯ ========== */
.chat-msg-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.chat-time {
    font-size: 0.75em;
    color: #999;
}

.chat-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #666;
    flex-shrink: 0;
}

/* Рамки аватара */
.chat-avatar.frame-default { border-color: #666; }
.chat-avatar.frame-bronze { border-color: #CD7F32; }
.chat-avatar.frame-silver { border-color: #C0C0C0; }
.chat-avatar.frame-gold { border-color: #FFD700; }
.chat-avatar.frame-platinum { border-color: #E5E4E2; }
.chat-avatar.frame-diamond { border-color: #B9F2FF; box-shadow: 0 0 6px #B9F2FF; }

/* Старый стиль chat-sender заменён на player-name-styled */
/* См. customization.css для унифицированных стилей ников */

/* ========== ТЕЛО СООБЩЕНИЯ ========== */
.chat-msg-body {
    padding-left: 0;
}

.chat-text {
    color: #333;
    font-size: 0.9em;
    line-height: 1.4;
    word-break: break-word;
}

/* ========== INPUT ========== */
.chat-input-container {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

#chatInput {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 0.95em;
    min-width: 0;
}

#chatInput:focus {
    border-color: #667eea;
    outline: none;
}

.chat-send-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

/* ========== DESKTOP ========== */
@media (min-width: 600px) {
    .chat-message:not(.system) {
        display: flex;
        align-items: baseline;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .chat-msg-header {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .chat-msg-body {
        display: inline;
        flex: 1;
        min-width: 0;
    }
    
    .chat-text {
        font-size: 0.95em;
    }
}

/* ========== MOBILE ========== */
@media (max-width: 599px) {
    .chat-tabs {
        gap: 6px;
    }
    
    .chat-tab-btn {
        padding: 6px 12px;
        font-size: 0.8em;
    }
    
    .chat-messages {
        padding: 10px;
    }
    
    .chat-message {
        padding: 6px 8px;
        margin-bottom: 6px;
    }
    
    .chat-msg-header {
        margin-bottom: 3px;
    }
    
    .chat-time {
        font-size: 0.7em;
    }
    
    .chat-avatar {
        width: 18px;
        height: 18px;
    }
    
    .chat-sender {
        font-size: 0.8em;
    }
    
    .chat-text {
        font-size: 0.82em;
        line-height: 1.3;
    }
    
    #chatInput {
        padding: 10px;
        font-size: 0.9em;
    }
    
    .chat-send-btn {
        padding: 10px 16px;
        font-size: 1em;
    }
}

/* ========== ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ ========== */
@media (max-width: 380px) {
    .chat-tab-btn {
        padding: 5px 10px;
        font-size: 0.75em;
    }
    
    .chat-message {
        padding: 5px 6px;
    }
    
    .chat-avatar {
        width: 16px;
        height: 16px;
    }
    
    .chat-sender {
        font-size: 0.75em;
    }
    
    .chat-text {
        font-size: 0.78em;
    }
    
    #chatInput {
        padding: 8px;
        font-size: 0.85em;
    }
    
    .chat-send-btn {
        padding: 8px 12px;
    }
}
