/* ============================================================
   ЧАТ — стили
   Префикс: sax-chat-
   ============================================================ */

.sax-chat {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin: 30px 0;
    font-family: 'Raleway', sans-serif;
    color: #eaeaea;
}

/* ---------- Шапка ---------- */

.sax-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 16px 20px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #f5a623;
}

.sax-chat-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.sax-chat-status {
    font-size: 13px;
    color: #f5a623;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sax-chat-status.sax-chat-status-visible {
    opacity: 1;
}

/* ---------- Лента сообщений ---------- */

.sax-chat-messages {
    height: 420px;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.sax-chat-messages::-webkit-scrollbar {
    width: 8px;
}

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

.sax-chat-messages::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

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

.sax-chat-empty {
    color: #888;
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

/* ---------- Одно сообщение ---------- */

.sax-chat-msg {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    position: relative;
}

.sax-chat-msg-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: #222;
    border: 1px solid #333;
}

.sax-chat-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sax-chat-msg-body {
    flex: 1 1 auto;
    min-width: 0;
    background: #151515;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 10px 14px;
}

.sax-chat-msg-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.sax-chat-msg-name {
    font-weight: 700;
    color: #f5a623;
    font-size: 14px;
}

.sax-chat-msg-time {
    font-size: 12px;
    color: #777;
}

.sax-chat-msg-text {
    font-size: 15px;
    line-height: 1.5;
    color: #eaeaea;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* ---------- Кнопка удаления (только модераторам) ---------- */

.sax-chat-msg-delete {
    margin-left: auto;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.sax-chat-msg:hover .sax-chat-msg-delete {
    opacity: 1;
}

.sax-chat-msg-delete:hover {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.1);
}

/* ---------- Форма отправки ---------- */

.sax-chat-form {
    border-top: 1px solid #333;
    padding: 14px 20px 16px;
    background: #151515;
}

.sax-chat-input {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
    min-height: 56px;
    max-height: 160px;
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #eaeaea;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    transition: border-color 0.15s ease;
}

.sax-chat-input:focus {
    outline: none;
    border-color: #f5a623;
}

.sax-chat-input::placeholder {
    color: #666;
}

.sax-chat-form-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-top: 10px;
}

.sax-chat-counter {
    font-size: 12px;
    color: #777;
}

.sax-chat-counter.sax-chat-counter-warn {
    color: #f5a623;
}

/* ---------- Золотая кнопка «Отправить» ---------- */

.sax-chat-send {
    background: linear-gradient(180deg, #ffbb3d 0%, #f5a623 100%);
    color: #151515;
    border: none;
    border-radius: 6px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 0 #b87210;
    transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
}

.sax-chat-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #b87210;
}

.sax-chat-send:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #b87210;
}

.sax-chat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 0 #b87210;
}

/* ---------- Плашка «Войти, чтобы писать» ---------- */

.sax-chat-login-notice {
    border-top: 1px solid #333;
    padding: 20px;
    background: #151515;
    text-align: center;
}

.sax-chat-login-notice p {
    margin: 0 0 14px;
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
}

.sax-chat-login-notice strong {
    color: #f5a623;
}

.sax-chat-login-btn {
    display: inline-block;
    background: linear-gradient(180deg, #ffbb3d 0%, #f5a623 100%);
    color: #151515 !important;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 0 #b87210;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.sax-chat-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 0 #b87210;
    color: #151515 !important;
}

.sax-chat-login-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #b87210;
}

/* ---------- Мобильная версия ---------- */

@media (max-width: 600px) {
    .sax-chat {
        margin: 20px 0;
        border-radius: 6px;
    }

    .sax-chat-header {
        padding: 14px 16px;
    }

    .sax-chat-title {
        font-size: 18px;
    }

    .sax-chat-messages {
        height: 340px;
        padding: 14px 14px;
    }

    .sax-chat-msg-avatar {
        width: 34px;
        height: 34px;
    }

    .sax-chat-msg-body {
        padding: 8px 12px;
    }

    .sax-chat-form {
        padding: 12px 14px 14px;
    }

    .sax-chat-form-bottom {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 8px;
    }

    .sax-chat-send {
        width: 100%;
        padding: 12px;
    }

    .sax-chat-counter {
        text-align: right;
    }

    /* На мобиле кнопку удаления показываем всегда — hover не работает. */
    .sax-chat-msg-delete {
        opacity: 1;
    }

    .sax-chat-login-notice {
        padding: 18px 16px;
    }
}