/* ========== ChatService — единый чат ========== */
.chat-service {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.chat-service-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0066CC;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,102,204,0.3);
    cursor: pointer;
    font-size: 24px;
    transition: transform 0.2s;
}
.chat-service-btn:hover { transform: scale(1.1); }

.chat-service-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 340px;
    height: 480px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.chat-service-window.open { display: flex; }

.chat-service-header {
    background: #0066CC;
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
.chat-service-header button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

.chat-service-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: #f5f5f5;
}

.chat-service-msg {
    margin-bottom: 10px;
}
.chat-service-msg.user { text-align: right; }
.chat-service-msg.support { text-align: left; }

.chat-service-bubble {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 14px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
}
.chat-service-msg.user .chat-service-bubble {
    background: #0066CC;
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-service-msg.support .chat-service-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-service-time {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
}

.chat-service-input {
    padding: 10px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}
.chat-service-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}
.chat-service-input input:focus { border-color: #0066CC; }
.chat-service-input button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0066CC;
    color: white;
    border: none;
    cursor: pointer;
}

/* Модалка телефона */
.chat-phone-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}
.chat-phone-modal {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    overflow: hidden;
}
.chat-phone-header { padding: 20px 20px 10px; font-size: 18px; font-weight: 600; text-align: center; }
.chat-phone-body { padding: 10px 20px 20px; }
.chat-phone-input {
    width: 100%;
    padding: 14px;
    font-size: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    box-sizing: border-box;
    outline: none;
}
.chat-phone-input:focus { border-color: #0066CC; }
.chat-phone-hint { margin-top: 8px; font-size: 12px; color: #999; text-align: center; }
.chat-phone-footer { display: flex; border-top: 1px solid #f0f0f0; }
.chat-phone-btn {
    flex: 1;
    padding: 14px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    background: none;
}
.chat-phone-cancel { color: #999; border-right: 1px solid #f0f0f0; }
.chat-phone-ok { color: #0066CC; font-weight: 600; }

/* Модальное окно для менеджера */
.chat-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.chat-modal-window {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

@media (max-width: 480px) {
    .chat-service-window {
        width: calc(100vw - 40px);
        height: 65vh;
        right: 0;
    }
}