@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Rubik", sans-serif;
}

body {
    background: #0f0f13;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Auth Screen */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0f0f13 0%, #1a1a2e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

.auth-box {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 32px 24px;
    border-radius: 24px;
    width: 100%;
    max-width: 340px;
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.auth-box h1 {
    color: #2c92f2;
    font-size: 32px;
    margin-bottom: 8px;
    text-align: center;
}

.auth-box .sub {
    color: #ffffff;
    opacity: 0.7;
    text-align: center;
    margin-bottom: 30px;
    font-size: 14px;
}

.auth-box input {
    width: 100%;
    padding: 12px 16px;
    margin: 8px 0;
    background: #1f1f2e;
    border: 1px solid #2d2d3f;
    color: #ffffff;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
}

.auth-box input:focus {
    border-color: #2c92f2;
}

.auth-box button {
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    background:  linear-gradient(135deg, #2c92f2, #65b2f9);
    border: none;
    color: #ffffff;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    color: #ffffff;
    opacity: 0.7;
    font-size: 14px;
    cursor: pointer;
}

.auth-switch span {
    color: #2c92f2;
}

.error-msg {
    color: #ff7979;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
}

/* App Layout */
.app {
    display: none;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    background: #020f1c;
}

@media (min-width: 768px) {
    .app { display: flex; flex-direction: row; }
    .sidebar { width: 320px; display: flex !important; height: 100vh; }
    .chat-area { display: flex !important; flex: 1; height: 100vh; }
    .back-btn, .settings-back { display: none; }
}

@media (max-width: 767px) {
    .sidebar, .chat-area, .settings-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        transition: transform 0.3s ease;
        z-index: 20;
    }
    .sidebar.hidden, .chat-area.hidden, .settings-panel.hidden {
        transform: translateX(-100%);
    }
    .settings-panel { z-index: 30; background: #020f1c; }
}

/* Sidebar */
.sidebar {
    background: #020f1c;
    border-right: 1px solid #1e1e2a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 18.75px;
    border-bottom: 1px solid #1e1e2a;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #2c92f2;
}

/* Friends Tabs */
.friends-tabs {
    display: flex;
    gap: 8px;
    padding: 16px;
    padding-bottom: 6px;
    padding-top: 6px;
    border-bottom: 1px solid #1e1e2a;
    border-top: 1px solid #1e1e2a;
    background: #020f1c;
    flex-shrink: 0;
}

.friends-tab {
    flex: 1;
    padding: 10px 8px;
    background: #1e1e2a;
    border: none;
    color: #ffffff;
    opacity: 0.7;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.friends-tab.active {
    background: linear-gradient(135deg, #2c92f2, #65b2f9);
    color: #ffffff;
    opacity: 1;
}

.friends-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* Friend Items */
.friend-item, .request-item, .search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin-bottom: 8px;
    background: #1a1a2e;
    border-radius: 16px;
    cursor: pointer;
}

.friend-item {
    position: relative;
    transition: all 0.2s;
}

.friend-item.has-notification {
    background: #2c92f220;
    border-left: 3px solid #2c92f2;
    animation: pulse-bg 1.5s infinite;
}

@keyframes pulse-bg {
    0% { background: #2c92f210; }
    50% { background: #2c92f230; }
    100% { background: #2c92f210; }
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    background:  linear-gradient(135deg, #2c92f2, #65b2f9);;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.notification-badge {
    background: linear-gradient(135deg, #2c92f2, #65b2f9);;
    color: #ffffff;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 10px;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.friend-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.friend-avatar {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 25%;
    background: linear-gradient(135deg, #2c92f2, #c992ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #ffffff;
    font-size: 18px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #16161D;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 2px #10b981;
}

.status-indicator.offline {
    background: #6b7280;
}

.friend-details {
    flex: 1;
}

.friend-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.friend-name {
    color: #ffffff;
    font-weight: 500;
    font-size: 14px;
}

.role-badge-mini {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 20px;
    background: rgba(167, 139, 250, 0.3);
    color: #d4a9ff;
    font-weight: 500;
}

.role-badge-mini.creator {
    background: rgba(176, 91, 255, 0.3);
    color: #e9d5ff;
}

.role-badge-mini.admin {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.friend-username {
    color: #ffffff;
    opacity: 0.6;
    font-size: 11px;
    margin-top: 2px;
}

/* Скрываем старый статус */
.status {
    display: none !important;
}

/* Скрываем старые три точки */
.menu-dots {
    display: none !important;
}

/* Кнопки действий */
.friend-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.icon-btn {
    background: #2d2d3f;
    border: none;
    color: #ffffff;
    opacity: 0.7;
    border-radius: 25%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.icon-btn:hover {
    background: linear-gradient(135deg, #2c92f2, #65b2f9);;
    color: #ffffff;
    opacity: 1;
}

/* Friends Header */
.friends-header {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.primary-btn {
    flex: 1;
    background: linear-gradient(135deg, #2c92f2, #50a3f0);
    border: none;
    padding: 12px;
    border-radius: 40px;
    color: #ffffff;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

.icon-btn-large {
    background: #1e1e2a;
    border: none;
    color: #ffffff;
    opacity: 0.9;
    border-radius: 40px;
    padding: 0 16px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.icon-btn-large .badge {
    background: #ef4444;
    color: #ffffff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.section-title {
    color: #ffffff;
    opacity: 0.6;
    font-size: 12px;
    margin: 16px 0 8px 0;
    letter-spacing: 0.5px;
}

/* Search Panel */
.search-panel {
    padding: 8px;
}

.search-panel input {
    width: 100%;
    padding: 12px;
    background: #1e1e2a;
    border: 1px solid #2d2d3f;
    color: #ffffff;
    border-radius: 40px;
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
}

.search-panel input:focus {
    border-color: linear-gradient(135deg, #2c92f2, #65b2f9);;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #16161D;
    border-radius: 16px;
}

.add-friend-btn {
    background: #2c92f2;
    color: #ffffff;
    padding: 8px 16px;
    border: none;
    border-radius: 40px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

/* Request Actions */
.request-actions {
    display: flex;
    gap: 8px;
}

.accept-btn {
    background: #10b981;
    color: #ffffff;
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
}

.reject-btn {
    background: #ef4444;
    color: #ffffff;
    padding: 6px 12px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #ffffff;
    opacity: 0.6;
}

/* User Info - НОВЫЙ ДИЗАЙН */
.user-info {
    padding: 4px;
    background: #1a1a2e;
    margin: 16px;
    margin-top: 6px;
    margin-bottom: 8px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-info:hover {
    background: #22223b;
}

.user-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-large {
    width: 50px;
    height: 50px;
    border-radius: 25%;
    background: linear-gradient(135deg, #2c92f2, #c084fc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.user-info-text {
    flex: 1;
    overflow: hidden;
}

.user-display-name {
    color: #ffffff;
    font-weight: 500;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.user-username {
    color: #ffffff;
    opacity: 0.6;
    font-size: 11px;
    margin-top: 2px;
}

.settings-icon-btn {
    background: #2d2d3f;
    border: none;
    color: #ffffff;
    opacity: 0.7;
    border-radius: 25%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    flex-shrink: 0;
    margin-right: 6px;
}

.settings-icon-btn:hover {
    background: linear-gradient(135deg, #2c92f2, #65b2f9);;
    color: #ffffff;
    opacity: 1;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #020f1c;
    overflow: hidden;
}

.chat-header {
    padding: 11px;
    background: #020f1c;
    border-bottom: 1px solid #1e232a;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.back-btn {
    background: none;
    border: none;
    color: #2c92f2;
    font-size: 20px;
    cursor: pointer;
    padding: 0 8px;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
}

.chat-header-display-name {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
}

.chat-header-username {
    font-size: 11px;
    color: #ffffff;
    opacity: 0.6;
    margin-top: 2px;
}

/* Messages */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    max-width: 85%;
    padding: 4px 8px;
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 12px;
    word-wrap: break-word;
    position: relative;
}

@media (min-width: 768px) {
    .message { max-width: 65%; }
}

.message-mine {
    background: linear-gradient(135deg, #2e82d0, #af6cf3);;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-other {
    background: #1e1e2a;
    color: #ffffff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-display-name {
    font-size: 12px;
    color: #2c92f2;
    margin-bottom: 4px;
    margin-left: 4px;
    margin-right: 4px;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    margin-left: 4px;
    margin-right: 4px;
}

.message-media {
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.message-media img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    display: block;
}

.message-media img:hover {
    transform: scale(1.02);
}

.message-media video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
}

.message-file {
    margin-top: 6px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.message-file:hover {
    background: rgba(255, 255, 255, 0.2);
}

.message-read-status {
    font-size: 10px;
    margin-left: 6px;
}

.typing-indicator {
    padding: 6px 16px;
    font-size: 12px;
    color: #ffffff;
    opacity: 0.7;
    font-style: italic;
    min-height: 32px;
}

/* Input Area */
.input-area {
    padding: 12px 16px;
    background: #020f1c;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    border-top: 1px solid #1e1e2a;
}

.file-btn {
    background: #2d2d3f;
    border: none;
    border-radius: 24px;
    padding: 10px 14px;
    color: #ffffff;
    cursor: pointer;
    font-size: 16px;
}

.input-area textarea {
    flex: 1;
    padding: 12px 16px;
    background: #1e1e2a;
    border: 1px solid #2d2d3f;
    color: #ffffff;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    font-family: "Rubik", sans-serif;
    resize: none;
    max-height: 120px;
    min-height: 46px;
    line-height: 1.4;
}

.input-area textarea:focus {
    border-color: linear-gradient(135deg, #2c92f2, #65b2f9);;
}

.input-area button {
    padding: 10px 18px;
    background: #2c92f2;
    border: none;
    color: #ffffff;
    border-radius: 24px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: #020f1c;
    z-index: 50;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.settings-panel.open {
    transform: translateX(0);
}

.settings-header {
    padding: 20.5px;
    border-bottom: 1px solid #1e1e2a;
    display: flex;
    align-items: center;
    gap: 16px;
}

.settings-header button {
    background: none;
    border: none;
    color: #2c92f2;
    font-size: 20px;
    cursor: pointer;
}

.settings-header h2 {
    color: #ffffff;
    font-size: 20px;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section label {
    color: #ffffff;
    opacity: 0.7;
    font-size: 12px;
    display: block;
    margin-bottom: 8px;
}

.settings-section input, .settings-section textarea, .settings-section select {
    width: 100%;
    padding: 12px;
    background: #1e1e2a;
    border: 1px solid #2d2d3f;
    color: #ffffff;
    border-radius: 12px;
    font-size: 14px;
    font-family: "Rubik", sans-serif;
}

.settings-section textarea {
    resize: vertical;
    min-height: 80px;
}

.username-hint {
    font-size: 11px;
    color: #ffffff;
    opacity: 0.6;
    margin-top: 4px;
}

.avatar-upload {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 25%;
    background: linear-gradient(135deg, #2c92f2, #c084fc);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #ffffff;
    background-size: cover;
    background-position: center;
}

.save-btn {
    background: #2c92f2;
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 12px;
    width: 100%;
    font-size: 16px;
    cursor: pointer;
    margin-top: 16px;
}

.danger-btn {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
}

.setting-success {
    color: #10b981;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
}

/* Toggle Switch */
.toggle-setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #1e1e2a;
}

.toggle-setting span {
    color: #ffffff;
    font-size: 14px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2d2d3f;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: linear-gradient(135deg, #2c92f2, #65b2f9);;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e1e2a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 50px;
    border: 1px solid #2c92f2;
    z-index: 1000;
    max-width: 90%;
    text-align: center;
    word-wrap: break-word;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #020f1c;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #2d2d3f;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #1e1e2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #ffffff;
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: #ffffff;
    opacity: 0.6;
    font-size: 24px;
    cursor: pointer;
}

.friend-menu {
    position: fixed;
    background: #354451;
    border-radius: 12px;
    border: 1px solid #1e2934;
    z-index: 1000;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.friend-menu-content {
    display: flex;
    flex-direction: column;
}

.friend-menu-content button {
    padding: 12px 16px;
    background: none;
    border: none;
    color: #ffffff;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.friend-menu-content button:hover {
    background: #2c92f2;
}

.friend-menu-content button.danger {
    color: #ef4444;
}

.user-profile {
    padding: 20px;
    text-align: center;
}

.user-profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 25%;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #62b3ff, #c28ef5);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #ffffff;
}

.user-profile-name {
    color: #ffffff;
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 4px;
}

.user-profile-username {
    color: #ffffff;
    opacity: 0.6;
    font-size: 14px;
    margin-bottom: 12px;
}

.user-profile-bio {
    color: #ffffff;
    opacity: 0.8;
    font-size: 14px;
    margin-bottom: 16px;
}

.user-profile-info {
    text-align: left;
    background: #1a1a2e;
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.user-profile-info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #2d2d3f;
}

.user-profile-info-item:last-child {
    border-bottom: none;
}

.user-profile-info-label {
    color: #ffffff;
    opacity: 0.6;
    font-size: 13px;
}

.user-profile-info-value {
    color: #ffffff;
    font-size: 13px;
}

.role-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.role-creator {
    background: #ae00ff40;
    color: #e9d5ff;
}

.role-admin {
    background: #ff000040;
    color: #fca5a5;
}

.unread-badge {
    background: #ef4444;
    color: #ffffff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: 8px;
}

.muted-badge {
    background: #6b7280;
    color: #ffffff;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 9px;
    margin-left: 8px;
}

/* Media Viewer */
.media-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.media-viewer.active {
    opacity: 1;
    visibility: visible;
}

.media-viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-viewer-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
}

.media-viewer-video {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
}

.media-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2001;
}

.media-viewer-close:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.media-viewer-prev,
.media-viewer-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2001;
}

.media-viewer-prev {
    left: 20px;
}

.media-viewer-next {
    right: 20px;
}

.media-viewer-prev:hover,
.media-viewer-next:hover {
    background: #2c92f2;
    transform: translateY(-50%) scale(1.1);
}

.media-viewer-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    color: #ffffff;
    font-size: 14px;
    z-index: 2001;
}

.media-viewer-download {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2001;
    text-decoration: none;
}

.media-viewer-download:hover {
    background: #10b981;
    transform: scale(1.1);
}

/* Video Player */
.custom-video-player {
    position: relative;
    width: 100%;
    max-width: 600px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.custom-video-player video {
    width: 100%;
    height: auto;
    max-height: 400px;
    display: block;
    cursor: pointer;
}

.video-big-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: #3999f3;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.video-big-play:hover {
    background: rgba(167, 139, 250, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-big-play.hide {
    display: none;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 15px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 3;
}

.custom-video-player:hover .video-controls,
.custom-video-player.active .video-controls {
    opacity: 1;
}

.controls-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn, .speed-btn, .fullscreen-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    transition: color 0.2s;
}

.control-btn:hover, .speed-btn:hover, .fullscreen-btn:hover {
    color: #2c92f2;
}

.progress-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-bar {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    flex-grow: 1;
    cursor: pointer;
}

.progress-buffer {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    width: 0%;
}

.progress-filled {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #2c92f2;
    border-radius: 3px;
    width: 0%;
}

.progress-filled::after {
    content: '';
    position: absolute;
    right: -5px;
    top: -4px;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.time-display {
    color: #ffffff;
    font-size: 12px;
    font-family: monospace;
    min-width: 80px;
    text-align: right;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 5px;
}

.volume-slider-container {
    width: 60px;
}

.volume-slider {
    width: 100%;
    cursor: pointer;
    accent-color: #2c92f2;
}

.speed-control {
    position: relative;
}

.speed-menu {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    border-radius: 8px;
    padding: 5px;
    display: none;
    flex-direction: column;
    margin-bottom: 10px;
}

.speed-control:hover .speed-menu {
    display: flex;
}

.speed-menu button {
    background: none;
    border: none;
    color: #ffffff;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
}

.speed-menu button:hover {
    background: rgba(167, 139, 250, 0.5);
    border-radius: 4px;
}

.video-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.video-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #2c92f2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================ */
/* МЕНЮ СООБЩЕНИЙ (ПРАВЫЙ КЛИК / ДОЛГОЕ НАЖАТИЕ) */
/* ============================================ */

.message-menu {
    position: fixed;
    background: #1e1e2a;
    border-radius: 16px;
    padding: 8px;
    min-width: 220px;
    z-index: 100000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border: 1px solid #2d2d3f;
    backdrop-filter: blur(10px);
    animation: menuFadeIn 0.15s ease;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.message-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    text-align: left;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.message-menu button i {
    width: 20px;
    font-size: 15px;
    color: #a0a0b0;
    transition: color 0.2s;
}

.message-menu button:hover {
    background: #2d2d3f;
}

.message-menu button:hover i {
    color: #ffffff;
}

.message-menu button.danger {
    color: #ff6b6b;
}

.message-menu button.danger i {
    color: #ff6b6b;
}

.message-menu button.danger:hover {
    background: rgba(255, 107, 107, 0.15);
}

/* Разделитель в меню */
.message-menu hr {
    margin: 6px 0;
    border: none;
    height: 1px;
    background: #2d2d3f;
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
    .message-menu {
        min-width: 200px;
        padding: 6px;
        border-radius: 14px;
    }
    
    .message-menu button {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .message-menu button i {
        width: 18px;
        font-size: 14px;
    }
}

/* Эффект при нажатии на сообщение (визуальная обратная связь) */
.message {
    transition: transform 0.1s ease, background 0.2s ease;
    cursor: pointer;
}

.message:active {
    transform: scale(0.99);
}

/* Индикатор ответа на сообщение */
.reply-indicator {
    background: rgba(44, 146, 242, 0.12);
    border-left: 3px solid #2c92f2;
    padding: 8px 12px;
    margin: 4px 16px 8px 16px;
    border-radius: 12px;
    font-size: 12px;
    color: #2c92f2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.reply-indicator .cancel-reply {
    cursor: pointer;
    color: #ff6b6b;
    font-size: 16px;
    font-weight: bold;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.reply-indicator .cancel-reply:hover {
    background: rgba(255, 107, 107, 0.15);
}

/* Отредактированное сообщение */
.edited-badge {
    font-size: 10px;
    color: #a0a0b0;
    margin-left: 6px;
    font-style: italic;
}

/* Пересланное сообщение */
.forwarded-badge {
    font-size: 11px;
    color: #2c92f2;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.forwarded-badge i {
    font-size: 10px;
}

/* Закреплённое сообщение */
.pinned-messages {
    background: rgba(44, 146, 242, 0.08);
    border-bottom: 1px solid #2d2d3f;
    padding: 8px 12px;
    margin-bottom: 4px;
}

.pinned-message {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #a0a0b0;
    padding: 6px 0;
}

.pinned-message strong {
    color: #2c92f2;
}

.pinned-message .unpin {
    cursor: pointer;
    color: #ff6b6b;
    font-size: 14px;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.pinned-message .unpin:hover {
    background: rgba(255, 107, 107, 0.15);
}

/* Выделение выбранного сообщения */
.message.selected {
    background: rgba(44, 146, 242, 0.2);
    border: 1px solid #2c92f2;
}

/* Анимация пульсации для нового сообщения */
@keyframes messagePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); background: rgba(44, 146, 242, 0.1); }
    100% { transform: scale(1); }
}

.message-new {
    animation: messagePulse 0.5s ease;
}

/* Стили для встроенного видео плеера в сообщениях */
.message-media video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
}

.message-media img:hover {
    transform: scale(1.02);
}

/* Стили для файлов */
.message-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
}

.message-file:hover {
    background: rgba(255, 255, 255, 0.15);
}

.message-file i {
    font-size: 16px;
}

/* Время сообщения */
.message-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
    margin-right: 2px;
}

/* Статус прочтения */
.message-read-status {
    font-size: 10px;
    margin-left: 4px;
}

.message-read-status i {
    font-size: 10px;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .reply-indicator {
        margin: 4px 12px 8px 12px;
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .pinned-messages {
        padding: 6px 10px;
    }
    
    .pinned-message {
        font-size: 11px;
    }
    
    .forwarded-badge {
        font-size: 10px;
    }
    
    .edited-badge {
        font-size: 9px;
    }
}

/* Закреплённые чаты */
.pinned-chat {
    background: rgba(44, 146, 242, 0.08);
    border-left: 3px solid #2c92f2;
}

.pinned-badge {
    color: #2c92f2;
    font-size: 11px;
    margin-left: 6px;
}

.pinned-badge i {
    font-size: 10px;
}

/* Анимация для новых сообщений */
@keyframes newMessageHighlight {
    0% { background: rgba(44, 146, 242, 0.3); }
    100% { background: transparent; }
}

.message-new {
    animation: newMessageHighlight 1s ease;
}

/* Оптимизация для длинных списков */
.messages {
    contain: content;
    content-visibility: auto;
}

/* Улучшенная кнопка закрепления */
.pin-chat-btn {
    transition: transform 0.2s;
}

.pin-chat-btn:hover {
    transform: rotate(45deg);
}

.pin-chat-btn .fa-thumbtack {
    transition: transform 0.2s;
}

/* Закреплённые сообщения */
.pinned-messages-container {
    background: rgba(44, 146, 242, 0.08);
    border-bottom: 1px solid #2d2d3f;
    padding: 8px 12px;
    max-height: 150px;
    overflow-y: auto;
}

.pinned-header {
    font-size: 11px;
    color: #2c92f2;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pinned-message-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    margin: 4px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
}

.pinned-message-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pinned-message-content {
    flex: 1;
    color: #a0a0b0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unpin-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
}

.unpin-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

.highlight-message {
    animation: highlightFlash 1s ease;
    background: rgba(44, 146, 242, 0.3) !important;
}

@keyframes highlightFlash {
    0% { background: rgba(44, 146, 242, 0); }
    50% { background: rgba(44, 146, 242, 0.4); }
    100% { background: rgba(44, 146, 242, 0); }
}

/* Окно пересылки */
.forward-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin: 4px 0;
    background: #1e1e2a;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.forward-user-item:hover {
    background: #2d2d3f;
}

.forward-user-info {
    flex: 1;
}

.forward-user-name {
    color: white;
    font-weight: 500;
    font-size: 14px;
}

.forward-user-username {
    color: #6b7280;
    font-size: 11px;
}

/* Плавная загрузка аватаров */
.friend-avatar {
    transition: background-image 0.2s ease;
    background-size: cover !important;
    background-position: center !important;
}

/* Скелетон для загрузки */
.friend-avatar:empty {
    background: linear-gradient(90deg, #2d2d3f 25%, #3d3d4f 50%, #2d2d3f 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Индикатор ответа */
.reply-indicator {
    background: rgba(44, 146, 242, 0.15);
    border-left: 3px solid #2c92f2;
    padding: 10px 12px;
    margin: 4px 16px 8px 16px;
    border-radius: 12px;
    font-size: 13px;
    color: #2c92f2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.reply-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.reply-text {
    color: #a0a0b0;
    font-style: italic;
}

.cancel-reply {
    cursor: pointer;
    color: #ff6b6b;
    font-size: 18px;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.cancel-reply:hover {
    background: rgba(255, 107, 107, 0.15);
}

/* Индикатор редактирования */
.edit-indicator {
    background: rgba(16, 185, 129, 0.15);
    border-left: 3px solid #10b981;
    padding: 10px 12px;
    margin: 4px 16px 8px 16px;
    border-radius: 12px;
    font-size: 13px;
    color: #10b981;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.cancel-edit {
    cursor: pointer;
    color: #ff6b6b;
    font-size: 18px;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.cancel-edit:hover {
    background: rgba(255, 107, 107, 0.15);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track { background: #020f1c; }
::-webkit-scrollbar-thumb { background: #1a232b; border-radius: 4px; }

/* Mobile Top Margin Control */
body.mobile-top-margin .sidebar,
body.mobile-top-margin .chat-area,
body.mobile-top-margin .settings-panel {
    padding-top: 55px;
}

body.mobile-top-margin .sidebar .sidebar-header,
body.mobile-top-margin .chat-header,
body.mobile-top-margin .settings-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #020f1c;
}

body.mobile-top-margin .friends-tabs {
    margin-top: 55px;
}

body.mobile-top-margin .friends-content {
    margin-top: 0;
}

/* Desktop styles */
@media (min-width: 768px) {
    body.mobile-top-margin .sidebar,
    body.mobile-top-margin .chat-area,
    body.mobile-top-margin .settings-panel {
        padding-top: 0;
    }
    
    body.mobile-top-margin .sidebar .sidebar-header,
    body.mobile-top-margin .chat-header,
    body.mobile-top-margin .settings-header {
        position: relative;
    }
    
    body.mobile-top-margin .friends-tabs {
        margin-top: 0;
    }
}


/* Закреплённые сообщения - стиль как в Telegram */
.pinned-messages-container {
    background: rgba(44, 146, 242, 0.08);
    border-bottom: 1px solid rgba(44, 146, 242, 0.2);
    padding: 8px 12px;
    max-height: 80px;
    overflow-y: auto;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.pinned-messages-container:hover {
    background: rgba(44, 146, 242, 0.12);
}

.pinned-header {
    font-size: 11px;
    color: #2c92f2;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.pinned-message-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
    color: #a0a0b0;
    cursor: pointer;
    transition: color 0.2s;
}

.pinned-message-item:hover {
    color: #ffffff;
}

.pinned-message-content {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unpin-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pinned-message-item:hover .unpin-btn {
    opacity: 1;
}

.unpin-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* Анимация прокрутки к сообщению */
@keyframes highlightFlash {
    0% { background: rgba(44, 146, 242, 0); }
    30% { background: rgba(44, 146, 242, 0.4); }
    100% { background: rgba(44, 146, 242, 0); }
}

.highlight-message {
    animation: highlightFlash 1.5s ease;
    border-radius: 12px;
}


/* Мобильная адаптация */
@media (max-width: 768px) {
    .pinned-messages-container {
        padding: 6px 10px;
        max-height: 70px;
    }
    
    .pinned-header {
        font-size: 10px;
    }
    
    .pinned-message-content {
        font-size: 11px;
    }
    
    .pinned-message-full {
        padding: 10px !important;
    }
    
    .pinned-message-full strong {
        font-size: 12px;
    }
    
    .pinned-message-full div {
        font-size: 12px;
    }
}

/* Стили для ответов */
.reply-preview {
    background: rgba(255, 255, 255, 0.06);
    border-left: 2px solid #2c92f2;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.reply-preview:hover {
    background: rgba(255, 255, 255, 0.1);
}

.reply-preview div:first-child {
    color: #b2daff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
}

.reply-preview div:last-child {
    color: #7b7b85;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Для своих сообщений */
.message-mine .reply-preview {
    background: rgba(44, 146, 242, 0.15);
    border-left-color: #ffffff;
}

.message-mine .reply-preview div:first-child {
    color: #ffffff;
}

.message-mine .reply-preview div:last-child {
    color: rgba(255, 255, 255, 0.7);
}


/* Закреплённые сообщения - стиль как в Telegram */
.pinned-messages-container {
    background: rgba(44, 146, 242, 0.08);
    border-bottom: 1px solid rgba(44, 146, 242, 0.2);
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.pinned-messages-container:hover {
    background: rgba(44, 146, 242, 0.12);
}

.pinned-header {
    font-size: 11px;
    color: #2c92f2;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    cursor: pointer;
}

.pinned-header:hover {
    text-decoration: underline;
}

.pinned-message-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 12px;
    color: #a0a0b0;
    cursor: pointer;
    transition: color 0.2s;
}

.pinned-message-item:hover {
    color: #ffffff;
}

.pinned-message-content {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pinned-message-content strong {
    color: #2c92f2;
    font-weight: 500;
}

.unpin-btn {
    background: none;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s;
}

.pinned-message-item:hover .unpin-btn {
    opacity: 1;
}

.unpin-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

/* Анимация прокрутки к сообщению */
@keyframes highlightFlash {
    0% { background: rgba(44, 146, 242, 0); }
    30% { background: rgba(44, 146, 242, 0.4); }
    100% { background: rgba(44, 146, 242, 0); }
}

.highlight-message {
    animation: highlightFlash 1.5s ease;
    border-radius: 12px;
}

/* Модальное окно со списком закреплённых сообщений */
.pinned-message-full {
    transition: background 0.2s;
}

.pinned-message-full .unpin-btn {
    opacity: 1;
}


/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #020f1c;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    border: 1px solid #2d2d3f;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #1e1e2a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #ffffff;
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    color: #ffffff;
    opacity: 0.6;
    font-size: 24px;
    cursor: pointer;
}

.modal-close:hover {
    opacity: 1;
}


/* Sidebar Resize для ПК */
@media (min-width: 768px) {
    .sidebar {
        position: relative;
        width: 320px;
        transition: width 0.3s ease;
        overflow-x: hidden;
    }
    
    .sidebar.collapsed {
        width: 70px;
    }
    
    .sidebar.collapsed .sidebar-header .logo,
    .sidebar.collapsed .friend-name,
    .sidebar.collapsed .friend-username,
    .sidebar.collapsed .friend-name-row .role-badge-mini,
    .sidebar.collapsed .friend-details,
    .sidebar.collapsed .user-info-text,
    .sidebar.collapsed .friends-tab span,
    .sidebar.collapsed .friend-actions {
        display: none;
    }
    
    .sidebar.collapsed .friend-avatar {
        margin: 0 auto;
    }
    
    .sidebar.collapsed .friend-item {
        justify-content: center;
        padding: 12px 0;
    }
    
    .sidebar.collapsed .friend-info {
        justify-content: center;
    }
    
    .sidebar.collapsed .user-info {
        justify-content: center;
    }
    
    .sidebar.collapsed .user-info-row {
        justify-content: center;
    }
    
    .sidebar.collapsed .friends-tab {
        justify-content: center;
        padding: 10px 0;
    }
    
    .sidebar.collapsed .friends-tab i {
        margin: 0;
    }
    
    .sidebar-resize-handle {
        position: absolute;
        right: -4px;
        top: 0;
        width: 8px;
        height: 100%;
        cursor: ew-resize;
        background: transparent;
        z-index: 100;
        transition: background 0.2s;
    }
    
    .sidebar-resize-handle:hover {
        background: rgba(44, 146, 242, 0.3);
    }
    
    .sidebar.collapsed .sidebar-resize-handle {
        right: -4px;
    }
}

/* Кнопка чата в друзьях */
.chat-friend-btn {
    background: #2d2d3f;
    border: none;
    color: #ffffff;
    border-radius: 25%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.chat-friend-btn:hover {
    background: #1a7ad9;
    transform: scale(1.05);
}

.friend-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}


/* Анимация для меню */
.friend-menu {
    animation: menuFadeIn 0.15s ease;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* Индикатор статуса - всегда поверх аватара */
.friend-avatar {
    position: relative;
    width: 45px;
    height: 45px;
    border-radius: 25%;
    background: linear-gradient(135deg, #2c92f2, #c992ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #ffffff;
    font-size: 18px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    overflow: visible;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #16161D;
    z-index: 5;
}

.status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 2px #10b981;
}

.status-indicator.offline {
    background: #6b7280;
}

/* Убедимся что индикатор всегда виден поверх фонового изображения */
.friend-avatar[style*="background-image"] .status-indicator {
    z-index: 10;
}


/* Chat Header Avatar Styles */
.chat-header-info {
    flex: 1;
    cursor: pointer;
    transition: opacity 0.2s;
}

.chat-header-info:hover {
    opacity: 0.8;
}

.chat-header-avatar-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 25%;
    background: linear-gradient(135deg, #2c92f2, #c992ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #ffffff;
    font-size: 20px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.chat-header-avatar .status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #020f1c;
    z-index: 5;
}

.chat-header-avatar .status-indicator.online {
    background: #10b981;
    box-shadow: 0 0 2px #10b981;
}

.chat-header-avatar .status-indicator.offline {
    background: #6b7280;
}

.chat-header-text {
    flex: 1;
}

.chat-header-display-name {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.chat-header-username {
    font-size: 11px;
    color: #ffffff;
    opacity: 0.6;
    margin-top: 2px;
}

.chat-header-birth-info {
    font-size: 10px;
    color: #6b7280;
    margin-top: 2px;
}

/* Push уведомления - баннер разрешения */
.notification-permission-banner {
    background: rgba(44, 146, 242, 0.15);
    border: 1px solid #2c92f2;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.notification-permission-banner button {
    background: #2c92f2;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    font-size: 12px;
}

.notification-permission-banner button:hover {
    background: #1a7ad9;
}

/* Cropper.js стили */
.cropper-container {
    margin: 0 auto;
}

.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}

.cropper-modal {
    background-color: rgba(0, 0, 0, 0.8);
}

.cropper-dashed {
    border-color: #ffffff;
}

.cropper-center::before,
.cropper-center::after {
    background-color: #ffffff;
}

.cropper-point {
    background-color: #2c92f2;
    border-radius: 50%;
    width: 8px;
    height: 8px;
}

.cropper-line {
    background-color: #2c92f2;
}

#cropModal .modal-content {
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#cropConfirmBtn, #cropCancelBtn {
    min-width: 120px;
}

/* Замена смайликов на иконки */
.fa-emoji {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

/* Закреплённые сообщения - полный вид */
.pinned-message-full {
    background: #1e1e2a;
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.pinned-message-full:hover {
    background: #2d2d3f;
}

/* Анимация выделения сообщения */
.highlight-message {
    animation: highlightFlash 1.5s ease;
    border-radius: 12px;
}

@keyframes highlightFlash {
    0% { background: rgba(44, 146, 242, 0); }
    30% { background: rgba(44, 146, 242, 0.4); }
    100% { background: rgba(44, 146, 242, 0); }
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .chat-header-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .chat-header-avatar .status-indicator {
        width: 12px;
        height: 12px;
    }
    
    .chat-header-display-name {
        font-size: 14px;
    }
}