/* Стили для чата */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-log {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* В десктопной игре чат занимает всю доступную высоту */
.desktop-only .chat-log {
    max-height: none;
    background: transparent;
    margin-bottom: 0;
    border-radius: 0;
    font-size: 0.75rem;
}

/* Компактные сообщения чата в десктопе */
.desktop-only .chat-message {
    font-size: 0.72rem;
    padding: 3px 6px;
    margin-bottom: 2px;
    border-left-width: 2px;
    background: rgba(255,255,255,0.04);
    border-radius: 2px;
}

.desktop-only .chat-time {
    font-size: 0.6rem;
    color: #666;
}

.desktop-only .chat-username {
    font-size: 0.72rem;
    color: #ffc107;
}

.chat-message {
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 4px;
    background-color: #ffffff;
    border-left: 3px solid #ffc107;
    font-size: 0.9rem;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-in;
}

.chat-message:hover {
    background-color: #fff3cd;
}

.chat-time {
    color: #6c757d;
    font-size: 0.8rem;
    margin-right: 5px;
    font-weight: bold;
}

.chat-username {
    color: #0d6efd;
    font-weight: bold;
    margin-right: 5px;
}

.chat-text {
    color: #212529;
}

/* Стили для @упоминаний */
.mention {
    color: #ffc107;
    font-weight: bold;
    cursor: pointer;
    text-decoration: underline;
}

.mention:hover {
    color: #ffda6a;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Скроллбар для чата */
.chat-log::-webkit-scrollbar {
    width: 6px;
}

.chat-log::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-log::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.chat-log::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .chat-log {
        max-height: 200px;
        padding: 8px;
    }
    
    .chat-message {
        font-size: 0.85rem;
        padding: 5px 8px;
    }
    
    .chat-time {
        font-size: 0.75rem;
    }
    
    .chat-username {
        font-size: 0.85rem;
    }
    
    /* Мобильная адаптация для welcome */
    .col-lg-8 {
        width: 100%;
    }
    
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .list-group-item {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .list-group-item > div:last-child {
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .list-group-item > div:last-child > button {
        width: 48%;
        font-size: 0.8rem;
        padding: 4px 8px;
    }
}

@media (max-width: 576px) {
    .chat-log {
        max-height: 150px;
    }
    
    .chat-message {
        font-size: 0.8rem;
    }
    
    .fs-4 {
        font-size: 1.2rem !important;
    }
    
    .btn {
        font-size: 0.875rem;
    }
    
    .py-3 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
}

/* ===== МОДАЛ НАСТРОЕК ЧАТА ===== */
/* Учтите: main.css задаёт .modal-content светлый фон с !important,
   поэтому текст в этом модале должен быть тёмным. */
#chatSettingsModal .modal-content {
    background: #e8dcc8;
    border: 1px solid #92735c;
    color: #3b2f1d;
}

#chatSettingsModal .modal-header {
    border-bottom: 2px solid #92735c;
}

#chatSettingsModal .modal-title {
    color: #3b2f1d;
    font-size: 1rem;
}

#chatSettingsModal .btn-close {
    filter: none;
    opacity: 0.6;
}

.chat-setting-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.chat-setting-item:last-child {
    border-bottom: none;
}

.chat-setting-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #000;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.chat-setting-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #92735c;
}

#chatSettingsModal .form-select {
    background: #fff;
    border: 1px solid #92735c;
    color: #000;
}

#chatSettingsModal .modal-footer {
    border-top: 2px solid #92735c;
}

/* ===== МОДАЛ ДРУЗЕЙ В ЧАТЕ ===== */
#chatFriendsModal .modal-content {
    background: rgba(20, 20, 30, 0.98);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ddd;
}

#chatFriendsModal .modal-header {
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
    align-items: center;
}

#chatFriendsModal .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

.modal-tabs {
    gap: 6px;
}

.modal-tabs .nav-link {
    color: #aaa;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 20px;
}

.modal-tabs .nav-link.active {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.cf-search {
    margin-bottom: 10px;
}

.cf-search input {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 20px;
}

.cf-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.cf-actions .btn {
    flex: 1;
    min-width: 0;
}

.cf-list {
    max-height: 50vh;
    overflow-y: auto;
}

.cf-friend-item,
.cf-blocked-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    margin-bottom: 6px;
}

.cf-friend-name,
.cf-blocked-name {
    flex: 1;
    font-size: 0.85rem;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cf-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cf-item-actions button {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    opacity: 0.8;
}

.cf-item-actions button:active {
    opacity: 1;
}

.cf-empty {
    text-align: center;
    color: #666;
    font-size: 0.8rem;
    padding: 20px 0;
}

.cf-add-form {
    display: none;
    margin-bottom: 10px;
    gap: 6px;
}

.cf-add-form input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
}

.cf-add-form button {
    background: #ffc107;
    border: none;
    color: #000;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.cf-requests {
    display: none;
    margin-bottom: 10px;
}

.cf-request-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    background: rgba(255,193,7,0.1);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.cf-request-item button {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 6px;
}
