/**
 * ====================================================
 * МЕССЕНДЖЕР - ПОЛНАЯ ВЕРСИЯ CSS
 * ====================================================
 */

/* Блок 1: Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0a0a0a;
    color: #fff;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

#app {
    height: 100vh;
    width: 100vw;
    display: block;
}

/* Блок 2: Экраны */
.screen {
    display: none !important;
    height: 100%;
    width: 100%;
}

.screen.active {
    display: block !important;
}

/* Блок 3: Экран авторизации */
#auth-screen {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#auth-screen:not(.active) {
    display: none !important;
}

#auth-screen.active {
    display: flex !important;
}

.auth-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.auth-container h1 {
    margin-bottom: 30px;
    font-size: 28px;
    color: #fff;
}

.phone-input {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #ff4444;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.3s;
    color: #333;
}

.phone-input.valid {
    border-color: #44ff44;
}

.auth-button {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.auth-button:not(:disabled) {
    opacity: 1;
}

.auth-button:disabled {
    cursor: not-allowed;
}

.auth-phone {
    font-size: 24px;
    font-weight: bold;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
}

.timer {
    font-size: 48px;
    font-weight: bold;
    margin: 20px 0;
    color: #ffaa00;
}

/* Блок 4: Основной интерфейс чата */
#chat-screen {
    display: none !important;
    height: 100vh;
    width: 100vw;
    background: #1a1a1a;
}

#chat-screen.active {
    display: block !important;
}

.chat-container {
    display: flex !important;
    height: 100vh;
    width: 100%;
    background: #1a1a1a;
}

/* Блок 5: Левая панель (сайдбар) */
.sidebar {
    width: 350px;
    background: #2d2d2d;
    border-right: 1px solid #404040;
    display: flex !important;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.search-container {
    padding: 15px;
    border-bottom: 1px solid #404040;
    display: flex !important;
    gap: 10px;
    background: #2d2d2d;
}

.search-container input {
    flex: 1;
    padding: 10px;
    border: 1px solid #404040;
    border-radius: 5px;
    background: #3d3d3d;
    color: #fff;
    font-size: 14px;
}

.search-container input::placeholder {
    color: #999;
}

.search-container button {
    padding: 10px 20px;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.search-container button:hover {
    background: #0099ee;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    display: block !important;
    background: #2d2d2d;
}

.contact-item {
    padding: 15px;
    border-bottom: 1px solid #404040;
    cursor: pointer;
    transition: all 0.2s ease;
    display: block !important;
    position: relative;
}

.contact-item:hover {
    background: #404040;
}

.contact-item.active {
    background: #0088cc;
}

.contact-item.selected {
    background: #0088cc;
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,136,204,0.3);
}

.contact-item.selected .contact-name,
.contact-item.selected .contact-phone {
    color: white;
}

.contact-name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.contact-phone {
    font-size: 12px;
    color: #999;
}

.contact-item.active .contact-phone {
    color: rgba(255, 255, 255, 0.8);
}

.contact-status {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 8px;
}

.contact-status.online {
    background: #44ff44;
    box-shadow: 0 0 5px #44ff44;
}

.contact-status.offline {
    background: #999;
}

.contact-status.blocked {
    background: #ff4444;
    box-shadow: 0 0 5px #ff4444;
}

/* Блок 6: Правая панель (чат) */
.main-chat {
    flex: 1;
    display: flex !important;
    flex-direction: column;
    background: #1a1a1a;
    height: 100vh;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #404040;
    background: #2d2d2d;
    position: relative;
}

.chat-header h2 {
    font-size: 18px;
    color: #fff;
    margin: 0;
}

.search-messages {
    padding: 10px 20px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    display: flex !important;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #404040;
    border-radius: 5px;
    background: #3d3d3d;
    color: #fff;
    width: 120px;
    font-size: 13px;
}

.date-input::placeholder {
    color: #999;
}

.calendar-icon {
    cursor: pointer;
    font-size: 18px;
    color: #fff;
}

#message-search {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #404040;
    border-radius: 5px;
    background: #3d3d3d;
    color: #fff;
    font-size: 13px;
}

#message-search::placeholder {
    color: #999;
}

#message-search-btn {
    padding: 8px 15px;
    background: #0088cc;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#message-search-btn:hover {
    background: #0099ee;
}

/* Блок 7: Сообщения */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    background: #1a1a1a;
}

.message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    display: block !important;
    margin-bottom: 5px;
}

.message.outgoing {
    align-self: flex-end;
    background: #0088cc;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.incoming {
    align-self: flex-start;
    background: #2d2d2d;
    color: #fff;
    border-bottom-left-radius: 4px;
}

.message.blocked {
    background: #cc0000;
    opacity: 0.7;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 5px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}

.message-status {
    font-size: 12px;
}

/* Блок 8: Поле ввода сообщений */
.message-input-container {
    padding: 20px;
    background: #2d2d2d;
    border-top: 1px solid #404040;
    display: flex !important;
    gap: 10px;
    align-items: center;
    position: relative;
}

#message-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #404040;
    border-radius: 25px;
    background: #3d3d3d;
    color: #fff;
    outline: none;
    font-size: 14px;
}

#message-input::placeholder {
    color: #999;
}

#message-input:focus {
    border-color: #0088cc;
}

#message-input.blocked {
    border-color: #cc0000;
    opacity: 0.5;
}

.emoji-btn, .attach-btn, #send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #3d3d3d;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.emoji-btn:hover, .attach-btn:hover, #send-btn:hover {
    background: #4d4d4d;
}

#send-btn {
    background: #0088cc;
}

#send-btn:hover {
    background: #0099ee;
}

#send-btn.blocked {
    background: #cc0000;
    cursor: not-allowed;
}

/* Блок 9: Выпадающие меню */
.emoji-picker {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 10px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

.emoji-picker span {
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    text-align: center;
}

.emoji-picker span:hover {
    background: #404040;
}

.attach-menu {
    position: absolute;
    bottom: 80px;
    right: 70px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 10px;
    padding: 5px;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    min-width: 150px;
}

.attach-menu button {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background: none;
    border: none;
    color: #fff;
    text-align: left;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14px;
}

.attach-menu button:hover {
    background: #404040;
}

/* Блок 10: Кнопка прокрутки */
.scroll-bottom {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #0088cc;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    z-index: 100;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.scroll-bottom:hover {
    background: #0099ee;
}

/* Блок 11: Календарь */
.calendar-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 10px;
    padding: 20px;
    z-index: 2000;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    display: none;
}

.calendar-popup[style*="display: block"] {
    display: block !important;
}

.calendar-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-header button {
    background: #3d3d3d;
    border: 1px solid #404040;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
}

.calendar-header button:hover {
    background: #4d4d4d;
}

#current-month {
    color: #fff;
    font-weight: bold;
}

.calendar-days {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-days div {
    width: 35px;
    height: 35px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 5px;
    color: #fff;
}

.calendar-days div:hover {
    background: #404040;
}

.calendar-weekday {
    color: #999 !important;
    font-weight: bold;
    cursor: default !important;
}

.calendar-weekday:hover {
    background: transparent !important;
}

/* Блок 12: Drag & Drop */
.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,136,204,0.3);
    border: 3px dashed #0088cc;
    z-index: 9999;
    display: none;
    pointer-events: none;
}

.drag-overlay.active {
    display: block !important;
}

/* Блок 13: Адаптивность */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-chat {
        width: 100%;
    }
    
    .message {
        max-width: 85%;
    }
    
    .search-messages {
        flex-wrap: wrap;
    }
    
    .date-input {
        width: calc(50% - 25px);
    }
}

/* Блок 14: Админ-панель */
.admin-toggle {
    padding: 10px 15px;
    margin: 10px;
    background: #2d2d2d;
    border: 1px solid #0088cc;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.admin-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.admin-panel {
    padding: 15px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
}

.admin-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.admin-btn {
    padding: 8px 15px;
    background: #3d3d3d;
    border: 1px solid #404040;
    border-radius: 5px;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.admin-btn:hover {
    background: #4d4d4d;
    border-color: #0088cc;
}

.admin-btn.primary {
    background: #0088cc;
    border-color: #0088cc;
}

.admin-btn.primary:hover {
    background: #0099ee;
}

.admin-btn.danger {
    background: #cc0000;
    border-color: #cc0000;
}

.admin-btn.danger:hover {
    background: #dd0000;
}

.admin-btn.warning {
    background: #ffaa00;
    border-color: #ffaa00;
    color: #000;
}

.admin-btn.warning:hover {
    background: #ffbb22;
}

/* Блок 15: Список пользователей в админке */
.admin-users-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #404040;
    border-radius: 5px;
    background: #1a1a1a;
    margin-top: 10px;
}

.admin-user-item {
    padding: 10px 15px;
    border-bottom: 1px solid #404040;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.admin-user-item:hover {
    background: #2d2d2d;
}

.admin-user-item:last-child {
    border-bottom: none;
}

.admin-user-info {
    flex: 1;
}

.admin-user-name {
    font-weight: bold;
    color: #fff;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-user-phone {
    font-size: 12px;
    color: #999;
}

.admin-user-role {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    background: #3d3d3d;
    color: #fff;
    display: inline-block;
}

.admin-user-role.admin {
    background: #0088cc;
}

.admin-user-role.user {
    background: #666;
}

.admin-user-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-user-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-block;
}

.admin-user-status.active {
    background: #44ff44;
    box-shadow: 0 0 5px #44ff44;
}

.admin-user-status.inactive {
    background: #ff4444;
    box-shadow: 0 0 5px #ff4444;
}

.admin-user-edit, .admin-user-delete {
    cursor: pointer;
    font-size: 16px;
    padding: 3px;
    border-radius: 3px;
    transition: background 0.2s;
}

.admin-user-edit:hover {
    background: #0088cc;
}

.admin-user-delete:hover {
    background: #cc0000;
}

/* Блок 16: Модальные окна */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.85) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
}

.modal {
    background: #2d2d2d !important;
    border-radius: 16px !important;
    padding: 30px !important;
    width: 90% !important;
    max-width: 400px !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5) !important;
    position: relative !important;
    z-index: 1000000 !important;
    animation: modalAppear 0.3s ease !important;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal h3 {
    color: #fff !important;
    margin-bottom: 20px !important;
    font-size: 20px !important;
    text-align: center !important;
}

.modal p {
    color: #ddd !important;
    margin-bottom: 30px !important;
    line-height: 1.6 !important;
    text-align: center !important;
    font-size: 15px !important;
}

.modal strong {
    color: #0088cc !important;
    font-size: 16px !important;
}

.modal input, .modal select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #404040;
    border-radius: 6px;
    background: #3d3d3d;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s;
}

.modal input:focus, .modal select:focus {
    outline: none;
    border-color: #0088cc;
}

.modal input[readonly] {
    background: #2d2d2d;
    color: #999;
    cursor: not-allowed;
}

.modal label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    margin-bottom: 15px;
    cursor: pointer;
    font-size: 14px;
}

.modal input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.modal-buttons {
    display: flex !important;
    gap: 15px !important;
    justify-content: center !important;
    margin-top: 20px;
}

.modal-btn {
    padding: 12px 30px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    flex: 1 !important;
    max-width: 120px !important;
}

.modal-btn.cancel {
    background: #3d3d3d !important;
    color: #fff !important;
}

.modal-btn.cancel:hover {
    background: #4d4d4d !important;
}

.modal-btn.save {
    background: #0088cc !important;
    color: #fff !important;
}

.modal-btn.save:hover {
    background: #0099ee !important;
}

.modal-btn.delete {
    background: #cc0000 !important;
    color: #fff !important;
}

.modal-btn.delete:hover {
    background: #dd0000 !important;
}

/* Блок 17: Контекстное меню */
#contact-context-menu {
    position: fixed;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    font-size: 14px;
}

.context-menu-item:hover {
    background: #404040;
}

.context-menu-item.delete {
    color: #ff4444;
}

.context-menu-item.delete:hover {
    background: #ff4444;
    color: #fff;
}

.context-menu-divider {
    height: 1px;
    background: #404040;
    margin: 8px 0;
}

/* Блок 18: Уведомления */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Блок 19: Чекбоксы для выбора пользователей */
.user-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-right: 10px;
}

.selection-mode .contact-item {
    padding-left: 40px;
    position: relative;
}

.selection-mode .contact-item::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border: 2px solid #0088cc;
    border-radius: 3px;
    background: transparent;
}

.selection-mode .contact-item.selected::before {
    background: #0088cc;
    content: '✓';
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Блок 20: Переключатель темы */
#theme-toggle {
    position: absolute;
    top: 15px;
    right: 20px;
    cursor: pointer;
    font-size: 24px;
    z-index: 100;
    background: rgba(255,255,255,0.1);
    border-radius: 30px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.3s ease;
}

#theme-toggle:hover {
    background: rgba(255,255,255,0.2);
}

/* Блок 21: Светлая тема */
body.light-theme {
    background: #f5f5f5;
    color: #333;
}

body.light-theme #chat-screen {
    background: #f5f5f5;
}

body.light-theme .chat-container {
    background: #f5f5f5;
}

body.light-theme .sidebar {
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
}

body.light-theme .search-container {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .search-container input {
    background: #f5f5f5;
    border: 1px solid #dddddd;
    color: #333333;
}

body.light-theme .search-container input::placeholder {
    color: #999999;
}

body.light-theme .search-container button {
    background: #0088cc;
    color: white;
}

body.light-theme .contacts-list {
    background: #ffffff;
}

body.light-theme .contact-item {
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .contact-item:hover {
    background: #f5f5f5;
}

body.light-theme .contact-item.active {
    background: #0088cc;
    color: white;
}

body.light-theme .contact-name {
    color: #333333;
}

body.light-theme .contact-item.active .contact-name {
    color: white;
}

body.light-theme .contact-phone {
    color: #666666;
}

body.light-theme .contact-item.active .contact-phone {
    color: rgba(255, 255, 255, 0.8);
}

body.light-theme .main-chat {
    background: #f5f5f5;
}

body.light-theme .chat-header {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .chat-header h2 {
    color: #333333;
}

body.light-theme .search-messages {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .date-input {
    background: #f5f5f5;
    border: 1px solid #dddddd;
    color: #333333;
}

body.light-theme .date-input::placeholder {
    color: #999999;
}

body.light-theme .calendar-icon {
    color: #666666;
}

body.light-theme #message-search {
    background: #f5f5f5;
    border: 1px solid #dddddd;
    color: #333333;
}

body.light-theme #message-search::placeholder {
    color: #999999;
}

body.light-theme .messages-container {
    background: #f5f5f5;
}

body.light-theme .message.incoming {
    background: #ffffff;
    color: #333333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

body.light-theme .message.outgoing {
    background: #0088cc;
    color: #ffffff;
}

body.light-theme .message-input-container {
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
}

body.light-theme #message-input {
    background: #f5f5f5;
    border: 1px solid #dddddd;
    color: #333333;
}

body.light-theme #message-input::placeholder {
    color: #999999;
}

body.light-theme .emoji-btn, 
body.light-theme .attach-btn {
    background: #f5f5f5;
    color: #333333;
}

body.light-theme .emoji-btn:hover, 
body.light-theme .attach-btn:hover {
    background: #e0e0e0;
}

body.light-theme #send-btn {
    background: #0088cc;
    color: white;
}

body.light-theme .emoji-picker {
    background: #ffffff;
    border: 1px solid #dddddd;
}

body.light-theme .emoji-picker span {
    color: #333333;
}

body.light-theme .emoji-picker span:hover {
    background: #f5f5f5;
}

body.light-theme .attach-menu {
    background: #ffffff;
    border: 1px solid #dddddd;
}

body.light-theme .attach-menu button {
    color: #333333;
}

body.light-theme .attach-menu button:hover {
    background: #f5f5f5;
}

body.light-theme .scroll-bottom {
    background: #0088cc;
    color: white;
}

body.light-theme .calendar-popup {
    background: #ffffff;
    border: 1px solid #dddddd;
}

body.light-theme .calendar-header button {
    background: #f5f5f5;
    border: 1px solid #dddddd;
    color: #333333;
}

body.light-theme #current-month {
    color: #333333;
}

body.light-theme .calendar-days div {
    color: #333333;
}

body.light-theme .calendar-days div:hover {
    background: #f5f5f5;
}

body.light-theme .calendar-weekday {
    color: #999999 !important;
}

body.light-theme .admin-panel {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .admin-toggle {
    background: #ffffff;
    border: 1px solid #0088cc;
    color: #333333;
}

body.light-theme .admin-toggle label {
    color: #333333;
}

body.light-theme .admin-btn {
    background: #f5f5f5;
    border: 1px solid #dddddd;
    color: #333333;
}

body.light-theme .admin-btn.primary {
    background: #0088cc;
    color: white;
    border-color: #0088cc;
}

body.light-theme .admin-btn.warning {
    background: #ffaa00;
    color: black;
    border-color: #ffaa00;
}

body.light-theme .admin-btn.danger {
    background: #cc0000;
    color: white;
    border-color: #cc0000;
}

body.light-theme .admin-users-list {
    background: #f5f5f5;
    border: 1px solid #dddddd;
}

body.light-theme .admin-user-item {
    border-bottom: 1px solid #e0e0e0;
}

body.light-theme .admin-user-item:hover {
    background: #e0e0e0;
}

body.light-theme .admin-user-name {
    color: #333333;
}

body.light-theme .admin-user-phone {
    color: #666666;
}

body.light-theme .admin-user-role {
    background: #dddddd;
    color: #333333;
}

body.light-theme .admin-user-role.admin {
    background: #0088cc;
    color: white;
}

body.light-theme .modal {
    background: #ffffff !important;
}

body.light-theme .modal h3 {
    color: #333333 !important;
}

body.light-theme .modal p {
    color: #666666 !important;
}

body.light-theme .modal strong {
    color: #0088cc !important;
}

body.light-theme .modal input,
body.light-theme .modal select {
    background: #f5f5f5;
    border: 1px solid #dddddd;
    color: #333333;
}

body.light-theme .modal label {
    color: #333333;
}

body.light-theme .modal-btn.cancel {
    background: #e0e0e0 !important;
    color: #333333 !important;
}

body.light-theme .modal-btn.cancel:hover {
    background: #cccccc !important;
}

body.light-theme #contact-context-menu {
    background: #ffffff;
    border: 1px solid #dddddd;
}

body.light-theme .context-menu-item {
    color: #333333;
}

body.light-theme .context-menu-item:hover {
    background: #f5f5f5;
}

body.light-theme .context-menu-item.delete {
    color: #cc0000;
}

body.light-theme .context-menu-item.delete:hover {
    background: #cc0000;
    color: white;
}

body.light-theme #theme-toggle {
    background: rgba(0,0,0,0.1);
}

body.light-theme #theme-toggle:hover {
    background: rgba(0,0,0,0.2);
}

/* Блок 22: Гарантированное отображение переключателя темы */
#theme-toggle {
    position: absolute !important;
    top: 15px !important;
    right: 20px !important;
    cursor: pointer !important;
    font-size: 24px !important;
    z-index: 1000 !important;
    background: rgba(255,255,255,0.1) !important;
    border-radius: 30px !important;
    padding: 5px 10px !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    transition: background 0.3s ease !important;
}

#theme-toggle:hover {
    background: rgba(255,255,255,0.2) !important;
}

/* Убедимся что chat-header имеет position relative */
.chat-header {
    position: relative !important;
}

/* Блок 23: Мобильное меню */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

.mobile-sidebar-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
}

.mobile-sidebar-modal .sidebar {
    width: 80%;
    max-width: 350px;
    height: 100%;
    background: #2d2d2d;
    display: flex !important;
    flex-direction: column;
    animation: slideIn 0.3s ease;
}

#mobile-menu-btn {
    position: absolute;
    left: 15px;
    top: 15px;
    font-size: 24px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    z-index: 1000;
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    transition: background 0.2s;
}

#mobile-menu-btn:hover {
    background: rgba(255,255,255,0.2);
}

#back-btn {
    position: absolute;
    left: 15px;
    top: 15px;
    font-size: 24px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    z-index: 1000;
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    transition: background 0.2s;
}

#back-btn:hover {
    background: rgba(255,255,255,0.2);
}

@media (max-width: 768px) {
    #mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #back-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        display: none !important;
    }
    
    .chat-header h2 {
        margin-left: 50px;
        margin-right: 50px;
        text-align: center;
    }
}
/* Блок 24: Выпадающее меню пользователя */
.welcome-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.welcome-text {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.welcome-text:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.welcome-text:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    color: #fff;
}

.dropdown-item:hover {
    background: #404040;
}

.dropdown-icon {
    font-size: 16px;
}

/* Светлая тема для выпадающего меню */
body.light-theme .dropdown-menu {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .dropdown-item {
    color: #333;
}

body.light-theme .dropdown-item:hover {
    background: #f5f5f5;
}

body.light-theme .welcome-text:hover {
    background: rgba(0, 0, 0, 0.05);
}
/* Блок 24: Выпадающее меню пользователя */
.welcome-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.welcome-text {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.welcome-text:hover {
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

.welcome-text:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    min-width: 150px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    color: #fff;
}

.dropdown-item:hover {
    background: #404040;
}

.dropdown-icon {
    font-size: 16px;
}

/* Светлая тема для выпадающего меню */
body.light-theme .dropdown-menu {
    background: #ffffff;
    border: 1px solid #e0e0e0;
}

body.light-theme .dropdown-item {
    color: #333;
}

body.light-theme .dropdown-item:hover {
    background: #f5f5f5;
}

body.light-theme .welcome-text:hover {
    background: rgba(0, 0, 0, 0.05);
}
