* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #fff; overflow: hidden; }
#app { width: 100%; height: 100%; }

/* Auth */
.auth-screen { display: flex; justify-content: center; align-items: center; height: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.auth-container { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 400px; }
.auth-form { background: #fff; padding: 40px 30px; border-radius: 20px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.3); text-align: center; }
.auth-logo { font-size: 60px; margin-bottom: 10px; }
.auth-form h1 { font-size: 28px; margin-bottom: 8px; color: #333; }
.auth-subtitle { color: #888; margin-bottom: 30px; font-size: 14px; }
.auth-footer { margin-top: 20px; color: rgba(255,255,255,0.4); font-size: 11px; display: flex; align-items: baseline; justify-content: center; gap: 12px; }
.visitor-counter { opacity: 0.5; }
.eye-icon { opacity: 0.6; font-size: 10px; }
.version-info { text-align: center; font-size: 9px; color: rgba(0,0,0,0.25); padding: 4px 0 8px; }
.form-input { width: 100%; padding: 14px 18px; margin-bottom: 14px; border: 2px solid #eee; border-radius: 12px; font-size: 16px; transition: border-color 0.2s; }
.form-input:focus { outline: none; border-color: #667eea; }
.btn { width: 100%; padding: 14px; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: transform 0.1s, opacity 0.2s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.btn-secondary { background: #f0f0f0; color: #333; }
.btn-danger { background: #ff6b6b; color: #fff; margin-top: 10px; }
.btn-sm { padding: 8px 14px; font-size: 13px; width: auto; border-radius: 8px; }
.toggle-link { color: #888; margin-top: 20px; font-size: 14px; }
.toggle-link span { color: #667eea; cursor: pointer; font-weight: 600; }

/* Layout */
.container { display: flex; height: 100%; }
.sidebar { width: 100%; max-width: 360px; display: flex; flex-direction: column; border-right: 1px solid #eee; background: #fff; }
.sidebar.hidden { display: none; }
.main-content { flex: 1; display: flex; flex-direction: column; }

/* Header */
.sidebar-header { padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; }
.sidebar-header h2 { font-size: 20px; cursor: pointer; }
.header-btns { display: flex; gap: 4px; }
.btn-icon { background: none; border: none; font-size: 20px; cursor: pointer; padding: 6px; opacity: 0.7; }
.btn-icon:hover { opacity: 1; }

/* Tabs */
.tabs-container { display: flex; border-bottom: 1px solid #eee; }
.tab { flex: 1; padding: 10px 6px; border: none; background: #fff; font-size: 12px; font-weight: 600; color: #888; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; overflow: hidden; }
.tab.active { color: #667eea; border-bottom-color: #667eea; }
.tab-badge { background: #667eea; color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 10px; margin-left: 4px; display: inline-block; vertical-align: middle; }
.tab-badge-chats { background: #667eea; }
.tab-badge-friends { background: #e67e22; }
.tab-badge-new { background: #27ae60; }
.new-badge { background: #27ae60; color: #fff; font-size: 9px; padding: 2px 5px; border-radius: 8px; margin-left: 6px; font-weight: 600; vertical-align: middle; }
.mention-tag { color: #667eea; font-weight: 600; cursor: pointer; background: rgba(102,126,234,0.1); padding: 1px 4px; border-radius: 4px; }
.mention-tag:hover { background: rgba(102,126,234,0.2); text-decoration: underline; }
.message.sent .mention-tag { color: #fff; background: rgba(255,255,255,0.2); }
.message.sent .mention-tag:hover { background: rgba(255,255,255,0.3); }
.visitor-counter { margin-top: 8px; font-size: 11px; opacity: 0.5; }

/* Search */
.search-box { padding: 10px 12px; }
.search-input { width: 100%; padding: 10px 14px; border: none; border-radius: 10px; background: #f5f5f5; font-size: 15px; }
.search-input:focus { outline: none; background: #eee; }
.search-section { padding: 8px 16px; font-size: 11px; font-weight: 600; color: #888; background: #f5f5f5; text-transform: uppercase; }
.search-msg-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f5f5f5; cursor: pointer; }
.search-msg-item:hover { background: #f9f9f9; }
.search-msg-text { font-size: 13px; color: #666; margin-top: 2px; }

/* List */
.content-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.empty-text { padding: 40px 20px; text-align: center; color: #999; }

/* Chat Item */
.chat-item { display: flex; align-items: center; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #f5f5f5; transition: background 0.15s; }
.chat-item:hover { background: #f9f9f9; }
.chat-item.active { background: #f0f0ff; }
.chat-item.unread .chat-name { font-weight: 700; }
.chat-item.unread .chat-preview { color: #333; font-weight: 500; }

.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; font-weight: 600; margin-right: 12px; background-size: cover; background-position: center; flex-shrink: 0; }
.avatar.avatar-img { background-color: #ddd; }
.fav-avatar { background: linear-gradient(135deg, #ffd700, #ffaa00) !important; }
.news-avatar { background: linear-gradient(135deg, #667eea, #764ba2) !important; }
.online-dot { position: absolute; bottom: 2px; right: 10px; width: 14px; height: 14px; background: #4caf50; border: 2px solid #fff; border-radius: 50%; }
.crown { font-size: 12px; margin-right: 2px; }
.crown-big { font-size: 18px; }

.chat-info { flex: 1; min-width: 0; }
.chat-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-preview { font-size: 13px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-time { font-size: 12px; color: #aaa; white-space: nowrap; }
.unread-badge { background: #667eea; color: #fff; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 12px; min-width: 22px; text-align: center; }

/* User Item */
.user-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f5f5f5; cursor: pointer; }
.user-item:hover { background: #f9f9f9; }
.user-info { flex: 1; min-width: 0; }
.user-bio { font-size: 13px; color: #888; }
.user-btns { display: flex; gap: 8px; align-items: center; }
.btn-add { background: #4caf50; }
.btn-accept { background: #4caf50; }
.btn-reject { background: #ff6b6b; }
.btn-cancel { background: #ff9800; }
.btn-info { background: #2196f3; }
.btn-unblock { background: #4caf50; }
.btn-add-friend { background: #4caf50; color: #fff; }
.friend-check { color: #4caf50; font-size: 13px; padding: 0 8px; font-weight: 600; }
.pending-check { color: #ff9800; font-size: 13px; padding: 0 8px; font-weight: 600; }
.online-text { color: #4caf50; }

/* Request */
.req-tabs { display: flex; border-bottom: 1px solid #eee; }
.req-tab { flex: 1; padding: 10px; border: none; background: #fff; font-size: 13px; font-weight: 600; color: #888; cursor: pointer; border-bottom: 2px solid transparent; }
.req-tab.active { color: #667eea; border-bottom-color: #667eea; }
.req-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f5f5f5; }
.req-info { flex: 1; }
.req-btns { display: flex; gap: 8px; margin-top: 6px; }

/* Chat Area */
.chat-area { height: 100%; display: flex; flex-direction: column; }
.chat-container { display: flex; flex-direction: column; height: 100%; }
.empty-state { display: flex; align-items: center; justify-content: center; height: 100%; color: #999; }

/* Chat Header */
.chat-header { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid #eee; background: #fff; }
.back-btn { background: none; border: none; font-size: 24px; color: #667eea; cursor: pointer; padding: 6px; margin-right: 6px; }
.header-info { display: flex; align-items: center; flex: 1; }
.header-info .avatar { width: 42px; height: 42px; font-size: 18px; margin-right: 10px; }
.header-text { flex: 1; }
.header-status { font-size: 13px; color: #888; }
.header-status.online { color: #4caf50; }
.call-btn-header { background: none; border: none; font-size: 20px; cursor: pointer; padding: 8px; border-radius: 50%; transition: background 0.2s, transform 0.1s; }
.call-btn-header:hover { background: rgba(102, 126, 234, 0.1); }
.call-btn-header:active { transform: scale(0.95); }
.delete-mode-btn { background: none; border: none; font-size: 18px; cursor: pointer; padding: 8px; opacity: 0.4; border-radius: 50%; }
.delete-mode-btn.active { opacity: 1; background: #ffebee; }

/* Messages */
.messages-container { flex: 1; overflow-y: auto; padding: 12px; background: #f5f5f5; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
.message { max-width: 75%; margin-bottom: 8px; display: flex; flex-direction: column; position: relative; }
.message.sent { align-self: flex-end; align-items: flex-end; }
.message.received { align-self: flex-start; align-items: flex-start; }
.msg-sender-avatar { flex-shrink: 0; }
.msg-sender-avatar .avatar { width: 32px; height: 32px; font-size: 14px; margin: 0; }
.msg-sender-avatar .avatar-wrap { position: relative; display: inline-block; }
.msg-sender-avatar .online-dot { position: absolute; bottom: 0; right: 0; width: 10px; height: 10px; background: #4caf50; border: 2px solid #fff; border-radius: 50%; }
.msg-content-wrapper { display: flex; flex-direction: column; max-width: 100%; }
.msg-sender-name { font-size: 12px; font-weight: 600; color: #667eea; margin-bottom: 4px; padding: 0 4px; display: flex; align-items: center; gap: 6px; }
.msg-text { padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.4; word-break: break-word; white-space: pre-wrap; }
.msg-text a { color: inherit; text-decoration: underline; }
.message.sent .msg-text { background: #667eea; color: #fff; border-radius: 18px 18px 4px 18px; }
.message.received .msg-text { background: #fff; color: #000; border-radius: 18px 18px 18px 4px; }
.msg-footer { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 0 4px; }
.msg-time { font-size: 11px; color: #999; }
.msg-read-status { font-size: 14px; color: #a855f7; margin-left: 4px; letter-spacing: -2px; }
.msg-read-status.read { color: #22c55e; }
.message.sent .msg-read-status { color: #c4b5fd; }
.message.sent .msg-read-status.read { color: #86efac; }
.msg-delete-btn { width: 20px; height: 20px; border-radius: 50%; background: rgba(244,67,54,0.8); color: #fff; border: none; font-size: 11px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Date Separator */
.date-separator { display: flex; align-items: center; justify-content: center; margin: 16px 0; }
.date-separator span { background: rgba(0,0,0,0.08); color: #666; padding: 4px 12px; border-radius: 12px; font-size: 12px; font-weight: 500; }

/* Message Animation */
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes msgOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(-20px); } }
.msg-anim { animation: msgIn 0.2s ease-out; }

/* Media */
.media-wrap { position: relative; display: inline-block; }
.msg-img { max-width: 240px; max-height: 280px; border-radius: 12px; cursor: pointer; display: block; }
.msg-video { max-width: 100%; max-height: 280px; border-radius: 12px; background: #000; display: block; }

.audio-wrap { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.05); padding: 8px 12px; border-radius: 12px; }
.msg-audio { width: 180px; height: 36px; }
.file-wrap { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.05); padding: 12px; border-radius: 12px; min-width: 180px; }
.file-icon { font-size: 24px; }
.file-name { flex: 1; font-size: 14px; word-break: break-word; }
.dl-btn { position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,0.6); color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 16px; font-size: 12px; }
.audio-wrap .dl-btn, .file-wrap .dl-btn { position: static; background: #667eea; }
.message.sent .audio-wrap, .message.sent .file-wrap { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.5); }

/* Upload Progress */
#uploadWrap { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f0f0f0; border-radius: 8px; margin-bottom: 8px; }
.upload-bar-bg { flex: 1; height: 6px; background: #ddd; border-radius: 3px; overflow: hidden; }
.upload-bar { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 3px; transition: width 0.2s; }
#uploadText { font-size: 12px; color: #666; min-width: 35px; }

/* File Preview */
.file-preview { width: 100%; margin-bottom: 8px; }
.file-preview.hidden { display: none; }
.preview-img-wrap { position: relative; display: inline-block; }
.preview-img { max-width: 120px; max-height: 100px; border-radius: 8px; object-fit: cover; }
.preview-file-wrap { display: flex; align-items: center; gap: 8px; background: #f0f0f0; padding: 8px 12px; border-radius: 8px; }
.preview-close { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; background: #f44336; color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.preview-file-wrap .preview-close { position: static; background: #999; }

/* Message text with media */
.msg-text-with-media { margin-top: 6px; background: transparent !important; padding: 4px 8px !important; border-radius: 8px !important; }
.message.sent .msg-text-with-media { background: rgba(102, 126, 234, 0.15) !important; color: #333 !important; }
.message.received .msg-text-with-media { background: rgba(0, 0, 0, 0.05) !important; }

/* NEWS empty state */
.news-empty { flex-direction: column; gap: 10px; }
.news-empty::before { content: ''; }

/* Input Area */
.input-area { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid #eee; background: #fff; flex-wrap: wrap; }
.input-area.disabled { justify-content: center; color: #999; font-size: 13px; }
.attach-btn { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; background: #f5f5f5; border-radius: 50%; cursor: pointer; font-size: 18px; flex-shrink: 0; }
.voice-btn { display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; background: #f5f5f5; border: none; border-radius: 50%; cursor: pointer; font-size: 18px; flex-shrink: 0; transition: all 0.2s; user-select: none; }
.voice-btn:active, .voice-btn.recording { background: #f44336; transform: scale(1.1); }
.voice-recording { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: #ffebee; border-radius: 20px; color: #f44336; font-size: 13px; font-weight: 500; }
.message-input { flex: 1; padding: 12px 16px; border: none; border-radius: 22px; background: #f5f5f5; font-size: 15px; min-width: 100px; resize: none; overflow-y: auto; max-height: 120px; font-family: inherit; line-height: 1.4; }
.message-input:focus { outline: none; background: #eee; }
.send-btn { width: 42px; height: 42px; background: #667eea; color: #fff; border: none; border-radius: 50%; font-size: 18px; cursor: pointer; flex-shrink: 0; }

/* Image Modal */
.img-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.95); z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.img-full { max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; border-radius: 8px; }
.img-actions { margin-top: 20px; }
.img-dl { background: #667eea; color: #fff; padding: 12px 24px; border-radius: 24px; text-decoration: none; font-size: 16px; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; justify-content: center; align-items: flex-end; }
.modal.active { display: flex; }
.modal-content { background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #eee; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-close { background: none; border: none; font-size: 28px; color: #999; cursor: pointer; }
.modal-body { padding: 20px; }

/* Settings Categories */
.settings-category { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid #eee; }
.settings-category:last-of-type { border-bottom: none; }
.category-title { font-size: 16px; font-weight: 600; color: #333; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* Avatar Section */
.avatar-section { text-align: center; margin-bottom: 20px; }
.avatar-preview { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; font-size: 36px; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; background-size: cover; background-position: center; }
.avatar-preview.avatar-img { background-color: #ddd; font-size: 0; }
.avatar-btns { margin-bottom: 12px; }
.emoji-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.emoji-btn { padding: 10px; font-size: 22px; background: #f5f5f5; border: none; border-radius: 10px; cursor: pointer; }

/* Form */
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.form-group textarea { min-height: 80px; resize: none; }
.field-status { font-size: 12px; margin-top: 4px; display: block; }
.status-ok { color: #4caf50; }
.status-err { color: #f44336; }

/* Toggle */
.toggle-group { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid #eee; }
.toggle-label { font-size: 15px; }
.toggle-desc { font-size: 12px; color: #888; }
.toggle-switch { position: relative; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 28px; cursor: pointer; transition: 0.3s; }
.toggle-slider:before { content: ''; position: absolute; width: 22px; height: 22px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: #667eea; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(22px); }

/* Blacklist */
.blacklist-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid #eee; }
.section-title { font-weight: 600; margin-bottom: 12px; }
.blacklist-item { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid #f5f5f5; }
.blacklist-item .avatar { width: 40px; height: 40px; font-size: 16px; margin-right: 12px; }

/* Profile Modal */
.profile-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10001; justify-content: center; align-items: center; }
.profile-modal.active { display: flex; }
.profile-content { background: #fff; border-radius: 16px; padding: 30px; width: 90%; max-width: 340px; text-align: center; position: relative; }
.profile-close { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 24px; color: #999; cursor: pointer; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; font-size: 42px; color: #fff; background-size: cover; background-position: center; }
.profile-avatar.avatar-img { background-color: #ddd; font-size: 0; }
.profile-name { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.profile-username { font-size: 14px; color: #888; margin-bottom: 8px; }
.profile-status { font-size: 14px; color: #888; margin-bottom: 12px; }
.profile-status.online { color: #4caf50; }
.profile-bio { font-size: 14px; color: #666; margin-bottom: 16px; padding: 12px; background: #f5f5f5; border-radius: 10px; }
.profile-actions { display: flex; flex-direction: column; gap: 10px; }
.profile-actions .btn { padding: 12px; }

/* Admin Panel */
.admin-modal .modal-content { max-width: 800px; }
.admin-content { width: 100%; }
.admin-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; padding: 16px; border-radius: 12px; text-align: center; }
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; opacity: 0.9; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-tab { padding: 10px 20px; border: none; background: #f5f5f5; border-radius: 8px; cursor: pointer; font-weight: 600; }
.admin-tab.active { background: #667eea; color: #fff; }
.admin-list { max-height: 400px; overflow-y: auto; }
.admin-user-item, .admin-msg-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid #eee; }
.admin-user-info { display: flex; align-items: center; gap: 12px; }
.admin-user-info .avatar { width: 40px; height: 40px; font-size: 16px; margin-right: 0; }
.admin-user-name { font-weight: 600; }
.admin-user-email { font-size: 12px; color: #888; }
.admin-user-meta { font-size: 11px; color: #aaa; }
.admin-user-actions { display: flex; gap: 8px; }
.admin-msg-info { flex: 1; }
.admin-msg-users { font-weight: 600; font-size: 13px; }
.admin-msg-text { font-size: 13px; color: #666; margin: 4px 0; }
.admin-msg-time { font-size: 11px; color: #aaa; }
.edit-user-form { padding: 10px; }
.edit-user-form h3 { margin-bottom: 16px; }
.edit-btns { display: flex; gap: 10px; margin-top: 16px; }

/* Admin dialogs */
.admin-search-box { display: flex; gap: 8px; margin-bottom: 16px; }
.admin-search-box .search-input { flex: 1; }
.admin-dialogs-list { max-height: 400px; overflow-y: auto; }
.admin-dialog-item { display: flex; align-items: center; padding: 12px; border-bottom: 1px solid #eee; cursor: pointer; }
.admin-dialog-item:hover { background: #f5f5f5; }
.admin-dialog-users { display: flex; align-items: center; gap: 4px; }
.admin-dialog-users .avatar { width: 36px; height: 36px; font-size: 14px; margin-right: 0; }
.dialog-arrow { color: #888; font-size: 12px; margin: 0 4px; }
.admin-dialog-info { margin-left: 12px; flex: 1; }
.admin-dialog-names { font-weight: 600; font-size: 14px; }
.admin-dialog-meta { font-size: 12px; color: #888; }
.admin-dialog-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #eee; }
.admin-messages-list { max-height: 350px; overflow-y: auto; }
.admin-msg-row { padding: 8px 12px; margin-bottom: 8px; border-radius: 8px; background: #f5f5f5; }
.admin-msg-row.from-right { background: #e3f2fd; margin-left: 20%; }
.admin-msg-row.from-left { margin-right: 20%; }
.admin-msg-sender { font-size: 11px; font-weight: 600; color: #667eea; margin-bottom: 4px; }
.admin-msg-content { font-size: 14px; margin-bottom: 4px; word-break: break-word; }
.admin-msg-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #888; }

/* Mobile */
@media (max-width: 768px) {
  .sidebar { max-width: 100%; position: absolute; inset: 0; z-index: 10; }
  .back-btn { display: flex; }
  .admin-stats { grid-template-columns: 1fr; }
}
@media (min-width: 769px) {
  .back-btn { display: none; }
  .modal { align-items: center; }
  .modal-content { max-width: 420px; border-radius: 16px; }
}


/* NEWS messages */
.message.news-msg { align-self: center; max-width: 90%; }
.message.news-msg .msg-text { background: linear-gradient(135deg, #667eea, #764ba2) !important; color: #fff !important; border-radius: 12px !important; }


/* Site settings in admin */
.site-settings h3 { margin: 16px 0 12px; font-size: 16px; color: #333; display: flex; align-items: center; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat-item { display: flex; flex-direction: column; padding: 10px 12px; background: #f5f5f5; border-radius: 8px; font-size: 13px; }
.stat-item.highlight { background: linear-gradient(135deg, #667eea20, #764ba220); border: 1px solid #667eea40; }
.stat-item .stat-label { color: #666; font-size: 11px; margin-bottom: 4px; }
.stat-item .stat-value { font-weight: 600; color: #333; }
.progress-bar { height: 4px; background: #ddd; border-radius: 2px; margin-top: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: #667eea; border-radius: 2px; transition: width 0.3s; }
.progress-fill.warning { background: #f0ad4e; }
.progress-fill.danger { background: #d9534f; }
.settings-list { margin-top: 12px; }
.settings-list .toggle-group { border-top: none; padding: 8px 0; }
.maintenance-section { background: #fff3cd; padding: 16px; border-radius: 8px; margin-top: 8px; }
.limits-section { background: #f8f9fa; padding: 16px; border-radius: 8px; margin-top: 8px; }
.btn-warning { background: #f0ad4e; color: #fff; }

@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* Maintenance Mode */
.maintenance-banner { 
  background: linear-gradient(135deg, #ff6b6b, #ff8e53); 
  color: #fff; 
  padding: 16px 20px; 
  border-radius: 12px; 
  margin-bottom: 20px; 
  text-align: center; 
  font-weight: 600; 
  font-size: 14px; 
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
  animation: maintenancePulse 2s ease-in-out infinite;
  border: 2px solid rgba(255, 255, 255, 0.3);
}
.maintenance-banner.hidden { display: none !important; }

.maintenance-banner-auth {
  background: linear-gradient(135deg, #ff6b6b, #ff8e53); 
  color: #fff; 
  padding: 12px 20px; 
  border-radius: 12px; 
  margin: 16px 0; 
  text-align: center; 
  font-weight: 700; 
  font-size: 14px; 
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
  animation: maintenancePulse 2s ease-in-out infinite;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

@keyframes maintenancePulse { 
  0%, 100% { opacity: 1; transform: scale(1); } 
  50% { opacity: 0.9; transform: scale(1.01); } 
}

.maintenance-toggle { background: #fff3cd; border-radius: 12px; padding: 16px !important; border: 2px solid #ffc107; }
.maintenance-status { margin-top: 12px; padding: 12px; border-radius: 8px; text-align: center; font-weight: 600; }
.maintenance-active { background: #ffebee; color: #c62828; }
.maintenance-inactive { background: #e8f5e9; color: #2e7d32; }

.cleanup-section { background: #f5f5f5; padding: 16px; border-radius: 12px; }
.storage-info { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.storage-stat { background: #fff; padding: 8px 12px; border-radius: 8px; font-size: 13px; }

/* Progress bars for stats */
.progress-bar { height: 8px; background: #e0e0e0; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 4px; transition: width 0.3s; }
.progress-fill.warning { background: linear-gradient(90deg, #ff9800, #ffc107); }
.progress-fill.danger { background: linear-gradient(90deg, #f44336, #ff6b6b); }

.stat-item.highlight { background: linear-gradient(135deg, #667eea15, #764ba215); border: 1px solid #667eea30; }

/* Load More Button */
.load-more-wrap { text-align: center; padding: 12px; }
.btn-load-more { background: #f0f0f0; color: #667eea; border: none; padding: 10px 20px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-load-more:hover { background: #e5e5e5; transform: translateY(-1px); }
.btn-load-more:active { transform: translateY(0); }
.loading-spinner { color: #888; font-size: 13px; padding: 10px; }

/* Sending Indicator */
.msg-sending { color: #888; font-size: 11px; margin-left: 6px; opacity: 0.7; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Attach Menu Modal */
.attach-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity 0.3s; }
.attach-modal.active { opacity: 1; }
.attach-menu { background: #fff; border-radius: 20px 20px 0 0; padding: 20px; width: 100%; max-width: 500px; transform: translateY(100%); transition: transform 0.3s; position: relative; }
.attach-modal.active .attach-menu { transform: translateY(0); }
.attach-option { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px; background: #f5f5f5; border: none; border-radius: 12px; margin-bottom: 10px; cursor: pointer; font-size: 16px; transition: all 0.2s; }
.attach-option:hover { background: #e5e5e5; transform: translateX(4px); }
.attach-icon { font-size: 24px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 50%; }
.attach-cancel { width: 100%; padding: 16px; background: #fff; border: 1px solid #ddd; border-radius: 12px; cursor: pointer; font-size: 16px; font-weight: 600; color: #666; margin-top: 10px; }

/* Voice Modal */
.voice-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; padding: 20px; }
.voice-modal.active { opacity: 1; pointer-events: auto; }
.voice-container { background: #fff; border-radius: 20px; padding: 24px; width: 100%; max-width: 400px; transform: scale(0.9); transition: transform 0.3s; }
.voice-modal.active .voice-container { transform: scale(1); }
.voice-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.voice-header h3 { margin: 0; font-size: 20px; color: #333; }
.voice-close { background: none; border: none; font-size: 24px; color: #999; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: all 0.2s; }
.voice-close:hover { background: #f5f5f5; color: #333; }
.voice-visualizer { background: #f5f5f5; border-radius: 16px; padding: 20px; margin-bottom: 20px; text-align: center; }
#voiceCanvas { width: 100%; height: 100px; border-radius: 12px; }
.voice-timer { font-size: 24px; font-weight: 600; color: #667eea; margin-top: 12px; font-family: 'Courier New', monospace; }
.voice-controls { display: flex; flex-direction: column; gap: 12px; }
.voice-btn-start, .voice-btn-stop, .voice-btn-send { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.voice-btn-start { background: linear-gradient(135deg, #f44336, #ff6b6b); color: #fff; }
.voice-btn-start:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(244,67,54,0.3); }
.voice-btn-stop { background: linear-gradient(135deg, #ff9800, #ffc107); color: #fff; }
.voice-btn-stop:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(255,152,0,0.3); }
.voice-btn-send { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.voice-btn-send:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102,126,234,0.3); }
.voice-btn-icon { font-size: 20px; }

/* Voice Message Player */
.voice-message { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 18px; background: linear-gradient(135deg, #667eea15, #764ba215); border: 1px solid #667eea30; min-width: 220px; max-width: 300px; }
.message.sent .voice-message { background: linear-gradient(135deg, rgba(102,126,234,0.2), rgba(118,75,162,0.2)); border: 1px solid rgba(102,126,234,0.4); }
.voice-play-btn { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border: none; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; box-shadow: 0 2px 8px rgba(102,126,234,0.4); }
.voice-play-btn:hover { transform: scale(1.08); box-shadow: 0 4px 12px rgba(102,126,234,0.5); }
.voice-play-btn:active { transform: scale(0.95); }
.voice-progress-wrap { flex: 1; position: relative; height: 32px; display: flex; flex-direction: column; justify-content: center; }
.voice-waveform { display: flex; align-items: center; gap: 2px; height: 20px; position: relative; z-index: 1; }
.voice-wave-bar { width: 3px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 2px; opacity: 0.4; transition: height 0.15s; }
.voice-wave-bar:nth-child(1) { height: 8px; }
.voice-wave-bar:nth-child(2) { height: 14px; }
.voice-wave-bar:nth-child(3) { height: 10px; }
.voice-wave-bar:nth-child(4) { height: 18px; }
.voice-wave-bar:nth-child(5) { height: 12px; }
.voice-wave-bar:nth-child(6) { height: 16px; }
.voice-wave-bar:nth-child(7) { height: 8px; }
.voice-wave-bar:nth-child(8) { height: 14px; }
.voice-wave-bar:nth-child(9) { height: 10px; }
.voice-wave-bar:nth-child(10) { height: 18px; }
.voice-wave-bar:nth-child(11) { height: 12px; }
.voice-wave-bar:nth-child(12) { height: 8px; }
.voice-waveform.playing .voice-wave-bar { animation: voiceWave 0.8s ease-in-out infinite; opacity: 0.9; }
.voice-waveform.playing .voice-wave-bar:nth-child(1) { animation-delay: 0s; }
.voice-waveform.playing .voice-wave-bar:nth-child(2) { animation-delay: 0.05s; }
.voice-waveform.playing .voice-wave-bar:nth-child(3) { animation-delay: 0.1s; }
.voice-waveform.playing .voice-wave-bar:nth-child(4) { animation-delay: 0.15s; }
.voice-waveform.playing .voice-wave-bar:nth-child(5) { animation-delay: 0.2s; }
.voice-waveform.playing .voice-wave-bar:nth-child(6) { animation-delay: 0.25s; }
.voice-waveform.playing .voice-wave-bar:nth-child(7) { animation-delay: 0.3s; }
.voice-waveform.playing .voice-wave-bar:nth-child(8) { animation-delay: 0.35s; }
.voice-waveform.playing .voice-wave-bar:nth-child(9) { animation-delay: 0.4s; }
.voice-waveform.playing .voice-wave-bar:nth-child(10) { animation-delay: 0.45s; }
.voice-waveform.playing .voice-wave-bar:nth-child(11) { animation-delay: 0.5s; }
.voice-waveform.playing .voice-wave-bar:nth-child(12) { animation-delay: 0.55s; }
@keyframes voiceWave { 
  0%, 100% { transform: scaleY(1); opacity: 0.5; } 
  50% { transform: scaleY(1.5); opacity: 1; } 
}
.voice-progress-bar { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: rgba(102,126,234,0.2); border-radius: 2px; overflow: hidden; }
.voice-progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #667eea, #764ba2); border-radius: 2px; transition: width 0.1s linear; }
.voice-slider { position: absolute; bottom: -2px; left: 0; right: 0; width: 100%; height: 8px; opacity: 0; cursor: pointer; z-index: 2; -webkit-appearance: none; }
.voice-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; background: #667eea; border-radius: 50%; cursor: pointer; }
.voice-time { font-size: 11px; color: #667eea; font-weight: 500; font-family: 'Courier New', monospace; white-space: nowrap; flex-shrink: 0; display: flex; gap: 2px; }
.voice-current { opacity: 0.7; }
.voice-duration { font-weight: 600; }
.message.sent .voice-time { color: rgba(255,255,255,0.9); }
.message.sent .voice-play-btn { background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.8)); color: #667eea; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.message.sent .voice-wave-bar { background: rgba(255,255,255,0.9); }
.message.sent .voice-progress-bar { background: rgba(255,255,255,0.3); }
.message.sent .voice-progress-fill { background: linear-gradient(90deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7)); }
.voice-message audio { display: none; }

/* Utility */
.hidden { display: none !important; }


/* Loading Chat */
.loading-chat { display: flex; align-items: center; justify-content: center; height: 100%; color: #999; font-size: 14px; }

/* Forward Mode */
.forward-mode-btn { background: none; border: none; font-size: 18px; cursor: pointer; padding: 8px; opacity: 0.4; border-radius: 50%; }
.forward-mode-btn.active { opacity: 1; background: #e3f2fd; }
.message.forward-mode { cursor: pointer; position: relative; padding-left: 40px; }
.message.forward-mode:hover { background: rgba(102,126,234,0.05); border-radius: 12px; }
.msg-checkbox { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; cursor: pointer; accent-color: #667eea; }
.forward-selected-btn { position: sticky; bottom: 0; left: 0; right: 0; padding: 12px; background: #fff; border-top: 1px solid #eee; text-align: center; z-index: 10; }
.forward-selected-btn .btn { width: auto; padding: 12px 24px; }

/* Forward Modal */
.forward-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; padding: 20px; }
.forward-modal.active { opacity: 1; }
.forward-modal-content { background: #fff; border-radius: 20px; width: 100%; max-width: 500px; max-height: 80vh; display: flex; flex-direction: column; transform: scale(0.9); transition: transform 0.3s; }
.forward-modal.active .forward-modal-content { transform: scale(1); }
.forward-contacts-list { flex: 1; overflow-y: auto; max-height: 400px; }
.forward-contact-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f5f5f5; cursor: pointer; transition: background 0.15s; }
.forward-contact-item:hover { background: #f9f9f9; }

/* Forwarded Message Info - как в Telegram, но более контрастно */
.msg-forwarded-header { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  padding: 12px 14px 10px; 
  margin-bottom: 0; 
  background: #e8effe; 
  border-left: 5px solid #667eea; 
  border-radius: 10px 10px 0 0;
}
.message.sent .msg-forwarded-header { 
  background: linear-gradient(135deg, #b8a4e8, #d4c5f9);
  border-left-color: #fff;
  border-left-width: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.msg-forwarded-icon { 
  font-size: 20px; 
  line-height: 1; 
  opacity: 1;
  color: #667eea;
  flex-shrink: 0;
}
.message.sent .msg-forwarded-icon {
  color: #fff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}
.msg-forwarded-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.message.sent .msg-forwarded-avatar {
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.msg-forwarded-details { 
  flex: 1; 
  min-width: 0;
}
.msg-forwarded-from { 
  font-size: 15px; 
  font-weight: 700; 
  color: #4a5fc1; 
  margin-bottom: 3px;
  text-shadow: 0 0 1px rgba(0,0,0,0.1);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.msg-forwarded-from:hover {
  text-decoration: underline;
}
.message.sent .msg-forwarded-from { 
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.msg-forwarded-time { 
  font-size: 13px; 
  color: #555; 
  font-weight: 500;
}
.message.sent .msg-forwarded-time { 
  color: rgba(255,255,255,1);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  font-weight: 600;
}

/* Forwarded message wrapper */
.msg-forwarded-wrapper {
  border: 2px solid #c5d4ff;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f8ff;
}
.message.sent .msg-forwarded-wrapper {
  border-color: #c5b3f0;
  background: linear-gradient(135deg, rgba(184,164,232,0.2), rgba(212,197,249,0.2));
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.msg-forwarded-wrapper .msg-text {
  padding: 12px 14px;
  margin: 0;
  background: transparent !important;
  color: #222;
  font-weight: 500;
}
.message.sent .msg-forwarded-wrapper .msg-text {
  color: #2d2d2d;
  text-shadow: none;
}
.msg-forwarded-wrapper .media-wrap,
.msg-forwarded-wrapper .voice-message,
.msg-forwarded-wrapper .file-wrap {
  margin: 10px 14px;
}

/* Old style - remove */
.msg-forwarded-info { display: none; }

/* Forward Progress */
.forward-progress { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; padding: 24px 32px; border-radius: 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); z-index: 3000; }
.forward-progress-text { font-size: 16px; color: #333; font-weight: 500; }


/* Create Group Modal */
.create-group-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s;
}

.create-group-modal.active {
  opacity: 1;
}

.create-group-modal .modal-content {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.create-group-modal .modal-body {
  padding: 20px;
  overflow-y: auto;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.group-members-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 8px;
}

.group-member-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
}

.group-member-item:hover {
  background: #f5f5f5;
}

.group-member-item input[type="checkbox"] {
  margin-right: 12px;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.group-member-item label {
  display: flex;
  align-items: center;
  flex: 1;
  cursor: pointer;
}

.member-info {
  flex: 1;
}

.member-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.member-status {
  font-size: 12px;
  color: #999;
}

.group-avatar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-size: 24px;
}

/* Colored Messages for Groups */
.message.colored-msg .msg-text {
  background: var(--user-bg) !important;
  color: var(--user-text) !important;
}

.message.colored-msg .msg-sender-name {
  font-weight: 700;
}

.message.colored-msg .msg-time {
  color: var(--user-text);
  opacity: 0.7;
}

.message.colored-msg .msg-read-status {
  color: var(--user-text);
  opacity: 0.8;
}

/* Ensure media content doesn't get colored background */
.message.colored-msg .media-wrap,
.message.colored-msg .voice-message,
.message.colored-msg .file-wrap {
  background: transparent !important;
}

/* Text with media should still be colored */
.message.colored-msg .msg-text-with-media {
  background: var(--user-bg) !important;
  color: var(--user-text) !important;
  opacity: 0.95;
}

/* Site Subtabs */
.site-subtabs { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid #eee; background: #f9f9f9; }
.site-subtab { padding: 8px 16px; border: none; background: #fff; border-radius: 8px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; transition: all 0.2s; }
.site-subtab:hover { background: #f0f0f0; }
.site-subtab.active { background: #667eea; color: #fff; }

/* Icons Manager */
.icons-manager { padding: 20px; }
.icons-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.icons-header h3 { margin: 0; }
.icons-actions { display: flex; gap: 8px; }
.icons-info { background: #f0f7ff; padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; color: #666; border-left: 4px solid #667eea; }
.icons-init { text-align: center; padding: 60px 20px; }
.icons-init h3 { margin-bottom: 12px; }
.icons-init p { color: #666; margin-bottom: 24px; }

/* Icons Table */
.icons-list-header { margin-bottom: 16px; }
.icons-table { border: 1px solid #eee; border-radius: 8px; overflow: hidden; }
.icons-table-header { display: grid; grid-template-columns: 100px 1fr 280px; gap: 16px; padding: 12px 16px; background: #f5f5f5; font-weight: 600; font-size: 13px; color: #666; border-bottom: 2px solid #eee; }
.icons-table-row { display: grid; grid-template-columns: 100px 1fr 280px; gap: 16px; padding: 12px 16px; border-bottom: 1px solid #f5f5f5; align-items: center; transition: background 0.2s; }
.icons-table-row:hover { background: #f9f9f9; }
.icons-table-row.modified { background: #fff9e6; }
.icons-table-row.modified:hover { background: #fff5d6; }
.icon-col-preview { display: flex; align-items: center; justify-content: center; }
.icon-preview-cell { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 32px; background: #f5f5f5; border-radius: 8px; }
.icon-col-location { display: flex; flex-direction: column; gap: 4px; }
.icon-location-text { font-size: 14px; color: #333; font-weight: 500; }
.icon-code-small { font-size: 11px; color: #888; font-family: monospace; }
.icon-col-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Icon Edit Modal */
.icon-edit-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10000; display: flex; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s; }
.icon-edit-modal.active { opacity: 1; }
.icon-edit-modal .modal-content { background: #fff; border-radius: 16px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto; }
.icon-edit-preview { text-align: center; padding: 20px; background: #f5f5f5; border-radius: 8px; margin-bottom: 20px; }
.icon-preview-large { font-size: 64px; min-height: 80px; display: flex; align-items: center; justify-content: center; }
.icon-preview-large img { max-width: 100%; max-height: 80px; object-fit: contain; }

@media (max-width: 768px) {
  .icons-table-header, .icons-table-row { grid-template-columns: 80px 1fr; gap: 12px; }
  .icon-col-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .site-subtabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Dynamic Icons */
.icon-img { width: 1em; height: 1em; display: inline-block; vertical-align: middle; object-fit: contain; }
.btn .icon-img { width: 16px; height: 16px; }
.tab .icon-img { width: 14px; height: 14px; }
.chat-header .icon-img { width: 20px; height: 20px; }

/* iOS-style Emoji (Twemoji) */
.emoji-ios { height: 1.2em; width: 1.2em; margin: 0 0.05em 0 0.1em; vertical-align: -0.2em; display: inline-block; }
.chat-name .emoji-ios { height: 1em; width: 1em; }
.msg-text .emoji-ios { height: 1.3em; width: 1.3em; }
.avatar .emoji-ios { height: 1.5em; width: 1.5em; }
.btn .emoji-ios { height: 1em; width: 1em; }
.tab .emoji-ios { height: 1em; width: 1em; }

/* Системные сообщения о звонках */
.message.system-message {
  background: transparent;
  box-shadow: none;
  text-align: center;
  margin: 8px auto;
  max-width: 300px;
}

.message.system-message .msg-text {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 8px 16px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  display: inline-block;
}

/* Компактное модальное окно звонка */
.call-mini-modal {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 320px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  z-index: 999999 !important;
  animation: slideInRight 0.3s ease-out;
  pointer-events: auto;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.call-mini-modal.outgoing {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.call-mini-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.call-mini-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.call-mini-avatar .avatar {
  width: 100%;
  height: 100%;
}

.call-mini-info {
  flex: 1;
  min-width: 0;
}

.call-mini-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-mini-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
}

.call-mini-timer {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  text-align: center;
  margin-bottom: 16px;
}

.call-mini-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.call-mini-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-mini-btn.accept {
  background: #4caf50;
}

.call-mini-btn.reject {
  background: #f44336;
}

.call-mini-btn.end {
  background: #f44336;
}

.call-mini-btn:hover {
  transform: scale(1.1);
}

.call-mini-btn:active {
  transform: scale(0.95);
}

/* Пульсация для входящего звонка */
.call-mini-modal.incoming .call-mini-avatar {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
  }
}

/* Мобильная адаптация */
@media (max-width: 768px) {
  .call-mini-modal {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
  }
}


/* VPN Management Panel */
.vpn-panel { padding: 10px 0; }

.vpn-info-card {
  background: linear-gradient(135deg, #667eea20, #764ba220);
  border: 1px solid #667eea40;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.vpn-info-card h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}

.vpn-info-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.vpn-info-row:last-child {
  border-bottom: none;
}

.vpn-label {
  font-weight: 600;
  color: #666;
  min-width: 80px;
  font-size: 13px;
}

.vpn-value {
  color: #333;
  font-size: 13px;
  display: flex;
  align-items: center;
}

.vpn-link {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.vpn-link:hover {
  text-decoration: underline;
}

.vpn-inbounds-section {
  margin-top: 20px;
}

.vpn-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.vpn-section-header h3 {
  margin: 0;
  font-size: 16px;
  color: #333;
}

.vpn-inbounds-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vpn-inbound-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
  transition: box-shadow 0.2s;
}

.vpn-inbound-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.vpn-inbound-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f5f5f5;
}

.vpn-inbound-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vpn-inbound-protocol {
  background: #667eea;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.vpn-inbound-remark {
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.vpn-inbound-actions {
  display: flex;
  gap: 6px;
}

.vpn-inbound-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.vpn-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vpn-info-label {
  font-size: 11px;
  color: #888;
  font-weight: 500;
}

.vpn-info-value {
  font-size: 13px;
  color: #333;
  font-weight: 600;
}

.status-active {
  color: #4caf50 !important;
}

.status-inactive {
  color: #f44336 !important;
}

.vpn-clients-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f5f5f5;
}

.vpn-clients-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
}

.vpn-clients-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vpn-client-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f9f9f9;
  border-radius: 8px;
  font-size: 12px;
}

.vpn-client-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vpn-client-email {
  font-weight: 600;
  color: #333;
}

.vpn-client-id {
  color: #888;
  font-size: 11px;
  font-family: monospace;
}

@media (max-width: 768px) {
  .vpn-inbound-info {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .vpn-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .vpn-section-header .btn {
    width: 100%;
  }
}

/* Upload progress for multiple files */
.upload-wrap { padding: 10px; background: #f8f9fa; border-radius: 8px; margin-bottom: 10px; max-height: 200px; overflow-y: auto; }
.upload-item { margin-bottom: 8px; padding: 8px; background: #fff; border-radius: 6px; }
.upload-item:last-child { margin-bottom: 0; }
.upload-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 13px; }
.upload-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #333; font-weight: 500; }
.upload-percent { color: #667eea; font-weight: 600; margin-left: 10px; min-width: 40px; text-align: right; }
.upload-bar-bg { height: 4px; background: #e0e0e0; border-radius: 2px; overflow: hidden; }
.upload-bar { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); transition: width 0.3s ease; border-radius: 2px; }

/* Attached files preview */
.attached-files { display: flex; flex-direction: column; gap: 8px; }
.attached-file-item { display: flex; align-items: center; padding: 8px; background: #f8f9fa; border-radius: 8px; gap: 10px; }
.attached-file-item .file-icon { font-size: 24px; }
.attached-file-item .file-info { flex: 1; min-width: 0; }
.attached-file-item .file-name { font-size: 13px; font-weight: 500; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attached-file-item .file-size { font-size: 11px; color: #888; }
.attached-file-item .file-remove { background: none; border: none; font-size: 18px; color: #999; cursor: pointer; padding: 4px 8px; }
.attached-file-item .file-remove:hover { color: #f44336; }

/* Message highlight animation */
.message-highlight {
  background: rgba(102, 126, 234, 0.25) !important;
  transition: background 0.3s ease;
}

@keyframes messageHighlight {
  0% { 
    background: rgba(102, 126, 234, 0.4);
    transform: scale(1.02);
  }
  50% { 
    background: rgba(102, 126, 234, 0.3);
  }
  100% { 
    background: rgba(102, 126, 234, 0);
    transform: scale(1);
  }
}

.message-highlight {
  animation: messageHighlight 2s ease-out;
}

/* Services page styles */
.services-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.services-container {
  max-width: 1200px;
  width: 100%;
}

.services-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  color: white;
}

.services-header h1 {
  font-size: 32px;
  margin: 0;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.service-card {
  background: white;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.service-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.service-name {
  font-size: 24px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.service-desc {
  font-size: 14px;
  color: #666;
}

/* Cinema page styles */
.cinema-screen {
  min-height: 100vh;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
}

.cinema-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.cinema-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(0,0,0,0.5);
  color: white;
  backdrop-filter: blur(10px);
}

.cinema-header h1 {
  font-size: 24px;
  margin: 0;
  flex: 1;
  text-align: center;
}

.cinema-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.cinema-placeholder {
  text-align: center;
  color: white;
}

.cinema-icon {
  font-size: 120px;
  margin-bottom: 24px;
  opacity: 0.5;
}

.cinema-placeholder h2 {
  font-size: 32px;
  margin: 0 0 16px 0;
}

.cinema-placeholder p {
  font-size: 18px;
  opacity: 0.7;
}

@media (max-width: 768px) {
  .services-header h1 {
    font-size: 24px;
  }
  
  .services-grid {
    grid-template-columns: 1fr;
  }
  
  .cinema-icon {
    font-size: 80px;
  }
  
  .cinema-placeholder h2 {
    font-size: 24px;
  }
}
