* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Whitney, Helvetica Neue, Helvetica, Arial, sans-serif;
    background: #36393f;
    color: #dcddde;
    height: 100vh;
    display: flex;
    overflow: hidden;
}


.channels-sidebar {
    width: 280px;
    background: #2f3136;
    display: flex;
    flex-direction: column;
    padding-right: 5px;
    gap: -10px; /* ← Добавьте отступ между секциями */
}

.server-header {
    padding: 16px;
    border-bottom: 1px solid #202225;
    font-weight: bold;
    color: #fff;
    text-align: center;
}

.technical-section {
    margin: 0px 0;
    padding: 16px;
    background: #36393f;
    border-radius: 8px;
}

.section-title {
    color: #fff;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
    padding-left: 10px;
    /*text-align: center;*/
}

.controls-group {
    margin: 12px 0;
}

.control-button {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    margin: 4px 0;
    transition: background 0.2s ease;
}

.join-button {
    background: #5865f2;
    color: white;
}

.join-button:hover {
    background: #4752c4;
}

.leave-button {
    background: #ed4245;
    color: white;
}

.leave-button:hover {
    background: #c03537;
}

.action-button {
    background: #4f545c;
    color: #dcddde;
}

.action-button:hover {
    background: #5d6269;
}

.action-button.active {
    background: #ed4245 !important;
}

.action-button.active:hover {
    background: #c03537 !important;
}

.room-input {
    width: 100%;
    background: #40444b;
    border: 1px solid #202225;
    color: #dcddde;
    padding: 10px;
    border-radius: 4px;
    margin: 8px 0;
}

/* Main chat area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #36393f;
}

.chat-header {
    padding: 16px;
    border-bottom: 1px solid #202225;
    align-items: center;
    gap: 8px;
    background: #2f3136;
}

.room-header {
    padding: 16px;
    border-bottom: 1px solid #202225;
    align-items: center;
    gap: 8px;
    background: #2f3136;
}

.channel-name {
    font-weight: bold;
    color: #fff;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #36393f;
}

/* Сообщения */
.message {
    margin: 16px 0;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background 0.2s ease;
    max-width: 80%;
}

/* Свои сообщения - справа, зеленые */
.own-message {
    background: rgba(67 181 129 / 15%);
    border-left: 3px solid #43b581;
    margin-left: auto;
    margin-right: 0;
    text-align: right;
}

/* Чужие сообщения - слева, синие */
.other-message {
    background: rgba(88 101 242 / 15%);
    border-left: 3px solid #5865f2;
    margin-left: 0;
    margin-right: auto;
}

.message:hover {
    background: rgba(79 84 92 / 16%);
}

/* Заголовок сообщения */
.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

/* Для своих сообщений выравниваем заголовок по правому краю */
.own-message .message-header {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

/* Аватарка отправителя */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 12px;
    flex-shrink: 0;
}

/* Цвета аватарок */
.own-message .message-avatar {
    background: #43b581;
}

.other-message .message-avatar {
    background: #5865f2;
}

/* Имя отправителя */
.message-sender {
    font-weight: 600;
    font-size: 14px;
}

.own-message .message-sender {
    color: #43b581;
}

.other-message .message-sender {
    color: #5865f2;
}

/* Время сообщения */
.message-time {
    color: #72767d;
    font-size: 11px;
    opacity: 0.8;
}

/* Контент сообщения */
.message-content {
    color: #dcddde;
    line-height: 1.4;
    font-size: 14px;
    word-wrap: break-word;
}

/* Для своих сообщений выравниваем текст по правому краю */
.own-message .message-content {
    text-align: right;
}

/* Input area */
.input-container {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 16px;
    background: #40444b;
}

.message-input {
    flex: 1;
    background: #40444b;
    border: none;
    color: #dcddde;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.message-input:focus {
    outline: none;
}

.message-input::placeholder {
    color: #72767d;
}

.send-button {
    padding: 12px 20px;
    background: #5865f2;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.send-button:hover {
    background: #4752c4;
}

.send-button:disabled {
    background: #4f545c;
    cursor: not-allowed;
}

.participant {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 4px;
    margin: 4px 0;
}

.participant:hover {
    background: #36393f;
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 12px;
}

/* Audio output */
.audio-output-container {
    margin: 10px 0;
    max-height: 120px;
    overflow-y: auto;
    display: none;
}

.remote-audio {
    width: 100%;
    margin: 5px 0;
    background: #36393f;
    border-radius: 4px;
    padding: 8px;
}

.remote-audio::-webkit-media-controls-panel {
    background: #2f3136;
}

.audio-stream-info {
    font-size: 11px;
    color: #72767d;
    margin-top: 4px;
    text-align: center;
}


.user-controls-section {
    margin-top: auto;
    padding: 16px;
    background: #40444B;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%; /* ← Добавьте это */
    height: 76px;
    box-sizing: border-box; /* ← Важно! */
}

.user-info-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 14px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-id {
    font-size: 12px;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 10px;
    color: #72767d;
}

.user-status.connected {
    color: #3ba55d;
}

.audio-controls-compact {
    display: flex;
    gap: 4px;
}

.icon-music {
    color: #735bc1; /* Задаёт зелёный цвет */
}

.icon-button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 4px;
    background: #4f545c;
    color: #dcddde;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.icon-button i {
    font-size: 14px;
}

.icon-button:hover {
    background: #5d6269;
    transform: scale(1.05);
}

.icon-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.icon-button.active {
    background: #ed4245;
    color: white;
}

.icon-button.active:hover {
    background: #c03537;
}

/* Status indicators */
.status-online {
    color: #3ba55d;
    font-size: 10px;
}

.status-offline {
    color: #5e5c5c;
    font-size: 10px;
}

.status-speaking {
    color: #5865f2;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #2e3338;
}

::-webkit-scrollbar-thumb {
    background: #202225;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1a1b1e;
}

.user-info {
    margin-top: auto;
    padding: 16px;
    background: #292b2f;
    border-radius: 8px;
    text-align: center;
}

/* Right Sidebar - Participants */
.room-info {
    background: #2f3136;
    padding-left: 5px;

    /*border-left: 1px solid #202225;*/
    width: 280px; /* Немного шире для регуляторов */
}

.participant {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;

    /*margin: 8px 0;*/
    background: #36393f;
    transition: background 0.2s ease;
}

.participant:hover {
    background: #40444b;
}

.participant-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #5865f2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.participant-info {
    flex: 1;
    min-width: 0;
}

.participant-name {
    font-size: 14px;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-online {
    color: #3ba55d;
    font-size: 12px;
}

/* Volume controls */
.volume-control {
    width: 80px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.participant:hover .volume-control {
    opacity: 1;
}

.volume-slider {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #40444b;
    outline: none;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #5865f2;
    cursor: pointer;
    transition: background 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #4752c4;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #5865f2;
    cursor: pointer;
    border: none;
}

.status-offline {
    color: #72767d;
    font-size: 12px;
}

/* Кнопка прикрепления файлов */
.attach-button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: #4f545c;
    color: #dcddde;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.attach-button:hover {
    background: #5d6269;
    transform: scale(1.05);
}

.attach-button:active {
    transform: scale(0.95);
}

.attach-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.attach-button i {
    font-size: 16px;
}

/* Меню прикрепления */
.attach-menu {
    position: fixed;
    bottom: 80px; /* Выше поля ввода */
    left: 30%;
    transform: translateX(-50%);
    background: #2f3136;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 20px rgba(0 0 0 / 30%);
    z-index: 1000;
    display: none;
    min-width: 200px;
}

.attach-menu.open {
    display: block;
}

.attach-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.attach-option:hover {
    background: #40444b;
}

.attach-option i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
    color: #b9bbbe;
}

.attach-option span {
    font-size: 14px;
    color: #dcddde;
}

/* Сообщения с файлами */
.message-file {
    margin-top: 8px;
    padding: 12px;
    background: rgba(79 84 92 / 30%);
    border-radius: 8px;
    border-left: 3px solid #5865f2;
}

.file-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    font-size: 24px;
    color: #5865f2;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    word-break: break-word;
}

.file-size {
    font-size: 12px;
    color: #b9bbbe;
}

.file-image {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 8px;
}

.file-download {
    background: #5865f2;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-block;
}

.file-download:hover {
    background: #4752c4;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100dvh;
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
        overflow: auto;
    }

    .channels-sidebar,
    .room-info {
        width: 100%;
        padding: 0;
    }

    .channels-sidebar {
        display: grid;
        grid-template-columns: 1fr auto;
        background: #2f3136;
    }

    .server-header,
    .technical-section {
        grid-column: 1 / -1;
    }

    .technical-section {
        padding: 10px 12px;
        border-radius: 0;
    }

    .controls-group {
        display: flex;
        gap: 8px;
        margin: 8px 0 0;
    }

    .control-button {
        margin: 0;
        min-height: 44px;
    }

    .audio-output-container {
        display: none;
    }

    .user-controls-section {
        grid-column: 1 / -1;
        grid-row: 1;
        width: auto;
        height: auto;
        margin: 0;
        padding: 10px 12px;
        border-radius: 0;
    }

    .main-content {
        min-height: 0;
    }

    .chat-header {
        padding: 12px;
    }

    .chat-messages {
        padding: 12px;
    }

    .message {
        max-width: 92%;
        margin: 10px 0;
        padding: 8px 10px;
    }

    .input-container {
        padding: 10px;
        gap: 6px;
        position: sticky;
        bottom: 0;
    }

    .message-input {
        min-width: 0;
        min-height: 44px;
    }

    .send-button,
    .attach-button {
        min-height: 44px;
    }

    .send-button {
        padding: 12px;
    }

    .room-info {
        border-top: 1px solid #202225;
    }

    .room-header {
        padding: 10px 12px;
    }

    .participants-list {
        display: flex;
        gap: 8px;
        padding: 8px 12px;
        overflow-x: auto;
    }

    .participant {
        min-width: 180px;
        margin: 0;
        padding: 8px;
    }

    .volume-control {
        width: 56px;
    }

    .attach-menu {
        bottom: 72px;
        left: 12px;
        right: 12px;
        transform: none;
    }

    .file-image {
        max-width: 100%;
    }

    .attach-option {
        padding: 12px 16px;
    }
}

@media (max-width: 380px) {
    .server-header {
        display: none;
    }

    .section-title {
        margin-bottom: 4px;
    }

    .room-input {
        padding: 8px;
        margin: 4px 0;
    }

    .user-id {
        max-width: 140px;
    }
}
