html, body{
    height: 100%;
    margin: 0;
    padding: 0;
}

body{
    background: #000 url(../images/background.png) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    background-attachment: fixed;
}

.content{
    background-color: #FFFFFF;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.block-authorisation{
    background-color: rgba(255,255,255,0.13);
    position: absolute;
    transform: translate(-50%,-50%);
    top: 30%;
    left: 50%;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 0 40px rgba(8,7,16,0.6);
    padding: 50px 35px;
}

form *{
    font-family: 'Poppins',sans-serif;
    letter-spacing: 0.5px;
    outline: none;
    border: none;
}

.nav_breadcrumb{
    margin-top: 10px;
}

.prog_chat{
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
}

#app{
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.rooms-toggle{
    position: fixed;
    z-index: 1040;
}

.rooms_board{
    width: 20%;
    background: rgb(26 26 26 / 65%);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    max-height: 100vh;
}

.rooms{
    margin: 5px 5px 5px 5px;
    overflow-y: auto;
    flex: 1;
}

.room{
    background-color: #0003;
    padding: 5px;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
}

.room a{
    color: #fff;
    text-decoration: unset;
}

.room a:hover{
    color: #fff;
}

.chat{
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    min-width: 0;
    min-height: 0;
    background: rgb(26 26 26 / 33%);
    backdrop-filter: blur(10px);
}

.chat .room{
    background-color: #0003;
    padding-left: 5px;
}

.room .row{
    --bs-gutter-x: auto;
}

.messages{
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.messages .list{
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    white-space: nowrap;
}

.voice-timer{
    color: #fff;
    font-size: 0.85em;
    vertical-align: middle;
    font-weight: 600;
}

.messageComposer{
    flex-shrink: 0;
    width: 100%;
    padding: 8px 12px;
}

.composer-input-row {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-bottom: 8px;
}

.composer-input-row .msgInput {
    flex: 1;
    min-width: 0;
    resize: none;
    max-height: 200px;
    overflow-y: auto;
}

.composer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.composer-actions > div {
    margin-bottom: 0;
}

.file-upload-wrapper {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-upload-name {
    max-width: 140px;
    font-size: 0.85em;
    color: rgba(255,255,255,0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg{
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.msg + .msg{
    margin-top: 4px;
}

.msg-date-separator{
    text-align: center;
    font-size: 0.78em;
    color: #000;
    padding: 12px 0 6px;
    font-weight: 700;
}

.msg-join-text{
    color:  #ff0000;
    font-style: italic;
}

.msg-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.msg-author{
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82em;
    color: #000769;
    font-weight: 600;
    text-transform: capitalize;
}

.msg-avatar{
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.msg-time{
    font-size: 0.75em;
    color: rgba(255,255,255,0.65);
}

.msg-body{
    color: #fff;
    word-break: break-word;
    white-space: pre-wrap;
}

.msg-header-right{
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-reply{
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    font-size: 0.85em;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.btn-reply:hover{
    color: rgba(255,255,255,0.9);
}

.btn-delete{
    background: none;
    border: none;
    color: rgba(255,80,80,0.5);
    cursor: pointer;
    font-size: 0.9em;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.btn-delete:hover{
    color: rgba(255,80,80,1);
}

.msg-deleted{
    color: #888;
    font-style: italic;
}

.reply-context{
    padding: 4px 8px;
    margin-bottom: 6px;
    border-left: 3px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.15s;
}

.reply-context:hover{
    background: rgba(255,255,255,0.12);
}

.reply-context-sender{
    color: rgba(255,255,255,0.6);
    font-weight: 600;
    font-size: 0.8em;
    margin-bottom: 2px;
}

.reply-context-body{
    color: rgba(255,255,255,0.5);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-highlight{
    background: rgba(255, 235, 59, 0.15) !important;
    transition: background 0.5s;
}

.reply-indicator{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.reply-indicator-text{
    flex: 1;
    color: rgba(255,255,255,0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-image {
    max-width: 320px;
    max-height: 300px;
    width: auto;
    height: auto;
    display: block;
    margin-bottom: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-input {
    display: none;
}

.file-upload-button {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
    background: rgba(255,255,255,0.08);
    transition: background .25s ease, transform .2s ease;
    cursor: pointer;
    font-weight: 600;
}

.file-upload-button:hover,
.file-upload-button:focus {
    background: rgba(255,255,255,0.18);
    transform: translateY(-1px);
}

.file-upload-name {
    font-size: 0.9em;
    color: rgba(255,255,255,0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.chat-video {
    max-width: 400px;
    max-height: 300px;
    width: 100%;
    display: block;
    margin-bottom: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background: #000;
}

.video-wrap {
    position: relative;
    display: inline-block;
    max-width: 400px;
}

.video-thumb {
    position: relative;
    cursor: pointer;
    line-height: 0;
    border-radius: 8px;
    overflow: hidden;
}

.video-thumb .chat-video {
    max-height: none;
}

.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    transition: background .2s;
    border-radius: 8px;
}

.video-thumb:hover .video-play-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.video-play-icon {
    font-size: 48px;
    color: #fff;
    opacity: 0.9;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: transform .15s;
}

.video-thumb:hover .video-play-icon {
    transform: scale(1.15);
}

.chat-audio {
    width: 100%;
    max-width: 400px;
    display: block;
    margin-bottom: 8px;
    border-radius: 8px;
}

.audio-wrap {
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.voice-label{
    font-size: 1.1em;
    flex-shrink: 0;
}

.video-preview {
    max-width: 100%;
    max-height: 80vh;
    width: 100%;
    outline: none;
}

.image-preview {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.modal-content.bg-dark {
    background: rgba(0, 0, 0, 0.95);
}

.msg-own {
    background: rgba(56, 142, 60, 0.12);
    border-radius: 10px;
}

.msg-other {
    background: rgba(13, 71, 161, 0.12);
    border-radius: 10px;
}

.msg-audio audio{
    width: 280px;
    height: 40px;
}

.messages .list{
    white-space: normal;
}

.mic-btn{
    margin: 0 4px;
}

.mic-btn.recording{
    background-color: #dc3545;
    border-color: #dc3545;
    animation: pulse 1s infinite;
}

@keyframes pulse{
    0%, 100%{ opacity: 1; }
    50%{ opacity: 0.5; }
}

.voice-preview{
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    margin: 4px 0;
}

.voice-preview audio{
    height: 36px;
}

.invited-section{
    padding: 0 8px;
}

.invited-section h6{
    color: #ffc107;
}

.invited-room{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.room-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 6px;
}

.room-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}

.room-avatar-md {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.room-title-text {
    font-size: 1.1em;
    font-weight: 600;
    color: #fff;
}

.room-topic {
    font-size: 0.8em;
    color: rgba(255,255,255,0.6);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.room-avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.2);
}

.room-link {
    display: flex;
    align-items: center;
    gap: 6px;
}

.unread-badge{
    background: #dc3545;
    color: #fff;
    border-radius: 10px;
    padding: 0 6px;
    font-size: 0.7em;
    font-weight: 700;
    line-height: 1.5;
    margin-left: auto;
}

.profile-avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto;
    display: block;
}

.profile-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 2em;
    font-weight: 700;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto;
}

#profileModal .form-label {
    font-size: 0.9em;
    margin-bottom: 4px;
}

/* Кнопка открытия списка комнат (мобильная) */
.rooms-toggle {
    display: none;
    position: fixed;
    z-index: 1050;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    font-size: 1.2em;
    line-height: 40px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Затемнение подложки */
.rooms-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1020;
    background: rgba(0,0,0,0.5);
}

/* Мобильная версия */
@media (max-width: 767.98px) {
    .block-authorisation{
        top: 45%;
    }
    
    .rooms-toggle {
        display: block;
    }

    .rooms_board {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 1030;
        transition: left 0.25s ease;
        display: flex;
        flex-direction: column;
    }

    .rooms_board.visible {
        left: 0;
    }

    .rooms-overlay.visible {
        display: block;
    }

    .rooms-header .btn-close {
        margin-left: auto;
    }

    .chat .room .row {
        padding-left: 50px;
    }
}