/* public/chat.css - Фирменный онлайн-чат RUBTSOVSK.PC */

/* Плавающая кнопка вызова чата */
.rub-chat-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.94) 0%, rgba(30, 41, 59, 0.94) 100%);
    border: 1px solid rgba(6, 182, 212, 0.45);
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 20px rgba(6, 182, 212, 0.3);
    backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.rub-chat-launcher:hover {
    transform: translateY(-3px) scale(1.02);
    border-color: rgba(6, 182, 212, 0.8);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 0 30px rgba(6, 182, 212, 0.55);
}

.rub-chat-launcher-icon {
    position: relative;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #67e8f9;
}

.rub-chat-online-dot {
    position: absolute;
    top: -2px;
    right: -3px;
    width: 9px;
    height: 9px;
    background: #10b981;
    border: 2px solid #0f172a;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: rubChatPulse 2s infinite;
}

@keyframes rubChatPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.rub-chat-launcher-text {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.rub-chat-badge-count {
    display: none;
    background: #ef4444;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 999px;
    margin-left: 2px;
}

/* Окно чата */
.rub-chat-panel {
    position: fixed;
    bottom: 86px;
    right: 24px;
    z-index: 9999;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 110px);
    background: #0b1120;
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 35px rgba(99, 102, 241, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.96);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', -apple-system, sans-serif;
}

.rub-chat-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Шапка чата */
.rub-chat-header {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rub-chat-header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rub-chat-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.rub-chat-avatar-status {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border: 2px solid #0b1120;
    border-radius: 50%;
    box-shadow: 0 0 6px #10b981;
}

.rub-chat-header-info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.rub-chat-header-info p {
    margin: 2px 0 0;
    font-size: 0.76rem;
    color: #34d399;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rub-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rub-chat-btn-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #f8fafc;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.rub-chat-btn-close:hover {
    background: rgba(6, 182, 212, 0.22);
    border-color: rgba(6, 182, 212, 0.55);
    color: #67e8f9;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.28);
}

/* Контактная плашка вверху */
.rub-chat-contact-bar {
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    font-size: 0.78rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.rub-chat-contact-bar a {
    color: #67e8f9;
    text-decoration: none;
    font-weight: 600;
}

/* Область сообщений */
.rub-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
}

.rub-chat-messages::-webkit-scrollbar {
    width: 5px;
}
.rub-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Сообщения */
.rub-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: rubMsgFadeIn 0.2s ease;
}

@keyframes rubMsgFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.rub-msg.client {
    align-self: flex-end;
}

.rub-msg.master {
    align-self: flex-start;
}

.rub-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
}

.rub-msg.client .rub-msg-bubble {
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    color: #fff;
    border-bottom-right-radius: 3px;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.rub-msg.master .rub-msg-bubble {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    border-bottom-left-radius: 3px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.rub-msg-meta {
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 3px;
    padding: 0 4px;
}
.rub-msg.client .rub-msg-meta {
    text-align: right;
}
.rub-msg.master .rub-msg-meta {
    text-align: left;
}

/* Плашка ввода контакта */
.rub-chat-lead-box {
    background: rgba(30, 41, 59, 0.6);
    border: 1px dashed rgba(6, 182, 212, 0.4);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.rub-chat-lead-box input {
    width: 100%;
    margin-top: 6px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 6px 10px;
    color: #fff;
    font-size: 0.8rem;
    outline: none;
    box-sizing: border-box;
}
.rub-chat-lead-box input:focus {
    border-color: #06b6d4;
}

/* Поле ввода */
.rub-chat-footer {
    background: #0f172a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 14px 12px;
}

.rub-chat-name-row {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #162033;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 5px 10px;
    margin-bottom: 8px;
    transition: border-color 0.2s ease;
}

.rub-chat-name-row:focus-within {
    border-color: rgba(6, 182, 212, 0.55);
}

.rub-chat-name-icon {
    font-size: 0.78rem;
    opacity: 0.75;
    line-height: 1;
    user-select: none;
}

.rub-chat-name-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    padding: 2px 0;
    min-width: 0;
}

.rub-chat-name-input::placeholder {
    color: #64748b;
}

.rub-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rub-chat-input {
    flex: 1;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s ease;
    resize: none;
    font-family: inherit;
    line-height: 1.35;
    max-height: 80px;
}

.rub-chat-input:focus {
    border-color: #06b6d4;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.25);
}

.rub-chat-btn-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #06b6d4 0%, #4f46e5 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.rub-chat-btn-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(6, 182, 212, 0.55);
}

.rub-chat-btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.rub-chat-footer-hint {
    margin-top: 6px;
    text-align: center;
    font-size: 0.7rem;
    color: #64748b;
}

/* Адаптация под широкие десктопы: окно чата аккуратно встает в правом поле без перекрытия основного контента (.container) */
@media (min-width: 1880px) and (max-width: 2149px) {
    .rub-chat-launcher {
        bottom: 20px;
        right: 10px;
        padding: 10px 16px;
    }
    .rub-chat-panel {
        bottom: 76px;
        right: 10px;
        width: 288px;
        height: 470px;
        border-radius: 16px;
    }
    .rub-chat-header {
        padding: 12px 14px;
    }
    .rub-chat-messages {
        padding: 12px;
    }
    .rub-msg {
        max-width: 88%;
    }
    .rub-msg-bubble {
        font-size: 0.84rem;
        padding: 8px 12px;
    }
}

@media (min-width: 2150px) {
    .rub-chat-panel {
        width: 350px;
        right: 24px;
        height: 520px;
        bottom: 86px;
    }
}

/* Мобильная адаптация */
@media (max-width: 640px) {
    .rub-chat-launcher {
        bottom: 16px;
        right: 16px;
        padding: 12px 16px;
    }
    .rub-chat-launcher-text {
        display: none;
    }
    .rub-chat-panel {
        bottom: 74px;
        right: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 90px);
        max-height: 520px;
    }
}
