#chat-app {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: #0a0a0f;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 380px;
    border-right: 1px solid #1e2129;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: #0d0d12;
    position: relative;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px 14px;
    border-bottom: 1px solid #1e2129;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-header .chat-title {
    flex: 1;
    text-align: center;
    margin: 0;
}

.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 6px;
    transition: background 0.2s;
    width: 28px;
    height: 28px;
}

.menu-btn:hover {
    background: #1c1f26;
}

.chat-menu-btn {
    display: none;
}

.chat-title {
    font-family: 'Syne', sans-serif;
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #0072ff, #00c6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-area {
    padding: 10px 12px;
    border-bottom: 1px solid #1e2129;
    position: relative;
}

#search-input {
    width: 100%;
    background: #16191f;
    border: 1px solid #1e2129;
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

#search-input:focus {
    border-color: #0072ff;
    background: #181b22;
}

#search-input::placeholder {
    color: #4a4f5a;
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #111318;
    border: 1px solid #1e2129;
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 10;
    display: none;
    overflow: hidden;
}

.search-result-item {
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #16191f;
}

.search-result-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0072ff, #6366F1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.search-result-fullname {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.search-result-username {
    color: #8b8f9a;
    font-size: 12px;
}

#chats-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #14161c;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-item:hover {
    background: #111318;
}

.chat-item.active {
    background: #16191f;
    border-left: 3px solid #0072ff;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0072ff, #6366F1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

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

.chat-item-name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 1px;
}

.chat-item-username {
    color: #8b8f9a;
    font-size: 12px;
    margin-bottom: 3px;
}

.chat-item-last {
    color: #5a5f6b;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #0a0a0f;
    position: relative;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    opacity: 0.7;
}

.placeholder-icon {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.placeholder-text {
    font-size: 18px;
    font-style: italic;
    font-weight: 400;
    color: #8b8f9a;
}

.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid #1e2129;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header #chat-name {
    flex: 1;
    min-width: 0;
}

.chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0072ff, #6366F1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

#chat-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

#messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-back-btn {
    display: none;
}

.empty-chat {
    color: #5a5f6b;
    text-align: center;
    margin-top: 40px;
    font-size: 14px;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: opacity 0.2s ease, transform 0.2s ease; /* для плавной анимации */
}

.message-wrapper-sent {
    align-items: flex-end;
}

.message-wrapper-received {
    align-items: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-sent {
    background: #0072ff;
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}

.message-received {
    background: #16191f;
    border: 1px solid #1e2129;
    color: #fff;
    border-radius: 18px 18px 18px 4px;
}

.message-username {
    font-size: 11px;
    color: #8b8f9a;
    margin-bottom: 3px;
}

.message-sent .message-username {
    color: rgba(255, 255, 255, 0.6);
}

.message-time {
    font-size: 10px;
    color: #5a5f6b;
    margin-top: 3px;
    text-align: right;
}

.message-sent .message-time {
    color: rgba(255, 255, 255, 0.5);
}

.mention-link {
    color: #0072ff;
    cursor: pointer;
    transition: color 0.15s;
}

.mention-link:hover {
    color: #00c6ff;
    text-decoration: underline;
}

.reply-quote {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: background 0.15s;
}

.reply-quote:hover {
    background: rgba(255,255,255,0.06);
}

.reply-quote-bar {
    width: 3px;
    height: 32px;
    background: #0072ff;
    border-radius: 2px;
    flex-shrink: 0;
    margin-right: 8px;
}

.reply-quote-content {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
}

.reply-quote-name {
    font-size: 11px;
    font-weight: 600;
    color: #0072ff;
    margin-bottom: 1px;
}

.reply-quote-text {
    font-size: 11px;
    color: #8b8f9a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Поле ввода сообщения */
.chat-composer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--lumina-bg-elevated);
    border-top: 1px solid var(--lumina-border);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
}

.chat-composer #message-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    box-sizing: border-box;
    background: var(--lumina-bg-input);
    border: 1px solid var(--lumina-border);
    border-radius: 10px;
    padding: 0 16px;
    color: var(--lumina-text);
    font-size: 14px;
    line-height: 44px;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.chat-composer #message-input:focus {
    border-color: var(--lumina-accent);
    background: var(--lumina-bg-input-focus);
}

.chat-composer #message-input::placeholder {
    color: var(--lumina-text-faint);
}

.chat-composer #send-btn {
    background: var(--lumina-accent);
    border: none;
    border-radius: 10px;
    padding: 0;
    width: 44px;
    height: 44px;
    min-height: 44px;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--lumina-text-on-accent);
}

.chat-composer #send-btn svg {
    display: block;
    width: 20px;
    height: 20px;
}

.chat-composer #send-btn:hover {
    background: var(--lumina-accent-hover);
}

.chat-composer #send-btn:active {
    transform: scale(0.96);
}

.chat-composer #send-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
/* Разделитель дат */
.date-separator {
    text-align: center;
    font-size: 12px;
    color: #8b8f9a;
    background: rgba(22, 25, 31, 0.8);
    padding: 4px 12px;
    border-radius: 20px;
    margin: 8px auto;
    width: fit-content;
    backdrop-filter: blur(4px);
}
/* Кнопка ленты в шапке */
.feed-btn {
    margin-left: auto;
    color: var(--lumina-text);
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.feed-btn:hover {
    background: var(--lumina-bg-hover);
}

.feed-btn svg {
    stroke: var(--lumina-text);
}

/* Спиннер загрузки */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--lumina-border);
    border-top-color: var(--lumina-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
/* Статус в шапке чата – ровно посередине под ником, серый */
.chat-header-status {
    font-size: 12px;
    color: var(--lumina-text-muted);
    margin-top: 4px;
    text-align: center;
}

/* В профиле статус тоже по центру */
.profile-modal-status {
    text-align: center;
    font-size: 13px;
    color: var(--lumina-text-muted);
    margin: 8px 0 16px;
}