@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-deepest: #0b0d11;
    --bg-deep: #0f1117;
    --bg-surface: #151820;
    --bg-elevated: #1a1e28;
    --bg-hover: #1f2433;
    --bg-active: #262c3a;
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-default: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text-primary: #f0f2f5;
    --text-secondary: #9ca3b0;
    --text-muted: #555d6e;
    --accent: #6c5ce7;
    --accent-hover: #8b7cf7;
    --accent-glow: rgba(108, 92, 231, 0.25);
    --accent-gradient: linear-gradient(135deg, #6c5ce7 0%, #a855f7 50%, #ec4899 100%);
    --accent-gradient-hover: linear-gradient(135deg, #8b7cf7 0%, #c084fc 50%, #f472b6 100%);
    --green: #22c55e;
    --green-glow: rgba(34, 197, 94, 0.15);
    --red: #ef4444;
    --red-glow: rgba(239, 68, 68, 0.15);
    --yellow: #f59e0b;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.65);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-deepest);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* ===================== SERVER LIST ===================== */
.server-list {
    width: 72px;
    background: linear-gradient(180deg, #0d0f14 0%, #0a0c10 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 8px;
    overflow-y: auto;
    border-right: 1px solid var(--border-subtle);
    position: relative;
}

.server-list::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(108, 92, 231, 0.15) 50%, transparent 100%);
}

.server-list::-webkit-scrollbar {
    width: 0;
}

.server-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-secondary);
    position: relative;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.server-icon::before {
    content: '';
    position: absolute;
    left: -12px;
    width: 4px;
    height: 0;
    background: var(--accent-gradient);
    border-radius: 0 4px 4px 0;
    transition: height var(--transition-normal);
    box-shadow: 0 0 12px var(--accent-glow);
}

.server-icon:hover {
    border-radius: var(--radius-md);
    background: var(--accent);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 28px var(--accent-glow), 0 4px 16px rgba(0, 0, 0, 0.3);
    transform: scale(1.08);
}

.server-icon:hover::before {
    height: 20px;
}

.server-icon.active {
    border-radius: var(--radius-md);
    background: var(--accent);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 32px var(--accent-glow), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.server-icon.active::before {
    height: 36px;
}

.server-icon.home {
    background: var(--accent);
    color: white;
    border-color: transparent;
}

.server-icon.home:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 28px var(--accent-glow);
    transform: scale(1.08);
}

.server-separator {
    width: 32px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-default), transparent);
    border-radius: 1px;
}

/* ===================== CHANNEL LIST ===================== */
.channel-list {
    width: 240px;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-subtle);
    position: relative;
}

.channel-list::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, rgba(108, 92, 231, 0.08) 0%, transparent 30%, transparent 70%, rgba(108, 92, 231, 0.08) 100%);
}

.server-header {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 600;
    position: relative;
}

.server-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.03) 0%, transparent 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.server-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.server-header:hover::before {
    opacity: 1;
}

.server-name {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
}

.server-dropdown {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.channels-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.channels-container {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.channels-container::-webkit-scrollbar {
    width: 4px;
}

.channels-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}

.channel-category {
    margin-bottom: 16px;
}

.category-header {
    display: flex;
    align-items: center;
    padding: 8px 8px 4px 8px;
    cursor: pointer;
    user-select: none;
}

.category-header svg {
    margin-right: 4px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.category-header span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    transition: color var(--transition-fast);
}

.category-header:hover span {
    color: var(--text-secondary);
}

.category-header:hover svg {
    color: var(--text-secondary);
}

.channel {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    position: relative;
}

.channel::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
    transition: height var(--transition-fast);
}

.channel:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.channel:hover::before {
    height: 16px;
}

.channel.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font-weight: 500;
}

.channel.active::before {
    height: 24px;
    box-shadow: 0 0 8px var(--accent-glow);
}

.channel svg {
    margin-right: 8px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: all var(--transition-fast);
}

.channel.active svg {
    opacity: 1;
    color: var(--accent);
}

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

/* ===================== USER PANEL ===================== */
.user-panel {
    background: linear-gradient(180deg, var(--bg-deep) 0%, #0a0c10 100%);
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-subtle);
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 16px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.user-avatar::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: var(--accent-gradient);
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-fast);
    filter: blur(8px);
}

.user-info:hover .user-avatar::after {
    opacity: 0.4;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 11px;
    color: var(--green);
}

.user-controls {
    display: flex;
    gap: 2px;
    padding: 4px 8px 8px;
    justify-content: center;
}

.control-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border: none;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.control-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.06);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.control-btn:hover {
    color: var(--text-primary);
}

.control-btn:hover::after {
    opacity: 1;
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    position: relative;
}

.main-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: linear-gradient(180deg, rgba(108, 92, 231, 0.02) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

.chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.friends-welcome-view {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    color: var(--text-muted);
}

.friends-welcome-content h2 {
    font-size: 24px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.friends-welcome-content p {
    font-size: 16px;
    line-height: 1.6;
}

/* ===================== CHAT HEADER ===================== */
.chat-header {
    height: 52px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(21, 24, 32, 0.8);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 1;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-default), transparent);
}

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

.channel-info svg {
    color: var(--text-muted);
}

.channel-info span {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-controls {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.icon-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.06);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.icon-btn:hover {
    color: var(--text-primary);
}

.icon-btn:hover::after {
    opacity: 1;
}

/* ===================== MESSAGES ===================== */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
}

.message-group {
    margin-bottom: 4px;
    display: flex;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast);
    animation: fadeIn 0.25s ease;
}

.message-group:hover {
    background: rgba(255, 255, 255, 0.02);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    margin-right: 16px;
    flex-shrink: 0;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-fast);
    overflow: hidden;
}

.message-group:hover .message-avatar {
    transform: scale(1.05);
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    margin-bottom: 4px;
    gap: 8px;
}

.message-author {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-hover);
    transition: color var(--transition-fast);
}

.message-author:hover {
    color: var(--accent);
}

.message-timestamp {
    font-size: 11px;
    color: var(--text-muted);
}

.message-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
    word-wrap: break-word;
}

/* ===================== MESSAGE INPUT ===================== */
.message-input-container {
    padding: 0 16px 24px;
    position: relative;
    z-index: 1;
}

.message-input-wrapper {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-default);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.message-input-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.message-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 24px rgba(108, 92, 231, 0.15);
}

.message-input-wrapper:focus-within::before {
    opacity: 0.03;
}

.attach-btn, .emoji-btn, .giphy-btn-inline {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    transition: all var(--transition-fast);
}

.attach-btn:hover, .emoji-btn:hover, .giphy-btn-inline:hover {
    color: var(--accent);
    transform: scale(1.1);
}

.giphy-btn-inline {
    font-size: 12px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #9933ff 0%, #ff6699 100%);
    color: white !important;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.giphy-btn-inline:hover {
    opacity: 0.85;
    box-shadow: 0 2px 12px rgba(153, 51, 255, 0.3);
}

#messageInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    padding: 14px 0;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

/* ===================== FORMATTING TOOLBAR ===================== */
.formatting-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    margin-bottom: 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 12px;
}

.message-input-container:hover .formatting-toolbar,
.message-input-container:focus-within .formatting-toolbar {
    opacity: 1;
    max-height: 48px;
    padding: 6px 12px;
}

.fmt-btn {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-family: 'Inter', monospace;
    transition: all var(--transition-fast);
}

.fmt-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transform: scale(1.1);
}

.fmt-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.fmt-separator {
    width: 1px;
    height: 20px;
    background: var(--border-default);
    margin: 0 6px;
}

.giphy-btn {
    width: auto;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, #9933ff 0%, #ff6699 100%);
    color: white !important;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
    transition: all var(--transition-fast);
}

.giphy-btn:hover {
    opacity: 0.9;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(153, 51, 255, 0.3);
}

/* ===================== CALL INTERFACE ===================== */
.call-interface {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 960px;
    max-width: 95vw;
    min-width: 400px;
    height: 680px;
    max-height: 90vh;
    background: var(--bg-deep);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 80px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-default);
    transition: all var(--transition-slow);
    animation: callSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    resize: both;
    overflow: hidden;
}

.call-body {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.call-interface.fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    top: 0;
    left: 0;
    transform: none;
}

@keyframes callSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.92);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        filter: blur(0);
    }
}

.call-interface.hidden {
    display: none;
}

.call-header {
    height: 52px;
    background: rgba(15, 17, 23, 0.9);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    cursor: move;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    border-bottom: 1px solid var(--border-subtle);
}

.call-channel-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-call-btn {
    width: 36px;
    height: 36px;
    background: var(--red-glow);
    border: none;
    color: var(--red);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.close-call-btn:hover {
    background: var(--red);
    color: white;
    transform: scale(1.08);
    box-shadow: 0 4px 16px var(--red-glow);
}

.call-participants {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    padding: 16px;
    padding-right: 236px;
    gap: 12px;
    overflow-y: auto;
    min-height: 0;
    position: relative;
}

.call-participants.screen-share-active {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 10;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    background: transparent;
    border-radius: var(--radius-lg);
    overflow: visible;
}

.call-participants.screen-share-active .participant {
    width: 100%;
    min-height: unset;
    min-width: unset;
    aspect-ratio: 16/9;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    resize: none;
}

.call-participants.screen-share-active .participant video {
    object-fit: cover;
}

.call-participants.screen-share-active .participant .participant-name {
    font-size: 11px;
    padding: 2px 8px;
}

.call-participants.screen-share-active #remoteParticipants {
    display: none;
}

.call-participants.screen-share-active ~ .voice-participants-panel {
    display: none;
}

.call-screen-share {
    position: absolute;
    inset: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-screen-share.hidden {
    display: none;
}

.call-screen-share video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.screen-share-label {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.screen-share-label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f23f43;
    animation: pulse 1.5s ease infinite;
}

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

.participant {
    position: relative;
    width: 100%;
    min-width: 150px;
    min-height: 100px;
    aspect-ratio: 16/9;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    resize: both;
    transition: all var(--transition-normal);
}

.participant-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: white;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.participant-avatar.video-off {
    display: flex;
}

.participant-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.participant:hover {
    border-color: var(--border-default);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.participant:hover .resize-handle {
    opacity: 1;
}

.resize-handle {
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.participant[data-resizable="true"] {
    cursor: default;
}

.participant.screen-share {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16/9;
}

.participant video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #000;
}

.participant:has(.participant-avatar.video-off) video {
    visibility: hidden;
}

.participant.minimized {
    width: 120px;
    height: 90px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
    cursor: pointer;
}

.participant.maximized {
    width: 90vw !important;
    height: 90vh !important;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
}

.participant-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.participant-controls {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
}

.call-controls-main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(15, 17, 23, 0.9);
    backdrop-filter: blur(12px);
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    border-top: 1px solid var(--border-subtle);
}

.call-control-btn {
    width: 52px;
    height: 52px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.call-control-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: scale(1.1);
    border-color: var(--border-default);
}

.call-control-btn.active {
    background: var(--red-glow);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.3);
}

.call-control-btn.active:hover {
    background: var(--red);
    color: white;
    box-shadow: 0 4px 20px var(--red-glow);
}

.call-control-btn svg {
    width: 24px;
    height: 24px;
}

.call-control-btn.screen-active {
    background: var(--green-glow);
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.3);
}

.call-control-btn.screen-active:hover {
    background: var(--green);
    color: white;
    box-shadow: 0 4px 20px var(--green-glow);
}

/* Video Size Controls */
.video-size-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.participant:hover .video-size-controls {
    opacity: 1;
}

.size-control-btn {
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.size-control-btn:hover {
    background: var(--accent);
    color: white;
    border-color: transparent;
    transform: scale(1.1);
}

.participant::after {
    content: 'Double-click to fullscreen';
    position: absolute;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.participant:hover::after {
    opacity: 1;
}

#remoteParticipants {
    display: contents;
}

/* ===================== VOICE PARTICIPANTS PANEL ===================== */
.call-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.voice-participant-count {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
}

.voice-participants-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 220px;
    height: 100%;
    background: rgba(15, 17, 23, 0.95);
    backdrop-filter: blur(12px);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.voice-participants-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.voice-participants-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.voice-participant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    cursor: default;
}

.voice-participant-item:hover {
    background: var(--bg-hover);
}

.voice-participant-item.you {
    opacity: 0.7;
}

.voice-participant-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    overflow: hidden;
}

.voice-participant-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.voice-participant-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.voice-participant-tag {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

/* ===================== INCOMING CALL ===================== */
.incoming-call {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 90vw;
    background: var(--bg-deep);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-xl), 0 0 80px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    border: 1px solid var(--border-default);
    animation: incomingCallPulse 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(16px);
}

@keyframes incomingCallPulse {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.85);
        filter: blur(8px);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.02);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        filter: blur(0);
    }
}

.incoming-call.hidden {
    display: none;
}

.incoming-call-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.caller-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.caller-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 0 40px var(--accent-glow);
    animation: callerAvatarPulse 2s infinite;
}

@keyframes callerAvatarPulse {
    0%, 100% {
        box-shadow: 0 0 40px var(--accent-glow);
    }
    50% {
        box-shadow: 0 0 60px rgba(108, 92, 231, 0.5), 0 0 80px rgba(108, 92, 231, 0.2);
    }
}

.caller-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.incoming-call-content p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.incoming-call-actions {
    display: flex;
    gap: 12px;
}

.call-action-btn {
    padding: 12px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-width: 120px;
}

.call-action-btn.accept {
    background: var(--green);
    color: white;
}

.call-action-btn.accept:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px var(--green-glow);
}

.call-action-btn.reject {
    background: var(--red);
    color: white;
}

.call-action-btn.reject:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px var(--red-glow);
}

.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    backdrop-filter: blur(4px);
}

.call-overlay.hidden {
    display: none;
}

/* ===================== VOICE CHANNEL ===================== */
.voice-channel.in-call {
    background: var(--green-glow);
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.voice-channel.in-call:hover {
    background: rgba(34, 197, 94, 0.25);
}

/* ===================== FRIENDS INTERFACE ===================== */
.dm-list-view {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.dm-search-bar {
    padding: 10px 8px;
}

.dm-search-bar input {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dm-search-bar input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-elevated);
}

.dm-search-bar input::placeholder {
    color: var(--text-muted);
}

.dm-list .channel {
    padding-left: 20px;
}

.friends-main-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.friends-header {
    height: 52px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: rgba(21, 24, 32, 0.8);
    backdrop-filter: blur(12px);
}

.friends-tabs {
    display: flex;
    gap: 4px;
}

.friends-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.friends-tab:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.friends-tab.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    font-weight: 600;
}

.friends-tab.active::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 1px;
}

.friends-content-wrapper {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.friends-list {
    display: none;
    padding: 16px;
}

.friends-list.active-tab {
    display: block;
}

.friends-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

.friend-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    background: var(--bg-elevated);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}

.friend-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.friend-item:hover {
    border-color: var(--border-default);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.friend-item:hover::before {
    opacity: 0.02;
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    margin-right: 12px;
    flex-shrink: 0;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.friend-info {
    flex: 1;
}

.friend-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.friend-status {
    font-size: 12px;
    color: var(--green);
}

.friend-status.offline {
    color: var(--text-muted);
}

.friend-actions {
    display: flex;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.friend-action-btn {
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 16px;
}

.friend-action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: var(--border-default);
    transform: scale(1.08);
}

.friend-action-btn.accept {
    background: var(--green-glow);
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.2);
}

.friend-action-btn.accept:hover {
    background: var(--green);
    color: white;
    box-shadow: 0 4px 16px var(--green-glow);
}

.friend-action-btn.reject {
    background: var(--red-glow);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.2);
}

.friend-action-btn.reject:hover {
    background: var(--red);
    color: white;
    box-shadow: 0 4px 16px var(--red-glow);
}

/* Add Friend Form */
.add-friend-form {
    padding: 24px;
}

.add-friend-form h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 700;
}

.add-friend-form p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.add-friend-input-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.add-friend-input-wrapper input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 12px 16px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.add-friend-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-elevated);
}

.add-friend-input-wrapper input::placeholder {
    color: var(--text-muted);
}

.add-friend-input-wrapper button {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}

.add-friend-input-wrapper button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--accent-glow);
}

#searchResults {
    margin-top: 16px;
}

.user-search-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

.user-search-item:hover {
    border-color: var(--border-default);
}

.user-search-item .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    margin-right: 12px;
    font-size: 15px;
}

.user-search-item .user-info {
    flex: 1;
}

.user-search-item .user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-search-item .add-friend-btn {
    background: var(--green);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.user-search-item .add-friend-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--green-glow);
}

.user-search-item .add-friend-btn:disabled {
    background: var(--bg-active);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===================== FILE ATTACHMENTS ===================== */
.file-attachment {
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-top: 8px;
    gap: 12px;
    transition: all var(--transition-fast);
}

.file-attachment:hover {
    border-color: var(--border-default);
    background: var(--bg-hover);
}

.file-icon {
    font-size: 24px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.file-size {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.file-download {
    background: var(--accent-gradient);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.file-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* ===================== MESSAGE REACTIONS ===================== */
.message-reactions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.reaction {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reaction:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    transform: scale(1.08);
}

.reaction span {
    font-size: 12px;
    color: var(--text-secondary);
}

.add-reaction-btn {
    background: none;
    border: 1px dashed var(--border-default);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    margin-top: 6px;
    color: var(--text-muted);
}

.add-reaction-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--text-muted);
    color: var(--text-secondary);
    transform: scale(1.08);
}

/* ===================== EMOJI PICKER ===================== */
.emoji-picker {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(16px);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 300px;
    z-index: 1000;
    animation: slideInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.emoji-option {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.emoji-option:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.2);
}

/* ===================== SPEAKING INDICATOR ===================== */
.participant.speaking {
    border: 2px solid var(--green);
    box-shadow: 0 0 24px var(--green-glow), 0 0 48px rgba(34, 197, 94, 0.1);
}

.participant.speaking .participant-name {
    background: rgba(34, 197, 94, 0.9);
}

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ===================== GIPHY PICKER ===================== */
.giphy-picker {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 400px;
    max-height: 450px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(16px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.giphy-picker.hidden {
    display: none;
}

.giphy-header {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.giphy-header input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.giphy-header input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.giphy-header input::placeholder {
    color: var(--text-muted);
}

.giphy-close-btn {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all var(--transition-fast);
}

.giphy-close-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.giphy-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 8px;
}

.giphy-grid::-webkit-scrollbar {
    width: 4px;
}

.giphy-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
}

.giphy-item {
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    aspect-ratio: 1;
}

.giphy-item:hover {
    transform: scale(1.04);
    z-index: 1;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.giphy-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.giphy-loading {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===================== MODAL OVERLAY ===================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    width: 440px;
    max-width: 90vw;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl), 0 0 60px rgba(0, 0, 0, 0.3);
    animation: callSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-wide {
    width: 560px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 18px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.modal-body p {
    margin-bottom: 16px;
}

.modal-body .qr-container {
    text-align: center;
    margin: 16px 0;
}

.modal-body .qr-container img {
    border-radius: var(--radius-md);
    border: 2px solid var(--border-default);
}

.modal-body .code-input {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.modal-body .code-input input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'Inter', monospace;
    text-align: center;
    letter-spacing: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-body .code-input input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===================== ROLES ===================== */
.role-settings-panel {
    display: flex;
    width: 800px;
    max-width: 95vw;
    height: 560px;
    max-height: 85vh;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-surface);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px var(--border-subtle);
    animation: settingsFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.role-settings-left {
    width: 220px;
    min-width: 220px;
    background: var(--bg-deep);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border-subtle);
    overflow: hidden;
}

.role-settings-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
    gap: 12px;
}

.role-settings-back {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.role-settings-back:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.role-settings-title {
    flex: 1;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.role-settings-add {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}
.role-settings-add:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.role-settings-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.role-settings-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all var(--transition-fast);
}
.role-settings-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.role-settings-item.active { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.role-settings-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.role-settings-right {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.role-editor-content {
    max-width: 660px;
}

.role-editor-section {
    margin-bottom: 24px;
}

.role-editor-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}

.role-editor-input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    background: var(--bg-deep);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-editor-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

.role-editor-color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.role-editor-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.role-editor-color-swatch:hover { border-color: var(--text-secondary); transform: scale(1.15); }
.role-editor-color-swatch.active { border-color: #fff; transform: scale(1.15); box-shadow: 0 0 12px rgba(255,255,255,0.2); }

.role-editor-perms {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.role-editor-perm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-deep);
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

.role-editor-perm-row:hover {
    border-color: var(--border-default);
}

.role-editor-perm-info {
    display: flex;
    flex-direction: column;
}

.role-editor-perm-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.role-editor-perm-desc {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.role-editor-toggle {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    border: none;
    flex-shrink: 0;
}
.role-editor-toggle.on { background: var(--green); }
.role-editor-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.role-editor-toggle.on::after { transform: translateX(18px); }

.role-editor-actions {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.role-editor-btn {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.role-editor-btn.save {
    background: var(--accent);
    color: #fff;
}
.role-editor-btn.save:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }

.role-editor-btn.delete {
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
}
.role-editor-btn.delete:hover { background: var(--red-glow); }

.role-editor-btn.cancel {
    background: transparent;
    color: var(--text-secondary);
}
.role-editor-btn.cancel:hover { background: rgba(255,255,255,0.04); }

.role-editor-assign-section {
    margin-top: 20px;
}

.role-editor-member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-deep);
    border-radius: 6px;
    margin-bottom: 4px;
    border: 1px solid var(--border-subtle);
}

.role-editor-member-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-size: 14px;
}

.role-editor-member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
}

.role-editor-member-remove {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}
.role-editor-member-remove:hover { background: var(--red-glow); }

.role-editor-add-member {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.role-editor-add-member select {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-default);
    background: var(--bg-deep);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.role-editor-add-member button {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    background: var(--green);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.role-editor-add-member button:hover { background: #1a8045; box-shadow: 0 4px 12px var(--green-glow); }

.perm-tag {
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-glow);
    color: var(--accent);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.perm-tag.active {
    background: var(--accent);
    color: white;
}

.perm-tag:hover {
    border-color: var(--accent);
}

/* ===================== VOICE ROOMS PANEL ===================== */
.voice-rooms-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 380px;
    max-width: 90vw;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(16px);
    z-index: 2500;
    display: flex;
    flex-direction: column;
    max-height: 500px;
    animation: callSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.voice-rooms-panel.hidden {
    display: none;
}

.voice-rooms-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.voice-rooms-header span {
    font-weight: 600;
    color: var(--text-primary);
}

.voice-rooms-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.voice-room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.voice-room-item:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-1px);
}

.voice-room-item.in-room {
    border-color: var(--green);
    background: var(--green-glow);
}

.voice-room-info {
    flex: 1;
}

.voice-room-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.voice-room-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.voice-room-participants {
    display: flex;
}

.voice-room-participants .mini-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -6px;
    border: 2px solid var(--bg-surface);
    overflow: hidden;
}

.voice-room-participants .mini-avatar:first-child {
    margin-left: 0;
}

/* ===================== SERVER SETTINGS DROPDOWN ===================== */
.server-settings-dropdown {
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    z-index: 500;
    padding: 6px;
    animation: slideInUp 0.15s ease;
}

.server-settings-dropdown.hidden {
    display: none;
}

.settings-dropdown-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.settings-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

.settings-dropdown-item.danger {
    color: var(--red);
}

.settings-dropdown-item.danger:hover {
    background: var(--red-glow);
}

.settings-dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 8px;
}

/* ===================== SERVER SETTINGS MODAL ===================== */
.server-settings-dialog {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 920px;
    max-width: 95vw;
    height: 620px;
    max-height: 85vh;
    display: flex;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    animation: settingsFadeIn 0.25s ease;
    overflow: hidden;
}

.server-settings-sidebar {
    width: 220px;
    background: var(--bg-elevated);
    padding: 20px 12px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.server-settings-sidebar-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 10px 12px;
    letter-spacing: 0.02em;
}

.server-settings-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.server-settings-nav-item {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.server-settings-nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.server-settings-nav-item.active {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.server-settings-nav-item.danger {
    color: #f23f43;
}

.server-settings-nav-item.danger:hover {
    background: rgba(242,63,67,0.1);
}

.server-settings-nav-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 8px 10px;
}

.server-settings-content {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    position: relative;
}

.server-settings-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.server-settings-close:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
}

.server-settings-section {
    display: none;
}

.server-settings-section.active {
    display: block;
}

.server-settings-section h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.server-settings-icon-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.server-settings-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
    overflow: hidden;
    margin-bottom: 10px;
}

.server-settings-icon-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.server-invites-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.server-invite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.server-invite-code {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    color: var(--text-primary);
    user-select: all;
}

.server-invite-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.server-invite-actions {
    display: flex;
    gap: 6px;
}

.server-invite-copy,
.server-invite-delete {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.server-invite-copy {
    background: var(--accent-primary);
    color: white;
}

.server-invite-copy:hover {
    background: var(--accent-hover);
}

.server-invite-delete {
    background: transparent;
    color: #f23f43;
    border: 1px solid rgba(242,63,67,0.3);
}

.server-invite-delete:hover {
    background: rgba(242,63,67,0.1);
}

.voice-rooms-actions {
    padding: 12px;
    border-top: 1px solid var(--border-subtle);
}

.voice-rooms-actions .submit-btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
}

/* ===================== ENCRYPTION INDICATOR ===================== */
.encrypted-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--green-glow);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    color: var(--green);
}

.encrypted-indicator svg {
    width: 14px;
    height: 14px;
}

/* ===================== MARKDOWN RENDERED MESSAGES ===================== */
.message-text strong,
.message-text b {
    font-weight: 700;
    color: var(--text-primary);
}

.message-text em,
.message-text i {
    font-style: italic;
}

.message-text code {
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 13px;
    color: #e06c75;
}

.message-text pre {
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin: 8px 0;
    overflow-x: auto;
    position: relative;
}

.message-text pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.message-text pre .code-lang {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.message-text blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.message-text a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.message-text a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.message-text .spoiler {
    background: var(--bg-active);
    color: transparent;
    border-radius: 3px;
    padding: 0 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.message-text .spoiler.revealed {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.message-text s,
.message-text del {
    text-decoration: line-through;
    color: var(--text-muted);
}

.message-text u {
    text-decoration: underline;
}

.message-text .mention {
    background: var(--accent-glow);
    color: var(--accent);
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.message-text .mention:hover {
    background: var(--accent);
    color: white;
}

.message-text .channel-link {
    background: var(--accent-glow);
    color: var(--accent);
    padding: 0 4px;
    border-radius: 3px;
    font-weight: 500;
}

.message-text .giphy-image {
    max-width: 300px;
    max-height: 250px;
    border-radius: var(--radius-md);
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.message-text .giphy-image:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===================== CATEGORY CONTEXT MENU ===================== */
.category-header {
    position: relative;
}

.category-actions {
    display: none;
    gap: 4px;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.category-header:hover .category-actions {
    display: flex;
}

.category-action-btn {
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.category-action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

/* ===================== VOICE ROOM PARTICIPANTS LIST ===================== */
.voice-room-expanded {
    padding-left: 32px;
}

.voice-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}

.voice-user-item .mini-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Members Panel (right sidebar) */
.chat-and-members {
    display: flex;
    flex: 1;
    min-width: 0;
}
.chat-and-members > .chat-view {
    flex: 1;
    min-width: 0;
}

.members-panel {
    width: 240px;
    min-width: 240px;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    overflow-y: auto;
    padding: 12px 8px;
    flex-shrink: 0;
}
.members-panel::-webkit-scrollbar { width: 4px; }
.members-panel::-webkit-scrollbar-track { background: transparent; }
.members-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 4px; }

.members-category {
    padding: 16px 8px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}
.members-category:first-child { padding-top: 0; }

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.member-item:hover {
    background: rgba(255, 255, 255, 0.04);
}
.member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.member-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    position: absolute;
    bottom: -1px;
    right: -1px;
}
.member-status-dot.online { background: #3ba55d; }
.member-status-dot.idle { background: #faa61a; }
.member-status-dot.dnd { background: #ed4245; }
.member-status-dot.offline { background: var(--text-muted); }

.member-info {
    min-width: 0;
}
.member-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.member-name.has-role { color: var(--text-primary); }
.member-name.offline-member { color: var(--text-muted); opacity: 0.5; }
.member-game {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===================== SUBMIT BTN (shared) ===================== */
.submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--accent-glow);
}

.submit-btn:hover::before {
    left: 100%;
}

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

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ===================== USER SETTINGS MODAL ===================== */
.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    animation: fadeIn 0.25s ease;
}
.settings-modal.hidden { display: none; }

.settings-dialog {
    display: flex;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    width: 920px;
    max-width: 95vw;
    height: 620px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px var(--border-subtle);
    animation: settingsFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes settingsFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

.settings-sidebar {
    width: 210px;
    min-width: 210px;
    background: var(--bg-deep);
    padding: 30px 8px 30px 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid var(--border-subtle);
}
.settings-sidebar-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    padding-left: 10px;
}
.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.settings-nav-item {
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}
.settings-nav-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}
.settings-nav-item.active {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-weight: 600;
}
.settings-nav-item.danger {
    color: var(--red);
}
.settings-nav-item.danger:hover {
    background: var(--red-glow);
    color: var(--red);
}
.settings-nav-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 8px 10px;
}

.settings-content {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    position: relative;
    background: var(--bg-surface);
}
.settings-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-default);
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.settings-close:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.settings-section { display: none; }
.settings-section.active { display: block; animation: fadeIn 0.2s ease; }
.settings-section h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
}
.settings-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.settings-section p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.settings-profile-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px;
    background: var(--bg-deep);
    border-radius: var(--radius-lg);
    margin-bottom: 28px;
    border: 1px solid var(--border-subtle);
}
.settings-avatar-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.settings-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
    overflow: hidden;
}
.avatar-upload-btn {
    font-size: 12px;
    color: #00a8fc;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.15s;
}
.avatar-upload-btn:hover { color: #00c8ff; text-decoration: underline; }

.settings-profile-info { flex: 1; }
.settings-username {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.settings-email {
    font-size: 14px;
    color: var(--text-secondary);
}

.settings-field {
    margin-bottom: 22px;
}
.settings-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 0.06em;
}
.settings-field-row {
    display: flex;
    gap: 10px;
}
.settings-field-row input {
    flex: 1;
    padding: 11px 14px;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-field-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.settings-field input[type="text"],
.settings-field input[type="email"] {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.settings-save-btn {
    padding: 11px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.settings-save-btn:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }
.settings-save-btn:active { transform: scale(0.97); }

.settings-select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23555d6e' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.settings-select option { background: var(--bg-deep); color: var(--text-primary); }

.settings-range {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-deep);
    outline: none;
    margin-top: 4px;
}
.settings-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px var(--accent-glow);
    transition: transform 0.15s;
}
.settings-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}
.settings-toggle-row span { font-size: 14px; color: var(--text-primary); }
.settings-toggle {
    position: relative;
    width: 40px;
    height: 24px;
    display: inline-block;
    cursor: pointer;
}
.settings-toggle input { display: none; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--text-muted);
    border-radius: 12px;
    transition: background 0.2s;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.settings-toggle input:checked + .toggle-slider { background: var(--green); }
.settings-toggle input:checked + .toggle-slider::after { transform: translateX(16px); }

.settings-theme-options {
    display: flex;
    gap: 14px;
}
.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    transition: all 0.2s;
}
.theme-option:hover { border-color: var(--border-default); }
.theme-option.active { border-color: var(--accent); }
.theme-preview {
    width: 84px;
    height: 64px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
}
.dark-preview { background: var(--bg-deep); }
.light-preview { background: #f2f3f5; }
.theme-option span { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

.settings-preview-area {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-deep);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}
.settings-video-preview {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    margin: 12px 0;
}
.settings-video-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.settings-audio-bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
    margin: 8px 0;
}
.audio-bar {
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
    transition: height 0.1s;
}
.settings-test-btn {
    padding: 9px 18px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.settings-test-btn:hover { box-shadow: 0 4px 16px var(--accent-glow); }

.settings-danger-zone {
    margin-top: 32px;
    padding: 20px;
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: var(--radius-lg);
    background: rgba(239,68,68,0.03);
}
.settings-danger-zone h3 { color: var(--red); }
.settings-danger-zone p { color: var(--text-secondary); font-size: 13px; }
.settings-danger-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.settings-danger-btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.settings-danger-btn:hover { border-color: var(--text-secondary); background: rgba(255,255,255,0.03); }
.settings-danger-btn.red {
    background: var(--red);
    border-color: var(--red);
    color: white;
}
.settings-danger-btn.red:hover { background: #d83c3e; box-shadow: 0 4px 16px var(--red-glow); }

/* 2FA Section */
.twofa-enabled-card, .twofa-disabled-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-deep);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}
.twofa-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.twofa-status-dot.on { background: var(--green); box-shadow: 0 0 10px var(--green-glow); animation: pulse 2s infinite; }
.twofa-status-dot.off { background: var(--text-muted); }

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 10px var(--green-glow); }
    50% { box-shadow: 0 0 20px rgba(34, 197, 94, 0.4); }
}

.twofa-qr-card {
    padding: 20px;
    background: var(--bg-deep);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}
.twofa-qr-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.twofa-qr-container img {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-md);
    background: #fff;
    padding: 12px;
}
.twofa-manual-key {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.twofa-secret-code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-elevated);
    padding: 6px 12px;
    border-radius: 6px;
    letter-spacing: 0.1em;
}
.twofa-copy-btn {
    background: none;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.twofa-copy-btn:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.twofa-code-row {
    display: flex;
    gap: 10px;
    max-width: 300px;
}
.twofa-code-input {
    flex: 1;
    padding: 11px 14px;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 18px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.3em;
    text-align: center;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.twofa-code-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.twofa-btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.twofa-btn.setup {
    background: var(--accent);
    color: #fff;
}
.twofa-btn.setup:hover { background: var(--accent-hover); box-shadow: 0 4px 16px var(--accent-glow); }
.twofa-btn.verify {
    background: var(--green);
    color: #fff;
}
.twofa-btn.verify:hover { background: #1a8045; box-shadow: 0 4px 16px var(--green-glow); }
.twofa-btn.disable {
    background: var(--red);
    color: #fff;
}
.twofa-btn.disable:hover { background: #d83c3e; box-shadow: 0 4px 16px var(--red-glow); }

/* Members toggle button active state */
#membersBtn.active {
    color: var(--text-primary);
}

/* Member Profile Popup */
.member-profile-popup {
    position: fixed;
    width: 300px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    overflow: hidden;
    border: 1px solid var(--border-default);
    animation: callSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.member-profile-banner {
    height: 60px;
    width: 100%;
    background: var(--accent-gradient);
}

.member-profile-body {
    padding: 16px;
    padding-top: 0;
}

.member-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-top: -32px;
    border: 4px solid var(--bg-elevated);
    background: var(--accent-gradient);
    overflow: hidden;
}

.member-profile-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 8px;
}

.member-profile-username {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.member-profile-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 12px 0;
}

.member-profile-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.member-profile-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.member-profile-role-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-deep);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.member-profile-role-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.member-profile-role-remove {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    margin-left: 2px;
    transition: color var(--transition-fast);
}
.member-profile-role-remove:hover { color: #ff6b6b; }

.member-profile-assign {
    display: flex;
    gap: 6px;
}

.member-profile-select {
    flex: 1;
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-default);
    background: var(--bg-deep);
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
}

.member-profile-assign-btn {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: none;
    background: var(--green);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.member-profile-assign-btn:hover { background: #1a8045; box-shadow: 0 4px 12px var(--green-glow); }
