/* dark.css — премиальная тёмная тема (без зелёного китча) */

body.dark-theme {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --border-color: #30363d;
    --card-bg: #161b22;
    --header-bg: #21262d;
    --text-muted: #8b949e;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Карточки и панели */
body.dark-theme .card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-theme .card-header {
    background-color: var(--header-bg) !important;
    border-bottom: 1px solid var(--border-color);
}

/* Поля ввода */
body.dark-theme .form-control,
body.dark-theme .form-select {
    background-color: #0d1117;
    border-color: #30363d;
    color: var(--text-color);
}

body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    background-color: #0d1117;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

/* === СООБЩЕНИЯ — КРАСИВО И СПОКОЙНО === */

/* Отправленные (справа) */
body.dark-theme .message.sent .message-bubble {
   background: rgba(30, 45, 77, 0.65);
    color: #e6f0ff;          
     
    border-bottom-right-radius: 6px;
   
}

/* Полученные (слева) */
body.dark-theme .message.received .message-bubble {
    background: linear-gradient(135deg, #21262d 0%, #30363d 100%);
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-bottom-left-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

/* Ховер */
body.dark-theme .message .message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
}

/* Время и галочки */
body.dark-theme .message-time,
body.dark-theme .message-status {
    color: #8b949e;
    font-size: 0.75rem;
}

body.dark-theme .message.sent .message-time,
body.dark-theme .message.sent .message-status {
    color: rgba(255, 255, 255, 0.7);
}

/* Ссылка на имя в полученных сообщениях */
body.dark-theme .message.received .message-header .profile-link {
    color: #58a6ff;
    font-weight: 500;
}

body.dark-theme .message.received .message-header .profile-link:hover {
    color: #79c0ff;
    text-decoration: underline;
}

/* Индикатор печатает */
body.dark-theme .typing-indicator {
    background: rgba(88, 166, 255, 0.15);
    color: #79c0ff;
    border-radius: 12px;
    padding: 8px 14px;
    font-style: italic;
}

/* Кнопки "Показать ещё" / "Свернуть" */
body.dark-theme .expand-indicator,
body.dark-theme .collapse-indicator {
    background: rgba(88, 166, 255, 0.15);
    color: #79c0ff;
    border: 1px solid #30363d;
}

body.dark-theme .expand-indicator:hover,
body.dark-theme .collapse-indicator:hover {
    background: #1f6feb;
    color: white;
}


body.dark-theme .user-item:hover {
     background: linear-gradient(135deg, #21262d 0%, #30363d 100%);
    color: #c9d1d9;
}

body.dark-theme .user-item.active {
     background: linear-gradient(135deg, #1f6feb 0%, #388bfd 100%);
     color: #ffffff;
}



body.dark-theme  .user-item {
    padding: 12px 15px;
    border-bottom: 1px solid #444648;
    cursor: pointer;
    transition: background-color 0.2s;
}

/* qchat theme polish v106: remove light/white surfaces from dark theme. */
body.dark-theme {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --border-color: #30363d;
    --card-bg: #161b22;
    --header-bg: #21262d;
    --text-muted: #8b949e;
    --bs-body-bg: #0d1117;
    --bs-body-color: #c9d1d9;
    --bs-border-color: #30363d;
    --bs-secondary-color: #8b949e;
    --bs-tertiary-bg: #161b22;
    --qchat-dark-surface: #161b22;
    --qchat-dark-surface-2: #21262d;
    --qchat-dark-surface-3: #30363d;
    --qchat-dark-text: #c9d1d9;
    --qchat-dark-muted: #8b949e;
    --qchat-dark-accent: #58a6ff;
}

body.dark-theme .text-muted,
body.dark-theme .small.text-muted,
body.dark-theme .form-text,
body.dark-theme .last-message-preview,
body.dark-theme .file-info,
body.dark-theme .file-size,
body.dark-theme .forwarded-label,
body.dark-theme .forwarded-header,
body.dark-theme .qchat-file-bundle-preview-size,
body.dark-theme .qchat-audio-mini-extra,
body.dark-theme .qchat-audio-mini-progress {
    color: var(--qchat-dark-muted) !important;
}

body.dark-theme .card,
body.dark-theme .modal-content,
body.dark-theme .dropdown-menu,
body.dark-theme .list-group-item,
body.dark-theme .input-group-text,
body.dark-theme .tab-content,
body.dark-theme .settings-section,
body.dark-theme .setting-item,
body.dark-theme .context-menu,
body.dark-theme .message-checkbox,
body.dark-theme .file-preview-small,
body.dark-theme .floating-media-player,
body.dark-theme .floating-player-body,
body.dark-theme .forwarded-message-container,
body.dark-theme .decrypted-audio,
body.dark-theme .storage-info,
body.dark-theme #forwardMessageModal .modal-content,
body.dark-theme #avatarModal .modal-content {
    background: var(--qchat-dark-surface) !important;
    color: var(--qchat-dark-text) !important;
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .card-header,
body.dark-theme .modal-header,
body.dark-theme .modal-footer,
body.dark-theme .dropdown-header,
body.dark-theme .settings-actions,
body.dark-theme #forwardMessageModal .modal-header,
body.dark-theme #forwardMessageModal .modal-footer,
body.dark-theme #avatarModal .modal-footer {
    background: var(--qchat-dark-surface-2) !important;
    color: var(--qchat-dark-text) !important;
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .form-control,
body.dark-theme .form-select,
body.dark-theme textarea,
body.dark-theme input[type="text"],
body.dark-theme input[type="search"],
body.dark-theme input[type="password"],
body.dark-theme input[type="email"] {
    background-color: #0d1117 !important;
    color: var(--qchat-dark-text) !important;
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .form-control::placeholder,
body.dark-theme textarea::placeholder,
body.dark-theme input::placeholder {
    color: #6e7681 !important;
}

body.dark-theme .nav-tabs,
body.dark-theme .nav-tabs .nav-link {
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .nav-tabs .nav-link {
    color: var(--qchat-dark-muted) !important;
}

body.dark-theme .nav-tabs .nav-link.active,
body.dark-theme .nav-tabs .nav-item.show .nav-link {
    background: var(--qchat-dark-surface) !important;
    color: var(--qchat-dark-text) !important;
    border-color: var(--qchat-dark-surface-3) var(--qchat-dark-surface-3) var(--qchat-dark-surface) !important;
}

body.dark-theme .users-list::-webkit-scrollbar-track,
body.dark-theme .settings-tab-scroll::-webkit-scrollbar-track,
body.dark-theme .message-container::-webkit-scrollbar-track {
    background: #0d1117;
}

body.dark-theme .users-list::-webkit-scrollbar-thumb,
body.dark-theme .settings-tab-scroll::-webkit-scrollbar-thumb,
body.dark-theme .message-container::-webkit-scrollbar-thumb {
    background: #30363d;
}

body.dark-theme .users-list {
    scrollbar-color: #30363d #0d1117;
}

body.dark-theme .user-item {
    background: transparent;
    color: var(--qchat-dark-text);
    border-bottom-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .user-item:hover,
body.dark-theme #chatWithUser[role="button"]:hover,
body.dark-theme #chatWithUser[role="button"]:focus-visible {
    background: linear-gradient(135deg, #21262d 0%, #30363d 100%) !important;
    color: var(--qchat-dark-text) !important;
}

body.dark-theme .user-item.active,
body.dark-theme .user-item.chat-audio-current,
body.dark-theme #chatWithUser[role="button"]:active {
    background: linear-gradient(135deg, #1f6feb 0%, #388bfd 100%) !important;
    color: #ffffff !important;
}

body.dark-theme .user-item.active .last-message-preview,
body.dark-theme .user-item.active .text-muted,
body.dark-theme .user-item.chat-audio-current .text-muted {
    color: rgba(255,255,255,0.78) !important;
}

body.dark-theme .message-container,
body.dark-theme #messagesContainer {
    background: var(--bg-color) !important;
    color: var(--qchat-dark-text) !important;
}

body.dark-theme .message.sent .message-bubble {
    --message-bg: rgba(30, 45, 77, 0.78);
    --message-hover-bg: rgba(39, 59, 102, 0.86);
    background: linear-gradient(135deg, rgba(30, 45, 77, 0.84) 0%, rgba(25, 38, 67, 0.9) 100%) !important;
    color: #e6f0ff !important;
    border: 1px solid rgba(88, 166, 255, 0.2);
}

body.dark-theme .message.received .message-bubble {
    --message-bg: #21262d;
    --message-hover-bg: #30363d;
    background: linear-gradient(135deg, #21262d 0%, #30363d 100%) !important;
    color: var(--qchat-dark-text) !important;
    border: 1px solid var(--qchat-dark-surface-3) !important;
}

body.dark-theme .message-text.collapsed::after {
    background: linear-gradient(transparent, var(--message-bg, #21262d)) !important;
}

body.dark-theme .message-text.collapsed::before,
body.dark-theme .message-text .expand-indicator,
body.dark-theme .message-text .collapse-indicator {
    background: var(--message-bg, #21262d) !important;
    color: var(--qchat-dark-muted) !important;
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .message-text:hover .expand-indicator,
body.dark-theme .message-text:hover .collapse-indicator {
    background: var(--message-hover-bg, #30363d) !important;
}

body.dark-theme .auto-decrypt-media:hover,
body.dark-theme .message.selectable-message:hover,
body.dark-theme .context-menu-item:hover,
body.dark-theme .forward-contacts-list .forward-contact-item:hover {
    background-color: var(--qchat-dark-surface-2) !important;
    color: var(--qchat-dark-text) !important;
}

body.dark-theme .message.selectable-message.selected,
body.dark-theme .selected,
body.dark-theme .selection-panel {
    background-color: rgba(31, 111, 235, 0.22) !important;
    border-color: rgba(88, 166, 255, 0.4) !important;
}

body.dark-theme .message-avatar,
body.dark-theme .avatar-placeholder,
body.dark-theme .user-list-avatar-placeholder,
body.dark-theme .profile-avatar-container .online-status,
body.dark-theme .online-status {
    border-color: var(--qchat-dark-surface-2) !important;
}

body.dark-theme .forwarded-content,
body.dark-theme .file-name-small,
body.dark-theme .file-name,
body.dark-theme .profile-info,
body.dark-theme .profile-stat,
body.dark-theme .avatar-preview-container,
body.dark-theme .crop-container {
    color: var(--qchat-dark-text) !important;
}

body.dark-theme .forwarded-message,
body.dark-theme .forwarded-message-container {
    border-left-color: var(--qchat-dark-accent) !important;
}

body.dark-theme .forwarded-sender-link,
body.dark-theme .profile-link,
body.dark-theme a:not(.btn) {
    color: var(--qchat-dark-accent);
}

body.dark-theme .forwarded-sender-link:hover,
body.dark-theme .profile-link:hover,
body.dark-theme a:not(.btn):hover {
    color: #79c0ff;
}

body.dark-theme .file-category,
body.dark-theme .qchat-file-bundle-preview-item,
body.dark-theme .qchat-file-bundle-item,
body.dark-theme .qchat-audio-mini-player,
body.dark-theme .audio_card,
body.dark-theme .audio_card .current-song,
body.dark-theme .qchat-audio-mini-art {
    background: var(--qchat-dark-surface-2) !important;
    color: var(--qchat-dark-text) !important;
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .qchat-audio-mini-player.playing,
body.dark-theme .qchat-audio-mini-player.current-song.chat-audio-current,
body.dark-theme .qchat-audio-mini-player.chat-audio-current {
    background: linear-gradient(135deg, rgba(31,111,235,0.28), rgba(56,139,253,0.18)) !important;
    border-color: rgba(88,166,255,0.45) !important;
}

body.dark-theme .qchat-audio-mini-btn,
body.dark-theme .audio_card button,
body.dark-theme .audio_card .current-btn {
    background: rgba(88,166,255,0.16) !important;
    color: #c9d1d9 !important;
}

body.dark-theme .qchat-audio-mini-progress .timeline {
    background: rgba(255,255,255,0.16) !important;
}

body.dark-theme .qchat-audio-mini-progress .playhead {
    background: var(--qchat-dark-accent) !important;
}

body.dark-theme .file-preview,
body.dark-theme .file-message.book-message .file-preview,
body.dark-theme .file-message.text-message .file-preview,
body.dark-theme .file-message.archive-message .file-preview,
body.dark-theme .file-message.executable-message .file-preview,
body.dark-theme .file-message.torrent-message .file-preview,
body.dark-theme .file-message.document-message .file-preview,
body.dark-theme .file-message.audio-message .file-preview,
body.dark-theme .message.sent .file-message.text-message .file-preview,
body.dark-theme .message.sent .file-message.executable-message .file-preview,
body.dark-theme .message.sent .file-message.torrent-message .file-preview,
body.dark-theme .message.sent .file-message.document-message .file-preview,
body.dark-theme .message.sent .file-message.audio-message .file-preview {
    background: linear-gradient(135deg, #161b22 0%, #21262d 100%) !important;
    border-color: var(--qchat-dark-surface-3) !important;
    color: var(--qchat-dark-text) !important;
}

body.dark-theme .file-message.audio-message audio,
body.dark-theme .file-message.audio-message audio::-webkit-media-controls-panel {
    background: #161b22 !important;
    color: var(--qchat-dark-text) !important;
}

body.dark-theme .executable-warning,
body.dark-theme .player-error,
body.dark-theme .user-item.self-user {
    background: rgba(187, 128, 9, 0.16) !important;
    border-color: rgba(187, 128, 9, 0.38) !important;
    color: #d29922 !important;
}

body.dark-theme .user-item.self-user:hover {
    background: rgba(187, 128, 9, 0.24) !important;
}

body.dark-theme .badge {
    color: #ffffff;
}

body.dark-theme .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
}

/* qchat theme polish v107: profile/stat/settings dark surfaces. */
body.dark-theme .profile-info-section,
body.dark-theme .stat-item,
body.dark-theme .profile-content,
body.dark-theme .profile-tab-scroll,
body.dark-theme #profileTab .card-body,
body.dark-theme .profile-card,
body.dark-theme .profile-panel,
body.dark-theme .profile-details,
body.dark-theme .profile-blog-comments-body,
body.dark-theme .profile-blog-comment,
body.dark-theme .profile-blog-avatar,
body.dark-theme .bg-light,
body.dark-theme .bg-white {
    background: var(--qchat-dark-surface) !important;
    color: var(--qchat-dark-text) !important;
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .profile-info-section,
body.dark-theme .stat-item,
body.dark-theme .profile-blog-comment,
body.dark-theme .profile-blog-comments-body {
    border: 1px solid var(--qchat-dark-surface-3) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28) !important;
}

body.dark-theme .stat-item:hover {
    background: var(--qchat-dark-surface-2) !important;
    border-color: rgba(88, 166, 255, 0.36) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.36) !important;
}

body.dark-theme .section-title,
body.dark-theme .profile-section-title,
body.dark-theme .profile-name,
body.dark-theme .profile-username,
body.dark-theme .profile-blog-author,
body.dark-theme .profile-blog-comment-content,
body.dark-theme .info-label {
    color: var(--qchat-dark-text) !important;
}

body.dark-theme .section-title,
body.dark-theme .info-item,
body.dark-theme .border,
body.dark-theme .border-top,
body.dark-theme .border-bottom,
body.dark-theme .border-start,
body.dark-theme .border-end {
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .section-title i,
body.dark-theme .stat-number,
body.dark-theme .profile-blog-comments-toggle,
body.dark-theme .profile-user-link {
    color: var(--qchat-dark-accent) !important;
}

body.dark-theme .profile-blog-comments-toggle:hover,
body.dark-theme .profile-user-link:hover {
    color: #79c0ff !important;
}

body.dark-theme .info-value,
body.dark-theme .stat-label,
body.dark-theme .profile-blog-comment-date,
body.dark-theme .profile-subtitle,
body.dark-theme .profile-meta {
    color: var(--qchat-dark-muted) !important;
}

body.dark-theme .table,
body.dark-theme table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--qchat-dark-text);
    --bs-table-border-color: var(--qchat-dark-surface-3);
    color: var(--qchat-dark-text) !important;
    border-color: var(--qchat-dark-surface-3) !important;
}

body.dark-theme .table > :not(caption) > * > *,
body.dark-theme table td,
body.dark-theme table th {
    background-color: transparent !important;
    color: var(--qchat-dark-text) !important;
    border-color: var(--qchat-dark-surface-3) !important;
}

