:root {
    --v7-chat-color: #2563eb;
    --v7-chat-color-dark: #1d4ed8;
    --v7-chat-width: 400px;
    --v7-chat-height: 550px;
}

/* Кнопка чата */
#v7-chat-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 64px;
    height: 64px;
    cursor: pointer;
    z-index: 99999;
    background: linear-gradient(135deg, var(--v7-chat-color) 0%, var(--v7-chat-color-dark) 100%);
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.35), 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: v7-btn-pulse 3s ease-in-out infinite;
}
@keyframes v7-btn-pulse {
    0%, 100% { box-shadow: 0 8px 32px rgba(37, 99, 235, 0.35), 0 4px 12px rgba(0,0,0,0.15); }
    50% { box-shadow: 0 8px 40px rgba(37, 99, 235, 0.5), 0 4px 16px rgba(0,0,0,0.2); }
}
#v7-chat-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.45), 0 6px 16px rgba(0,0,0,0.2);
}
#v7-chat-btn svg {
    width: 28px;
    height: 28px;
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
#v7-chat-btn img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Окно чата */
#v7-chat-window {
    position: fixed;
    bottom: 180px;
    right: 20px;
    width: var(--v7-chat-width);
    height: var(--v7-chat-height);
    min-width: 320px;
    min-height: 400px;
    max-width: 95vw;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.15), 0 10px 30px rgba(0,0,0,0.1);
    display: none;
    flex-direction: column;
    z-index: 99998;
    overflow: auto;
    resize: both;
    cursor: default;
    border: 1px solid rgba(255,255,255,0.8);
    animation: v7-window-appear 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes v7-window-appear {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
#v7-chat-window.open {
    display: flex;
}

/* Заголовок */
.v7-chat-header {
    background: linear-gradient(135deg, var(--v7-chat-color) 0%, var(--v7-chat-color-dark) 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    overflow: hidden;
}
.v7-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}
.v7-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.v7-chat-title {
    flex: 1;
    position: relative;
    z-index: 1;
}
.v7-chat-title h4 {
    margin: 0 0 2px 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
}
.v7-chat-title span {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 6px;
}
.v7-chat-title span::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: v7-online 2s ease-in-out infinite;
}
@keyframes v7-online {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.v7-chat-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
}
.v7-chat-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

/* Сообщения */
#v7-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    scroll-behavior: smooth;
}
#v7-chat-messages::-webkit-scrollbar {
    width: 6px;
}
#v7-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
#v7-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}

.v7-msg {
    margin-bottom: 16px;
    max-width: 85%;
    animation: v7-msg-appear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes v7-msg-appear {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.v7-msg-user {
    margin-left: auto;
    background: linear-gradient(135deg, var(--v7-chat-color) 0%, var(--v7-chat-color-dark) 100%);
    color: #fff;
    padding: 14px 18px;
    border-radius: 20px 20px 6px 20px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
    font-size: 14px;
    line-height: 1.5;
}
.v7-msg-bot {
    background: #fff;
    padding: 14px 18px;
    border-radius: 20px 20px 20px 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
}
.v7-msg-bot img {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 10px;
}
.v7-msg-bot a, .v7-product-link {
    color: var(--v7-chat-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}
.v7-msg-bot a:hover, .v7-product-link:hover {
    color: var(--v7-chat-color-dark);
    text-decoration: underline;
}

/* Индикатор печати */
.v7-typing {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: #fff;
    border-radius: 20px;
    width: fit-content;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.v7-typing span {
    width: 10px;
    height: 10px;
    background: linear-gradient(135deg, var(--v7-chat-color), var(--v7-chat-color-dark));
    border-radius: 50%;
    animation: v7-typing 1.4s infinite;
}
.v7-typing span:nth-child(2) { animation-delay: 0.15s; }
.v7-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes v7-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-10px); opacity: 1; }
}

/* Превью фото */
.v7-photo-preview {
    width: 100%;
    padding: 12px 16px;
    display: none;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.v7-photo-preview img {
    max-height: 80px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.v7-photo-preview.has-photo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.v7-photo-remove {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}
.v7-photo-remove:hover {
    transform: scale(1.1);
}

/* Поле ввода */
.v7-chat-input {
    display: flex;
    padding: 16px;
    gap: 10px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    align-items: center;
}
.v7-chat-input input[type="text"] {
    flex: 1;
    min-width: 100px;
    padding: 14px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 28px;
    outline: none;
    font-size: 14px;
    transition: all 0.3s;
    background: #f8fafc;
}
.v7-chat-input input[type="text"]:focus {
    border-color: var(--v7-chat-color);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
.v7-chat-input input[type="text"]::placeholder {
    color: #94a3b8;
}

.v7-chat-btn-icon {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--v7-chat-color) 0%, var(--v7-chat-color-dark) 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    flex-shrink: 0;
}
.v7-chat-btn-icon:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}
.v7-chat-btn-icon:active {
    transform: scale(0.95);
}
.v7-chat-btn-icon svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    fill: none;
}

.v7-chat-btn-icon.secondary {
    background: #f1f5f9;
    color: #64748b;
    box-shadow: none;
}
.v7-chat-btn-icon.secondary svg {
    stroke: #64748b;
}
.v7-chat-btn-icon.secondary:hover {
    background: #e2e8f0;
    color: var(--v7-chat-color);
}
.v7-chat-btn-icon.secondary:hover svg {
    stroke: var(--v7-chat-color);
}

.v7-chat-btn-icon.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    animation: v7-recording 1s infinite;
}
@keyframes v7-recording {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

/* Мобильная версия */
@media (max-width: 480px) {
    #v7-chat-window {
        width: calc(100vw - 16px);
        height: 75vh;
        right: 8px;
        bottom: 160px;
        border-radius: 20px;
    }
    #v7-chat-btn {
        bottom: 90px;
        right: 16px;
        width: 58px;
        height: 58px;
    }
    .v7-chat-header {
        padding: 14px 16px;
    }
    .v7-chat-avatar {
        width: 42px;
        height: 42px;
    }
    .v7-chat-input {
        padding: 12px;
        gap: 8px;
    }
    .v7-chat-btn-icon {
        width: 40px;
        height: 40px;
    }
}
