/* === СТИЛИ ULTIMATE ЧАТ-СЕКЦИИ === */
.testimonials-chat-section {
    padding: 120px 20px;
    position: relative;
}
.chat-container-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}
.chat-section-title {
    font-family: 'Sansation', sans-serif;
    font-size: 2.8rem;
    margin-bottom: 16px;
    color: var(--text-color);
}
.chat-section-subtitle {
    font-size: 1.1rem;
    color: var(--text-color-muted);
    margin-bottom: 50px;
}

/* --- ДЕСКТОП-ВЕРСТКА --- */
.chat-desktop-layout {
    display: flex;
    border: 1px solid var(--header-border);
    border-radius: 24px;
    overflow: hidden;
    background-color: rgba(12, 12, 12, 0.7);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    height: 600px;
}
.client-list-panel {
    width: 35%;
    max-width: 300px;
    background-color: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--header-border);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
}
.client-list-header {
    padding: 25px;
    font-weight: 700;
    color: var(--text-color);
    border-bottom: 1px solid var(--header-border);
    text-align: left;
    flex-shrink: 0;
}
.client-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
.client-list::-webkit-scrollbar {
    width: 6px;
}
.client-list::-webkit-scrollbar-track {
    background: transparent;
}
.client-list::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
.client-list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--header-border);
}
.client-list-item:last-child {
    border-bottom: none;
}
.client-list-item:hover, .client-list-item.active {
    background-color: rgba(255, 255, 255, 0.05);
}
.client-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: fill;
}
.client-info h5 {
    margin: 0 0 5px;
    color: var(--text-color);
    text-align: left;
}
.client-info p {
    text-align: left;
    margin: 0;
    color: var(--text-color-muted);
    font-size: 0.8rem;
}
.glass-chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 897px;
}

/* --- ОСНОВНОЕ ОКНО ЧАТА --- */
.glass-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 25px;
    background: rgba(20, 20, 20, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--header-border);
    color: #fff;
    flex-shrink: 0;
}
/* Этот код добавляет плавный переход для элементов хедера 
  и определяет, как они будут выглядеть в момент смены данных.
*/

/* Устанавливаем плавный переход для нужных элементов */
#chat-header-title,
#chat-header-status,
#chat-header-avatar {
  transition: filter 0.3s ease, opacity 0.3s ease;
}

/* Класс, который временно добавляется через JavaScript.
  Он делает элементы прозрачными и размытыми.
*/
.is-changing {
  opacity: 0;
  filter: blur(5px);
  /* Можно добавить и сдвиг для более интересного эффекта */
  /* transform: translateY(-10px); */ 
}
.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}
.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: fill;
}
.header-text h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
}
.header-text span {
    font-size: 0.8rem;
    color: #a0a0a0;
}
.header-actions {
    display: flex;
    gap: 15px;
    color: #a0a0a0;
}
.header-actions svg {
    cursor: pointer;
    transition: color 0.2s;
}
.header-actions svg:hover {
    color: #fff;
}
.glass-chat-area {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    background: #0e1621;
}
.glass-chat-area::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    background: 
        radial-gradient(circle at 25% 25%, rgba(43, 82, 120, 0.6), transparent 45%), 
        radial-gradient(circle at 75% 65%, rgba(94, 194, 134, 0.25), transparent 50%),
        linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(0,0,0,0.05) 100%);
    backdrop-filter: blur(18px) saturate(150%);

    animation: animated-gradient 25s ease infinite;
    background-size: 200% 200%;
    backdrop-filter: brightness(0.8) contrast(1.2) blur(10px) saturate(0.1);
}

@keyframes animated-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.chat-messages-slider {
    display: flex;
    height: 100%;
    position: relative;
    z-index: 1;
    transition: transform 0.8s cubic-bezier(0.86, 0, 0.07, 1);
}
.chat-message-slide {
    min-width: 100%;
    padding: 25px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 15px;
}
.message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 85%;
}
.message-wrapper.company {
    opacity: 1;
    filter: none;
    transform: none;
}
.message-wrapper.user {
    opacity: 0;
    filter: blur(10px);
    transform: translateY(10px);
}
.message-wrapper.user.animate-in {
    animation: fadeInBlur 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.message-wrapper.user.instant-in {
    opacity: 1;
    transform: none;
    filter: none;
    transition: opacity 0.3s, transform 0.3s, filter 0.3s;
}
@keyframes fadeInBlur {
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}
.message-wrapper.user { align-self: flex-start; }
.message-wrapper.company { align-self: flex-end; }

.bubble-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35), inset 0 1px 3px rgba(255, 255, 255, 0.05);
}

.bubble-content {
    padding: 14px 20px;
    line-height: 1.6;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35), inset 0 1px 3px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(18px) saturate(180%) contrast(1.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.message-text {
    max-width: 410px;
    text-align: left;
    font-weight: 500;
}

.message-wrapper.user .bubble-content {
    background: linear-gradient(150deg, #1b242f 0%, #212b31 100%);
    border-radius: 25px 25px 28px 6px;
    color: #e5efff;
    position: relative;
}

.message-wrapper.company .bubble-content {
    background: linear-gradient(150deg, #10161c 0%, #181e24 100%);
    border-radius: 25px 25px 6px 28px;
    color: var(--text-color-muted);
    position: relative;
}

/* Глянцевый блеск сверху */
.bubble-content::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 50%;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent);
    pointer-events: none;
}

.message-author {
    font-weight: 700;
    margin-bottom: 5px;
}
.message-wrapper.user .message-author { color: #6abe6e;text-align: left;  }
.message-wrapper.company .message-author { color: #dec27e;text-align: left; }
.message-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
    margin-top: 5px;
}

/* НАВИГАЦИЯ */
.chat-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14.8px 20px;
    background: rgba(10, 10, 10, 0.5);
    /* border-top: 1px solid var(--header-border); */
    flex-shrink: 0;
}
.chat-nav-btn {
    background-color: transparent;
    border: none;
    color: #888;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}
.chat-nav-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* ИСПРАВЛЕНО: Убрана фиксированная ширина */
.nav-dots-container {
    overflow: hidden;
    position: relative;
    
    /* плавное исчезновение по бокам */
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    mask-repeat: no-repeat;
    mask-size: 100% 100%;
}

.nav-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s;
    flex-shrink: 0;
}
.nav-dot:hover {
    background-color: rgba(255, 255, 255, 0.5);
}
.nav-dot.active {
    background-color: #fff;
}
.typing-indicator {
    position: absolute;
    bottom: 20px;
    left: 25px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    background-color: #5050504a;
    border-radius: 25px;
    padding: 15px;
}
.typing-indicator.active {
    opacity: 1;
    transform: scale(1);
    background-color: #5050504a;
    border-radius: 25px;
    padding: 15px;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #555;
    border-radius: 50%;
    animation: typing 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); background-color: #888; }
}

/* --- АДАПТИВНОСТЬ --- */
@media (max-width: 1240px) {
    .client-list-panel { display: none; }
    .chat-desktop-layout {
        display: block;
        border: none;
        background: none;
        box-shadow: none;
        height: auto;
    }
    .glass-chat-window {
        border-radius: 24px;
        border: 1px solid var(--header-border);
        background-color: rgba(12, 12, 12, 0.7);
        overflow: hidden;
        max-width: 1135px;
    }
    .glass-chat-area {
        height: 450px;
    }
}

@media (max-width: 768px) {
    .testimonials-chat-section {
        padding: 60px 1px;

    }
    .chat-desktop-layout {
        height: 800px;
        border-radius: 0;
    }
    .glass-chat-area {
        height: 600px;
    }
    .chat-messages-slider {
        align-items: flex-end;
    }
    .chat-message-slide {
        padding: 15px;
    }
    .message-wrapper {
        max-width: 100%;
    }
    .message-text {
        max-width: 100%;
    }
    .header-text span {
        text-align: left;
        font-size: 0.6rem;
    }
    .header-actions svg {
        width: 18px;
        height: 18px;
    }
}