.sms {
    max-width: 500px;
    max-height: 600px;
    width: 100%;
    height: 100%;
    background: #fff;
    margin: 0 auto;
    z-index: 9999999 !important;
    display: none !important;
    position: absolute;
    bottom: -1px;
    right: 0;
    border: 1px solid;
    background: 
        linear-gradient(var(--bg, white), var(--bg, white)) padding-box,
        linear-gradient(to right, #003366, #33CCFF) border-box;
    border: 1px solid transparent;
    border-radius: 15px 15px 0 0;
    overflow: hidden;
    box-shadow: 0px 0px 20px -1px #0086B347;
    flex-direction: column;
    transition: transform 0.3s ease, left 0.3s ease, top 0.3s ease, bottom 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
}

/* Блок становится видимым только когда явно установлен display: flex через inline стили */
.sms[style*="display: flex"] {
    display: flex !important;
}

.sms-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

/* Стили для sms когда открыт из списка чатов */
.sms.sms--from-list {
    border-radius: 15px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(0, -50%);
    margin-left: 0;
    width: 500px;
    max-width: 500px;
    height: 600px;
    max-height: 600px;
    border-left: none;
    box-shadow: -2px 0 10px -2px rgba(0, 0, 0, 0.1), 0px 0px 20px -1px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, opacity 0.3s ease, left 0.3s ease, top 0.3s ease, bottom 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
    opacity: 0;
    animation: fadeInSlide 0.3s ease forwards;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sms.sms--from-list .sms-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translate(10px, -50%);
    }
    to {
        opacity: 1;
        transform: translate(0, -50%);
    }
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 1200px) {
    .operator-chat {
        width: 500px;
        height: 550px;
        max-width: calc(45vw - 10px);
        max-height: 85vh;
    }
    
    .operator-chat.operator-chat--with-sms {
        transform: translate(-100%, -50%);
        left: 50%;
        margin-right: 0;
        width: 450px;
        max-width: calc(45vw - 10px);
        height: 550px;
        max-height: 85vh;
    }
    
    .sms.sms--from-list {
        width: 450px;
        max-width: calc(45vw - 10px);
        height: 550px;
        max-height: 85vh;
        transform: translate(0, -50%);
        margin-left: 0;
        top: 50%;
    }
}

@media (max-width: 992px) {
    .operator-chat {
        width: 450px;
        height: 500px;
        max-width: calc(45vw - 10px);
        max-height: 80vh;
    }
    
    .operator-chat.operator-chat--with-sms {
        transform: translate(-100%, -50%);
        left: 50%;
        margin-right: 0;
        width: 400px;
        max-width: calc(45vw - 10px);
        height: 500px;
        max-height: 80vh;
    }
    
    .sms.sms--from-list {
        width: 400px;
        max-width: calc(45vw - 10px);
        height: 500px;
        max-height: 80vh;
        transform: translate(0, -50%);
        margin-left: 0;
        top: 50%;
    }
}

/* На планшетах и мобильных - блоки друг под другом */
@media (max-width: 768px) {
    .operator-chat {
        width: 90%;
        max-width: 500px;
        height: 45vh;
        max-height: 450px;
        min-height: 300px;
        top: 5%;
        left: 50%;
        transform: translate(-50%, 0);
        transition: transform 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
    }
    
    .operator-chat.operator-chat--with-sms {
        transform: translate(-50%, 0);
        top: 5%;
        left: 50%;
        margin-right: 0;
        width: 90%;
        max-width: 500px;
        height: 45vh;
        max-height: 450px;
        min-height: 300px;
        border-top-right-radius: 15px;
        border-bottom-right-radius: 15px;
    }
    
    .sms.sms--from-list {
        width: 90%;
        max-width: 500px;
        height: 45vh;
        max-height: 450px;
        min-height: 300px;
        top: auto;
        bottom: 5%;
        left: 50%;
        transform: translate(-50%, 0);
        margin-left: 0;
        margin-top: 0;
        border-top-left-radius: 15px;
        border-bottom-left-radius: 15px;
        border-left: 1px solid transparent;
        animation: fadeInSlideMobile 0.3s ease forwards;
        transition: transform 0.3s ease, bottom 0.3s ease, width 0.3s ease, height 0.3s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .sms.sms--from-list .sms-container {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        flex: 1;
        overflow: hidden;
    }
    
    @keyframes fadeInSlideMobile {
        from {
            opacity: 0;
            transform: translate(-50%, 10px);
        }
        to {
            opacity: 1;
            transform: translate(-50%, 0);
        }
    }
}

@media (max-width: 480px) {
    .operator-chat {
        width: 95%;
        height: 40vh;
        max-height: 400px;
        min-height: 250px;
        top: 5%;
        left: 50%;
        transform: translate(-50%, 0);
    }
    
    .operator-chat.operator-chat--with-sms {
        width: 95%;
        height: 40vh;
        max-height: 400px;
        min-height: 250px;
        top: 5%;
        left: 50%;
        transform: translate(-50%, 0);
        border-top-right-radius: 15px;
        border-bottom-right-radius: 15px;
    }
    
    .sms.sms--from-list {
        width: 95%;
        height: 40vh;
        max-height: 400px;
        min-height: 250px;
        bottom: 5%;
        left: 50%;
        transform: translate(-50%, 0);
        border-top-left-radius: 15px;
        border-bottom-left-radius: 15px;
        border-left: 1px solid transparent;
        margin-top: 0;
        transition: transform 0.3s ease, bottom 0.3s ease, width 0.3s ease, height 0.3s ease;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .sms.sms--from-list .sms-container {
        display: flex;
        flex-direction: column;
        height: 100%;
        min-height: 0;
        flex: 1;
        overflow: hidden;
    }
    
    .operator-chat__header {
        padding: 12px 15px;
    }
    
    .operator-chat__title {
        font-size: 16px;
    }
    
    .operator-chat__search-input {
        width: 120px;
        font-size: 12px;
    }
    
    .operator-chat__search {
        padding: 6px 12px;
    }
    
    .operator-chat__categories {
        padding: 8px 12px;
        gap: 8px;
        overflow-x: auto;
    }
    
    .operator-chat__category {
        font-size: 11px;
        padding: 4px 6px;
    }
    
    .operator-chat__item {
        padding: 12px 15px;
    }
    
    .operator-chat__avatar {
        width: 40px;
        height: 40px;
    }
    
    .operator-chat__user-name {
        font-size: 14px;
    }
    
    .operator-chat__message-text {
        font-size: 12px;
    }
}
.sms-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #000;
    border: none;
    background: none;
    width: 35px;
    height: 35px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 10;
}

.sms-title {
margin: 16px 16px 0 30px;
display: none;
}

.sms-title__operator-status {
    color: #DB9900;
}

.sms-title__text {
    font-size: 14px;
    color: #C0C0C0;
    margin-top: 10px;
    line-height: 1.2;
}

.sms-chat-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.sms-chat {
    width: 100%;
    min-height: 350px;
}

.sms-chat__container {
    display: flex;
    justify-content: flex-end;
    position: relative;
}

.sms-chat__container.frend_mess {
    justify-content: flex-start;
}

.sms-chat__container.inform_mess {
    justify-content: flex-end;
}

.sms-chat__item {
    align-items: end;
    position: relative;
    right: 0;
    display: flex;
    max-width: 320px;
    width: 100%;
    padding: 5px;
}

.newChatOperator {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    user-select: none;
    font-weight: bold;
    color: #23959f;
}
.newChatOperator:hover {
    background-color: #ebf4e0;
    color: #99af7e;
}

.frend_mess .sms-chat__item  {
    flex-direction: row-reverse;
}

.sms-chat__user-appeal {
    min-width: 250px;
    padding: 15px;
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 1px 3px 11px -8px rgba(0, 0, 0, 0.8);
    border-top: 1px solid #d4d4d469;
}
.frend_mess .sms-chat__user-appeal {
    background: linear-gradient(108deg, #003366, #2d4c8b);
    color: #fff;
}
.inform_mess .sms-chat__user-appeal {
    box-shadow: none;
    border: none;
} 
.inform_mess .sms-chat__user-name {
    display: none;
}

.sms-chat__user-name {
    color: #003366;
    font-weight: bold;
    margin-bottom: 7px;
    display: block;
}

.sms-chat__user-messages {
    font-size: 14px;
    color: #003366;
}

.frend_mess .sms-chat__user-name {
    color: #fff;
}
.frend_mess .sms-chat__user-messages {
    color: #fff;
}

.inform_mess .sms-chat__user-messages {
    text-align: center;
    color: #a6a6a6;
}

.inform_mess .sms-chat__item {
    max-width: 100%;
}
.sms-chat__time {
    position: relative;
    font-size: 0.6rem;
    text-align: right;
    opacity: 0.5;
}

.sms-chat__user-foto {
    width: 45px;
    height: 45px;
    margin-left: 10px;
    margin-right: 10px;
    border-radius: 50px;
}
.sms-chat__user-foto img {
    width: 45px;
    height: 45px;
    border-radius: 50px;
}

.inform_mess .sms-chat__user-foto {
    display:none;
}
.operator-chat__name {
    position:relative;
}
.operator-chat__name span {
    display: inline-block;
    background-color: #bfd8f8;
    color: #576c91;
    padding: 2px 5px;
    font-size: 0.8rem;
    border-radius: 6px;
    margin: 0px 4px;
}
.operator-chat__name span.exitChat {
    background-color: #e40000;
    color: #ffe7c3;
    padding: 2px 9px;
    border-radius: 4px
}
.enterChatOper {
    position: relative;
    text-align: center;
    padding: 10px;
}
.enterChatOper span {
    cursor: pointer;
    padding: 10px;
    background: #193fa8;
    color: #fff;
    border-radius: 11px;
}

.sms-chat__operator {
    justify-content: flex-start !important;
}


.sms-chat__operator-appeal {
    background: #003366;
}

.sms-chat__operator-name {
    color: #fff;
}

.sms-chat__operator-messages {
    color: #fff;
}

.sms-chat__operator-time {
    position: relative;
    left: 80px;
    flex-direction: row;
}

@media (max-width: 768px) {
    .sms {
        max-width: none;
        border: none;
        bottom: 63px;
    }
}

@media (max-width: 480px) {
    .sms-send__form {
        padding: 0 10px;
    }
    .sms-send__message {
        margin: 0 10px;
    }
    .sms-send__file {
        padding: 20px;
    }
}

.sms-send {
    flex-shrink: 0;
    padding: 10px;
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
    min-height: 65px;
    box-sizing: border-box;
}

.sms-send__form {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-evenly;
}

.sms-send__file {
    position: relative;
    width: 45px;
    height: 45px;
    background: #fff;
    box-shadow: 0px 0px 20px -1px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    border-radius: 50px;
}

.sms-send__btn{
    position: absolute;
    z-index: 2;
    color: transparent;
    width: 45px;
    height: 45px;
    border: none;
     font-size: 0;
     opacity: 0;
     border-radius: 50px;
     cursor: pointer;
}

.sms-send__file img {
    width: 23px;
    height: 21px;
    position: absolute;
    top: 26%;
    left: 27%;
}

.sms-send__message {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    max-width: 340px;
    width: 100%;
    height: 45px;
    box-shadow: 0px 0px 20px -1px rgba(0, 0, 0, 0.3);
    border-radius: 50px;
}

.sms-send__message-container {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    max-width: 300px;
    width: 100%;
}

.sms-send__input {
    width: 100%;
    max-width: 300px;
    border: none;
    font-size: 18px;
    color: #6E6E6E;
    border-radius: 50px;
    padding: 10px;
}
.sms-send__input:focus {
    border: none;
    outline: none;
}
.sms-send__message-container button {
    background: none;
    border: none;
}
.sms-send__message-container img {
    cursor: pointer;
}

.sms-send__help {
    cursor: pointer;
}

.sms-send__help img {
    width: 45px;
    height: 45px;
}




.operator-chat {
    display: none;
    flex-direction: column;
    width: 600px;
    height: 600px;
    max-width: 90vw;
    max-height: 90vh;
    background: #fff;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999999;
    box-shadow: 0px 0px 20px -1px rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
}

.operator-chat[style*="display: flex"],
.operator-chat[style*="display: block"] {
    display: flex !important;
}

/* Когда sms открыт, operator-chat сдвигается влево */
.operator-chat.operator-chat--with-sms {
    transform: translate(-100%, -50%);
    left: 50%;
    margin-right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 2px 0 10px -2px rgba(0, 0, 0, 0.1);
}


.operator-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.operator-chat__title {
    font-size: 20px;
    font-weight: bold;
    color: #003366;
    margin: 0;
}

.operator-chat__search-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.operator-chat__search {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 20px;
    padding: 8px 15px;
    gap: 10px;
}

.operator-chat__search-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.operator-chat__search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: #333;
    width: 200px;
}

.operator-chat__search-input::placeholder {
    color: #999;
}

.operator-chat__close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.operator-chat__close:hover {
    opacity: 0.7;
}

.operator-chat__close img {
    width: 20px;
    height: 20px;
}

.operator-chat__categories {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    overflow-x: auto;
}

.operator-chat__category {
    background: none;
    border: none;
    font-size: 14px;
    color: #C0C0C0;
    cursor: pointer;
    padding: 5px 10px;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.operator-chat__category:hover {
    color: #003366;
}

.operator-chat__category--active {
    color: #003366;
    font-weight: bold;
}

.operator-chat__list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.operator-chat__item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
    user-select: none;
}

.operator-chat__item:hover {
    background-color: #f9f9f9;
}

.operator-chat__item.active {
    background-color: #edf5ff;
}
.operator-chat__item.active:hover {
    background-color: #dae6f8;
}
.count_news_mess {
    position: absolute;
    left: 10px;
    margin-top: 25px;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    color: #fff;
    background: #dd0707;
    padding: 3px;
    font-size: 0.7rem;
    text-align: center;
}

.operator-chat__avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    flex-shrink: 0;
    object-fit: cover;
}

.operator-chat__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.operator-chat__user-name {
    font-size: 16px;
    font-weight: bold;
    color: #003366;
    margin: 0;
}

.operator-chat__message-text {
    font-size: 14px;
    color: #666;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.operator-chat__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    margin-left: 10px;
    flex-shrink: 0;
}

.operator-chat__time {
    font-size: 12px;
    color: #999;
}

.operator-chat__read-status {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.operator-chat__read-status--read {
    opacity: 1;
}

.operator-chat__read-status--unread {
    opacity: 0.5;
}