@import url('modal/createChannel.css');
@import url('modal/createServer.css');
@import url('modal/inviteServer.css');
@import url('modal/inviteEdit.css');

/* Стили загрузки каналов */
.channel-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    gap: 16px;
}

.channel-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--background-tertiary);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: channel-loading-spin 1s linear infinite;
}

@keyframes channel-loading-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.channel-loading span {
    font-size: 14px;
    font-weight: 500;
}

/* Скелетон загрузки для заголовка */
.skeleton-loader {
    display: inline-block;
    background: linear-gradient(90deg,
            var(--background-tertiary) 25%,
            var(--background-modifier-hover) 50%,
            var(--background-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-title {
    width: 150px;
    height: 20px;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.welcome-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.channels-list {
    list-style: none;
    padding: 0;
    margin: 0;
    height: 100%;
    overflow-y: auto;
}

.channels-list:has(.no-channels) {
    display: flex;
    align-content: stretch;
    justify-content: space-around;
    align-items: center;
}


.channels-list .no-channels {
    color: var(--text-muted);
    padding: 16px;
    text-align: center;
}

.no-channels p {
    margin-bottom: 16px;
    font-size: 14px;
}

.create-channel-btn {
    background-color: var(--brand);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.create-channel-btn:hover {
    background-color: var(--brand-hover);
}

/* Контейнер заголовка сервера */
.server-header-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.server-name-sidebar {
    background: var(--background-secondary);
    padding: 7.5px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--header-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Кнопка действия */
.server-action-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.7;
}

[data-theme="light"] .server-action-btn {
    filter: brightness(0.5);
}

[data-theme="light"] .server-action-btn:hover {
    filter: brightness(0.3);
}

.server-action-btn:hover {
    background-color: var(--background-modifier-hover);
    opacity: 1;
    transform: translateY(-1px);
}

.server-action-btn:active {
    transform: translateY(0);
}

.server-action-icon {
    transition: filter 0.2s ease;
}

/* Стили для категорий каналов */
.channel-category {
    margin-bottom: 4px;
}

.channel-category:last-child {
    margin-bottom: 0;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    margin-bottom: 4px;
}

.category-toggle-btn {
    background: none;
    border: none;
    width: 16px;
    height: 16px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.category-toggle-btn:hover {
    opacity: 1;
}

[data-theme="light"] .category-toggle-btn {
    filter: brightness(0.5);
}

[data-theme="light"] .category-toggle-btn:hover {
    filter: brightness(0.3);
}

.category-toggle-icon {
    width: 12px;
    height: 12px;
    transition: transform 0.2s ease;
}

.category-header h5 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    user-select: none;
    flex: 1;
    cursor: pointer;
    transition: color 0.2s ease;
}

.category-header h5:hover {
    color: var(--text-normal);
}

/* Collapsed state */
.channel-category.collapsed .category-channels {
    display: none;
}

/* Кнопка создания канала в категории */
.create-channel-in-category {
    background: none;
    border: none;
    width: 20px;
    height: 20px;
    padding: 2px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: all 0.2s ease;
}

.create-channel-in-category:hover {
    background-color: var(--background-modifier-hover);
    opacity: 1;
}

.create-channel-icon {
    width: 16px;
    height: 16px;
    transition: filter 0.2s ease;
}

.channel-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px 6px 16px;
    margin: 1px 0;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.channel-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-item-header .newMessage {
    height: 18px;
    min-width: 17px;
    font-size: 12px;
    margin-right: 8px;
    background-color: var(--status-danger);
    border-radius: 20px
}

.channel-item:hover {
    background-color: var(--background-modifier-hover);
    color: var(--text-normal);
}

.channel-item:hover img {
    filter: brightness(1);
}

[data-theme="light"] .channel-item:hover img {
    filter: brightness(0.4);
}

.channel-item.active,
.channel-item.select {
    background-color: var(--selected);
    color: var(--text-normal);
}

.channel-icon {
    font-size: 18px;
    min-width: 16px;
    text-align: center;
    display: flex;
    align-items: center;
}

.channel-icon img {
    width: 16px;
    height: 16px;
    filter: brightness(0.7);
}

.channel-name {
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* Voice Channel Join Button */
.voice-channel-join-btn {
    display: none;
    background: none;
    border: none;
    width: 20px;
    height: 20px;
    padding: 0;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}


/* Voice Channel Users */
.voice-channel-users {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 24px;
    margin-top: 4px;
}

.voice-channel-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.voice-channel-user:hover {
    background-color: var(--background-modifier-hover);
}

.voice-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.voice-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.voice-user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.voice-user-name {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-normal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.voice-user-devices {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.device-icon {
    width: 14px;
    height: 14px;
    opacity: 1;
}

.device-icon.inactive {
    opacity: 1;
}

/* Channel list action button (Create Category) */
.channel-list-action-wrapper {
    padding: 8px 10px;
    box-sizing: border-box;
    width: 100%;
}

.channel-list-action-button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px;
    background-color: var(--background-secondary);
    color: var(--text-muted);
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.channel-list-action-button:hover {
    background-color: var(--background-modifier-hover);
    color: var(--text-primary);
}

.channel-list-action-icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.channel-list-action-button span {
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


@media (max-width: 768px) {
    .channels-list {
        margin-left: 60px;
    }
}