:root {
    --primary: #0084ff;
    --secondary: #f0f2f5;
    --sidebar-bg: #f8f9fa;
    --chat-bg: #ffffff;
    --text-primary: #050505;
    --text-secondary: #65676b;
    --border: #e4e6eb;
    --unread: #0084ff;
    --online: #31a24c;
    --danger: #f56565;
    --warning: #ed8936;
    --success: #48bb78;
    --threads-panel-width: 250px;
    --info-panel-width: 350px;
    --transition-speed: 0.3s;
    --avatar-size: 50px;
    --channel-badge-size: 22px;
}

[data-theme="dark"] {
    --primary: #2d88ff;
    --secondary: #242526;
    --sidebar-bg: #18191a;
    --chat-bg: #242526;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --border: #3e4042;
    --unread: #2d88ff;
    --online: #31a24c;
    --danger: #fc8181;
    --warning: #f6ad55;
    --success: #68d391;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--secondary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

body,
.left-panel,
.center-panel,
.right-panel,
.threads-panel,
.info-panel,
.chat-item,
.message,
.modal-content,
.member-item {
    transition: background-color var(--transition-speed) ease,
        border-color var(--transition-speed) ease,
        color var(--transition-speed) ease,
        box-shadow var(--transition-speed) ease;
}

.left-panel {
    width: 80px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 30px;
    cursor: pointer;
    border: 3px solid var(--primary);
    transition: border-color var(--transition-speed) ease;
    will-change: border-color;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed) ease;
}

.user-avatar:hover img {
    transform: scale(1.1);
}

.nav-icons {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-speed) ease;
}

.nav-icon:hover,
.nav-icon.active {
    background: var(--primary);
    color: white;
}

.center-panel {
    width: 350px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-weight: 600;
    font-size: 1.2em;
}

.panel-actions {
    display: flex;
    gap: 10px;
}

.panel-action {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-speed) ease;
}

.panel-action:hover {
    background: var(--secondary);
}

.search-box {
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--chat-bg);
    color: var(--text-primary);
    transition: border-color var(--transition-speed) ease,
        background-color var(--transition-speed) ease,
        color var(--transition-speed) ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-speed) ease,
        border-color var(--transition-speed) ease;
    position: relative;
}

.chat-item:hover {
    background: var(--secondary);
}

.chat-item.active {
    background: var(--primary);
    color: white;
}

.chat-item.active .last-message,
.chat-item.active .chat-meta {
    color: rgba(255, 255, 255, 0.8);
}

.chat-avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-speed) ease;
}

.chat-item:hover .chat-avatar img {
    transform: scale(1.05);
}

.online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--online);
    border-radius: 50%;
    border: 2px solid var(--sidebar-bg);
    transition: background-color var(--transition-speed) ease,
        border-color var(--transition-speed) ease;
}

.channel-badge {
    position: absolute;
    top: 15px;
    left: 10px;
    background: var(--primary);
    color: white;
    width: var(--channel-badge-size);
    height: var(--channel-badge-size);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid var(--sidebar-bg);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color var(--transition-speed) ease,
        border-color var(--transition-speed) ease,
        box-shadow var(--transition-speed) ease;
}

.pinned-badge {
    position: absolute;
    top: -5px;
    left: -5px;
    background: var(--primary);
    color: white;
    width: var(--channel-badge-size);
    height: var(--channel-badge-size);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid var(--sidebar-bg);
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: background-color var(--transition-speed) ease,
        border-color var(--transition-speed) ease;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-message {
    font-size: 0.9em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    text-align: right;
    font-size: 0.8em;
    color: var(--text-secondary);
}

.unread-count {
    background: var(--unread);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7em;
    margin-top: 5px;
    display: inline-block;
    transition: background-color var(--transition-speed) ease;
}

.blocked-badge {
    background: var(--danger);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7em;
    margin-top: 5px;
    display: inline-block;
}

.threads-panel {
    width: var(--threads-panel-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-speed) ease,
        background-color var(--transition-speed) ease,
        border-color var(--transition-speed) ease,
        opacity var(--transition-speed) ease,
        transform var(--transition-speed) ease;
    overflow: hidden;
    flex-shrink: 0;
}

.threads-panel.hidden {
    width: 0;
    opacity: 0;
    transform: translateX(-100%);
    overflow: hidden;
    border-right: none;
    padding: 0;
}

.threads-panel.compact {
    width: 80px;
}

.threads-panel.compact .thread-item {
    padding: 10px;
    justify-content: center;
}

.threads-panel.compact .thread-info {
    display: none;
}

.threads-panel.compact .thread-avatar {
    width: 40px;
    height: 40px;
    margin: 0;
}

.threads-panel.compact .thread-drag-handle {
    display: none;
}

.threads-panel.compact .threads-title {
    display: none;
}

.threads-panel.compact .compact-toggle i {
    transform: rotate(180deg);
}

.threads-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: padding var(--transition-speed) ease;
}

.threads-panel.compact .threads-header {
    padding: 15px 10px;
    justify-content: center;
}

.threads-panel.compact .threads-header .threads-title {
    display: none;
}

.threads-title {
    font-weight: 600;
    font-size: 1em;
    white-space: nowrap;
    transition: opacity var(--transition-speed) ease;
}

.threads-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    transition: padding var(--transition-speed) ease;
}

.threads-panel.compact .threads-list {
    padding: 10px 5px;
}

.thread-item {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background var(--transition-speed) ease,
        padding var(--transition-speed) ease,
        gap var(--transition-speed) ease;
    position: relative;
    user-select: none;
}

.thread-item:hover {
    background: var(--secondary);
}

.thread-item.active {
    background: var(--primary);
    color: white;
}

.thread-item.sortable-chosen {
    background: var(--secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.thread-item.sortable-ghost {
    opacity: 0.5;
    background: var(--secondary);
}

.thread-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.thread-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thread-info {
    flex: 1;
    min-width: 0;
    transition: opacity var(--transition-speed) ease;
}

.thread-name {
    font-weight: 500;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 5px;
}

.thread-unread {
    background: var(--unread);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.7em;
    margin-left: 5px;
}

.thread-last-message {
    font-size: 0.8em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.thread-drag-handle {
    opacity: 0.3;
    cursor: move;
    padding: 5px;
    margin-right: -5px;
    transition: opacity var(--transition-speed) ease;
}

.thread-drag-handle:hover {
    opacity: 0.7;
}

.compact-toggle {
    cursor: pointer;
    color: var(--text-secondary);
    transition: transform var(--transition-speed) ease,
        color var(--transition-speed) ease;
}

.info-panel {
    width: var(--info-panel-width);
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
        opacity 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
        background-color 0.3s ease,
        border-color 0.3s ease;
    overflow: hidden;
    flex-shrink: 0;
    will-change: width, opacity, transform;
}

.info-panel.hidden {
    width: 0;
    opacity: 0;
    transform: translateX(100%);
    overflow: hidden;
    border-left: none;
    padding: 0;
}

.info-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-title {
    font-weight: 600;
    font-size: 1.2em;
}

.info-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.chat-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-speed) ease;
}

.chat-action:hover {
    background: var(--secondary);
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    transition: background-color var(--transition-speed) ease,
        color var(--transition-speed) ease;
}

.message.outgoing {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message.incoming {
    background: var(--secondary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.muted {
    opacity: 0.7;
    border-left: 3px solid var(--danger);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.message-sender-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.message-sender-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-sender-name {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-secondary);
}

.message-text {
    word-wrap: break-word;
}

.message-time {
    font-size: 0.7em;
    opacity: 0.8;
    text-align: right;
    margin-top: 5px;
}

.attachment {
    max-width: 300px;
    margin-top: 5px;
}

.attachment img,
.attachment video {
    max-width: 100%;
    border-radius: 10px;
}

.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.voice-wave {
    flex: 1;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.voice-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
}

.voice-play-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.context-menu {
    position: fixed;
    background: var(--chat-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    display: none;
    transition: background-color var(--transition-speed) ease,
        border-color var(--transition-speed) ease,
        box-shadow var(--transition-speed) ease;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background var(--transition-speed) ease;
}

.context-menu-item:hover {
    background: var(--secondary);
}

.context-menu-item i {
    width: 20px;
    color: var(--text-secondary);
}

.context-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 5px 0;
}

.music-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1000;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--primary);
    color: white;
}

.player-info {
    flex: 1;
}

.player-track {
    font-weight: 500;
    margin-bottom: 5px;
}

.player-progress {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    cursor: pointer;
    overflow: hidden;
}

.player-progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s linear;
}

.message-input-container {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-input {
    flex: 1;
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid var(--border);
    background: var(--secondary);
    color: var(--text-primary);
    resize: none;
    max-height: 120px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color var(--transition-speed) ease,
        background-color var(--transition-speed) ease,
        color var(--transition-speed) ease;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
}

.input-actions {
    display: flex;
    gap: 10px;
}

.input-action {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all var(--transition-speed) ease;
}

.input-action:hover {
    background: var(--secondary);
}

.input-action.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--chat-bg);
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--transition-speed) ease,
        background-color var(--transition-speed) ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 20px;
}

.modal-close {
    cursor: pointer;
    font-size: 1.5em;
    color: var(--text-secondary);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background var(--transition-speed) ease,
        opacity var(--transition-speed) ease;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.chat-info-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.chat-info-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 15px;
    cursor: pointer;
    position: relative;
}

.chat-info-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-info-avatar:hover::after {
    content: '✏️';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5em;
}

.chat-info-field {
    margin-bottom: 12px;
}

.chat-info-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.chat-info-value {
    font-size: 1em;
    color: var(--text-primary);
}

.edit-info-field {
    margin-bottom: 15px;
}

.edit-info-field label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.edit-info-field input,
.edit-info-field textarea,
.edit-info-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--secondary);
    color: var(--text-primary);
    transition: border-color var(--transition-speed) ease,
        background-color var(--transition-speed) ease,
        color var(--transition-speed) ease;
}

.edit-info-field input:focus,
.edit-info-field textarea:focus,
.edit-info-field select:focus {
    outline: none;
    border-color: var(--primary);
}

.members-list {
    max-height: 300px;
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background var(--transition-speed) ease;
}

.member-item:hover {
    background: var(--secondary);
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 500;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.member-role {
    font-size: 0.8em;
    color: var(--text-secondary);
}

.member-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 12px;
    margin-left: 5px;
}

.member-badge-icon.muted {
    background: var(--warning);
}

.member-badge-icon.blocked {
    background: var(--danger);
}

.member-badge-icon.creator {
    background: #ffc107;
    color: #000;
}

.member-badge-icon.admin {
    background: #6c5ce7;
}

.member-actions {
    display: flex;
    gap: 5px;
}

.member-action {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-speed) ease;
}

.member-action:hover {
    background: var(--secondary);
}

.member-action i {
    font-size: 0.9em;
}

.channel-header {
    display: flex;
    flex-direction: column;
}

.channel-info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.channel-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
}

.channel-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-name-link {
    font-size: 0.85em;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
}

.channel-name-link:hover {
    text-decoration: underline;
}

.thread-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.thread-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.thread-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thread-title-wrapper {
    display: flex;
    flex-direction: column;
}

.thread-title-main {
    font-weight: 600;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thread-subtitle {
    font-size: 0.8em;
    color: var(--text-secondary);
}

.invite-members-btn {
    padding: 5px 10px;
    float: right;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: background var(--transition-speed) ease, transform 0.2s ease;
}

.invite-members-btn:hover {
    background: #0066cc;
    transform: scale(1.02);
}

.invite-members-btn i {
    font-size: 1em;
}

.threads-header .panel-actions .fa-plus {
    display: block;
}

.threads-panel.compact .threads-header .panel-actions .fa-plus {
    display: block;
}

.threads-empty-state {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.leave-chat-btn {
    color: var(--danger);
}

.duration-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.duration-option {
    flex: 1 0 calc(50% - 5px);
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.duration-option:hover {
    background: var(--secondary);
}

.duration-option.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.duration-option.permanent {
    background: var(--danger);
    color: white;
}

@media (max-width: 1200px) {
    .center-panel {
        width: 300px;
    }

    .info-panel {
        width: 300px;
    }

    .threads-panel {
        width: 200px;
    }

    .threads-panel.compact {
        width: 70px;
    }
}

@media (max-width: 992px) {
    .center-panel {
        width: 280px;
    }

    .info-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }
}

@media (max-width: 768px) {
    .left-panel {
        width: 70px;
    }

    .center-panel {
        width: 100%;
        position: absolute;
        z-index: 100;
        display: none;
    }

    .center-panel.active {
        display: flex;
    }

    .threads-panel {
        position: relative;
        top: 0;
        bottom: 0;
        z-index: 90;
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
    }

}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 1.5s infinite;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.cursor-move {
    cursor: move;
}

img {
    backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
}

.chat-avatar img,
.user-avatar img,
.thread-avatar img,
.member-avatar img {
    content-visibility: auto;
}

/* Стили для страницы логина (перенесены из index.php) */
.login-container {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}
.login-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}
.tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}
.tab {
    flex: 1;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    border-bottom: 3px solid transparent;
}
.tab.active {
    border-bottom-color: #667eea;
    color: #667eea;
    font-weight: 600;
}
.form {
    display: none;
}
.form.active {
    display: block;
}
.input-group {
    margin-bottom: 1rem;
}
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #555;
    font-weight: 500;
}
.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}
.input-group input:focus {
    outline: none;
    border-color: #667eea;
}
.login-container button {
    width: 100%;
    padding: 0.75rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}
.login-container button:hover {
    background: #5a67d8;
}
.error {
    background: #fed7d7;
    color: #c53030;
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    display: none;
}
.referral-link {
    margin-top: 1rem;
    text-align: center;
    color: #666;
}
.referral-link a {
    color: #667eea;
    text-decoration: none;
}