/* Темная тема - Telegram стиль с оранжевыми акцентами */
:root {
    --primary-orange: #ff6b35;
    --dark-orange: #e55a2b;
    --light-orange: #ff8c5a;
    --accent-orange: #ff8c42;
    --dark-black: #000000;
    --dark-gray: #0a0a0a;
    --medium-gray: #1a1a1a;
    --light-gray: #2a2a2a;
    --text-light: #ffffff;
    --text-gray: #b0b0b0;
    --border-color: #2a2a2a;
    --hover-bg: #1e1e1e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Arial', 'Helvetica', sans-serif;
    background: var(--dark-black);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .auth-box {
        max-width: 95%;
        padding: 30px 20px;
    }
    
    .main-container {
        /* На телефоне показываем либо список чатов, либо чат (как Telegram) */
        flex-direction: row;
        position: relative;
    }
    
    .sidebar {
        width: 100%;
        height: 100vh;
        max-height: none;
        position: absolute;
        inset: 0;
        transform: translateX(0);
        transition: transform 0.25s ease;
        z-index: 10;
    }
    
    .chat-area {
        width: 100%;
        height: 100vh;
        position: absolute;
        inset: 0;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 11;
    }

    /* Переключение в режим чата на мобильных */
    #main-screen.mobile-show-chat .sidebar {
        transform: translateX(-100%);
    }

    #main-screen.mobile-show-chat .chat-area {
        transform: translateX(0);
    }

    /* Кнопка "назад" в шапке чата на мобильных */
    .btn-back {
        width: 38px;
        height: 38px;
        background: transparent;
        border: 1px solid var(--border-color);
        border-radius: 10px;
        color: var(--text-light);
        font-size: 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        flex-shrink: 0;
    }

    .btn-back:hover {
        background: var(--hover-bg);
        border-color: var(--primary-orange);
        color: var(--primary-orange);
    }

    .btn-back:active {
        transform: scale(0.96);
    }
    
    .message-input-container {
        padding: 8px;
    }
    
    .message-input-box {
        gap: 6px;
    }
    
    .message-input-box input {
        margin: 0 4px;
    }
    
    .btn-send, .btn-voice, .btn-attach, .btn-emoji {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .chat-header {
        padding: 12px 12px;
    }
    
    .chat-header-content {
        font-size: 16px;
    }
    
    .chat-menu-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .auth-box {
        padding: 20px 15px;
    }
    
    .message-input-box input {
        font-size: 14px;
        padding: 8px 10px;
        margin: 0 2px;
    }
    
    .chat-item {
        padding: 10px;
    }
    
    .chat-item-avatar {
        width: 40px;
        height: 40px;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .chat-menu {
        right: 10px;
        min-width: 170px;
    }
}

/* Контейнер авторизации */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: var(--dark-black);
    position: relative;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 107, 53, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 140, 90, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.auth-box {
    background: var(--medium-gray) !important;
    background-color: var(--medium-gray) !important;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px 50px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
    margin: 20px;
}

.auth-box .auth-header {
    background: transparent !important;
    background-color: transparent !important;
}

.auth-box .auth-tabs {
    background: transparent !important;
    background-color: transparent !important;
}

.auth-box .auth-form {
    background: transparent !important;
    background-color: transparent !important;
}

.auth-box .form-group {
    background: transparent !important;
    background-color: transparent !important;
}

.auth-box .checkbox-group {
    background: transparent !important;
    background-color: transparent !important;
}

.auth-box .checkbox-label {
    background: transparent !important;
    background-color: transparent !important;
}

.auth-box label {
    background: transparent !important;
    background-color: transparent !important;
}

.auth-box span {
    background: transparent !important;
    background-color: transparent !important;
}

.auth-box .btn-primary {
    background: var(--primary-orange) !important;
    background-color: var(--primary-orange) !important;
}

.auth-box .form-control {
    background: var(--dark-gray) !important;
    background-color: var(--dark-gray) !important;
}

.auth-box::-webkit-scrollbar {
    width: 4px;
}

.auth-box::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.3);
    border-radius: 3px;
}

.auth-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.5);
}

.auth-box::before {
    display: none;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.military-logo {
    color: var(--primary-orange);
}

.emblem-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px var(--primary-orange));
}

.military-logo i {
    font-size: 48px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--primary-orange);
    display: none;
}

.military-logo h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 10px 0;
    color: var(--text-light);
}

.subtitle {
    font-size: 14px;
    color: var(--text-gray);
    letter-spacing: 0.5px;
}

/* Вкладки */
.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.tab-btn {
    flex: 1;
    padding: 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-gray);
    cursor: pointer;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s;
    border-radius: 0;
}

.tab-btn:hover {
    color: var(--text-light);
    background: var(--hover-bg);
}

.tab-btn.active {
    background: transparent;
    border-bottom: 2px solid var(--primary-orange);
    color: var(--primary-orange);
    box-shadow: none;
}

/* Формы */
.auth-form {
    display: none;
    background: transparent !important;
    background-color: transparent !important;
}

.auth-form.active {
    display: block;
    background: transparent !important;
    background-color: transparent !important;
}

.form-group {
    margin-bottom: 20px;
    background: transparent !important;
    background-color: transparent !important;
    padding: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-gray);
    font-weight: 500;
    font-size: 14px;
    text-transform: none;
    letter-spacing: 0;
}

.form-group label i {
    margin-right: 8px;
    color: var(--primary-orange);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 15px;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-orange);
    background: var(--light-gray);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

.checkbox-group {
    margin: 15px 0;
    background: transparent !important;
    padding: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    text-transform: none;
    color: var(--text-gray);
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--primary-orange);
    flex-shrink: 0;
}

.checkbox-label:hover {
    color: var(--text-light);
}

/* Кнопки */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-orange) !important;
    background-color: var(--primary-orange) !important;
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    font-weight: 600;
    font-size: 15px;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: none;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.btn-primary:hover {
    background: var(--light-orange) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    background: var(--dark-orange) !important;
}

.btn-primary i {
    margin-right: 10px;
}

/* Главный контейнер */
.main-container {
    display: flex;
    height: 100vh;
    background: var(--dark-black);
}

/* Боковая панель */
.sidebar {
    width: 350px;
    background: var(--medium-gray);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 20px;
    background: var(--medium-gray);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    height: 70px;
    box-sizing: border-box;
}

.military-badge {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--primary-orange);
}

.military-badge i {
    font-size: 32px;
    text-shadow: 0 0 10px var(--primary-orange);
}

.military-badge h2 {
    font-size: 20px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.search-container {
    padding: 15px;
    background: var(--medium-gray);
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-box i {
    color: var(--text-gray);
    font-size: 18px;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

.btn-search {
    padding: 8px 12px;
    background: var(--primary-orange);
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    font-weight: 600;
    font-size: 12px;
    text-transform: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 55px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-search i {
    font-size: 12px;
    color: var(--dark-black);
    margin-right: -2px;
}

.btn-search:hover {
    background: var(--light-orange);
    transform: scale(1.02);
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-item {
    padding: 15px;
    margin-bottom: 5px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-item:hover {
    background: var(--hover-bg);
}

.chat-item.active {
    background: var(--hover-bg);
    border-left: 3px solid var(--primary-orange);
}

.chat-item-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
}

.chat-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.chat-item-name {
    font-weight: bold;
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.chat-item-preview {
    font-size: 13px;
    color: var(--text-gray);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-item-unread {
    display: inline-block;
    background: var(--primary-orange);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
}

/* Область чата */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--dark-black);
    height: 100vh;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    background: var(--medium-gray);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Кнопка "назад" (видимость управляется JS) */
.btn-back {
    display: none;
}

.chat-menu-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-menu-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}

.chat-menu-btn:active {
    transform: scale(0.95);
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-light);
    flex: 1;
}

.chat-header-content i {
    font-size: 20px;
    color: var(--primary-orange);
}

/* Меню чата */
.chat-menu {
    position: absolute;
    top: 70px;
    right: 20px;
    background: var(--medium-gray);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    min-width: 200px;
}

.chat-menu-item {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.chat-menu-item:hover {
    background: var(--hover-bg);
    color: var(--primary-orange);
}

.chat-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.chat-menu-item.muted {
    color: var(--primary-orange);
}

.chat-menu-item.muted i {
    color: var(--primary-orange);
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-orange);
    flex-shrink: 0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--dark-black);
}

.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-gray);
}

.empty-chat i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.message {
    margin-bottom: 15px;
    display: flex;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.own {
    justify-content: flex-end;
}

.message-content {
    max-width: 60%;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.message-body {
    flex: 1;
    padding: 12px 18px;
    border-radius: 10px;
    position: relative;
    word-wrap: break-word;
    min-width: 0;
}

.message.own .message-body {
    background: var(--primary-orange);
    color: var(--text-light);
    border: none;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.2);
}

.message.other .message-body {
    background: var(--medium-gray);
    color: var(--text-light);
    border: none;
}

.message-sender-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--dark-gray);
    border: 2px solid var(--primary-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.message-sender-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-sender-avatar i {
    font-size: 18px;
    color: var(--primary-orange);
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-orange);
    margin-bottom: 5px;
    text-transform: none;
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 5px;
}

.message-time {
    font-size: 11px;
    color: var(--text-gray);
    text-align: right;
}

.read-icon {
    font-size: 12px;
    margin-left: 2px;
}

.read-icon.read {
    color: #4fc3f7;
}

.read-icon.unread {
    color: var(--text-gray);
}

.message-input-container {
    padding: 15px 20px;
    background: var(--medium-gray);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    position: relative;
}

.message-input-box {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.message-input-box input {
    flex: 1;
    padding: 12px 18px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-light);
    font-size: 15px;
    margin: 0 5px;
}

.message-input-box input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.1);
}

.btn-send {
    width: 38px;
    height: 38px;
    background: var(--primary-orange);
    border: none;
    border-radius: 50%;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    flex-shrink: 0;
}

.btn-send:hover {
    background: var(--light-orange);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-send:active {
    transform: scale(0.95);
}

.btn-voice {
    width: 38px;
    height: 38px;
    background: var(--medium-gray);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-light);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-voice:hover {
    background: var(--light-gray);
    border-color: var(--primary-orange);
    transform: scale(1.05);
}

.btn-voice:active {
    transform: scale(0.95);
}

.btn-voice.recording {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
    animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 107, 53, 0);
    }
}

.voice-recording-indicator {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--medium-gray);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.voice-recording-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.voice-recording-animation {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 30px;
}

.voice-wave {
    width: 4px;
    background: var(--primary-orange);
    border-radius: 2px;
    animation: voice-wave-animation 1.2s infinite ease-in-out;
}

.voice-wave:nth-child(1) {
    height: 20px;
    animation-delay: 0s;
}

.voice-wave:nth-child(2) {
    height: 30px;
    animation-delay: 0.2s;
}

.voice-wave:nth-child(3) {
    height: 20px;
    animation-delay: 0.4s;
}

@keyframes voice-wave-animation {
    0%, 100% {
        transform: scaleY(0.5);
        opacity: 0.7;
    }
    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

#voice-recording-time {
    color: var(--text-light);
    font-size: 16px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.btn-cancel-voice {
    width: 32px;
    height: 32px;
    background: rgba(255, 107, 53, 0.2);
    border: 1px solid var(--primary-orange);
    border-radius: 50%;
    color: var(--primary-orange);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-cancel-voice:hover {
    background: var(--primary-orange);
    color: var(--text-light);
    transform: scale(1.1);
}

/* Скроллбар - скрыт, но функционален */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.5);
}

/* Для Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 53, 0.3) transparent;
}

/* Уведомления */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: rgba(196, 30, 58, 0.9);
    border: 2px solid var(--military-red);
    border-radius: 5px;
    color: white;
    font-weight: bold;
    z-index: 1000;
}

/* Красное оповещение о непрочитанном сообщении */
.unread-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(196, 30, 58, 0.95);
    border: 2px solid #c41e3a;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10001;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(196, 30, 58, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.unread-notification:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 25px rgba(196, 30, 58, 0.5);
}

.unread-notification-content {
    flex: 1;
}

.unread-notification-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 5px;
    color: white;
}

.unread-notification-preview {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.unread-notification-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.unread-notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}
    animation: notificationSlide 0.3s ease-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

@keyframes notificationSlide {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: rgba(255, 107, 53, 0.9);
    border-color: var(--primary-orange);
}

/* Кнопка настроек */
.btn-settings {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--primary-orange);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-settings:hover {
    background: var(--hover-bg);
    transform: rotate(90deg);
}

.sidebar-header {
    position: relative;
}

/* Модальное окно настроек */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: var(--medium-gray);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--medium-gray);
}

.modal-header h2 {
    color: var(--text-light);
    font-size: 18px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 28px;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-close:hover {
    background: var(--hover-bg);
    color: var(--text-light);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 20px;
}

.avatar-section {
    text-align: center;
    margin-bottom: 30px;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--dark-gray);
    border: 3px solid var(--primary-orange);
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--primary-orange);
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.2);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-upload-avatar {
    padding: 10px 20px;
    background: var(--primary-orange);
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-upload-avatar:hover {
    background: var(--light-orange);
}

.settings-actions {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-logout {
    padding: 12px;
    background: rgba(196, 30, 58, 0.8);
    border: 2px solid var(--military-red);
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.btn-logout:hover {
    background: rgba(196, 30, 58, 1);
    transform: scale(1.02);
}

/* Панель инструментов сообщений - удалена, кнопки теперь в message-input-box */

.btn-attach, .btn-emoji {
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-gray);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
    margin: 0;
}

.btn-attach:hover, .btn-emoji:hover {
    background: var(--hover-bg);
    color: var(--primary-orange);
    transform: scale(1.05);
}

/* Меню прикрепления файлов */
.attach-menu {
    position: fixed;
    background: var(--medium-gray);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    min-width: 150px;
}

.attach-menu button {
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.attach-menu button:hover {
    background: var(--hover-bg);
    color: var(--primary-orange);
}

/* Эмодзи панель */
.emoji-picker {
    position: fixed;
    background: var(--medium-gray);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    width: 350px;
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.emoji-picker::-webkit-scrollbar {
    width: 3px;
}

.emoji-picker::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.3);
    border-radius: 2px;
}

.emoji-picker::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.5);
}

.emoji-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
    align-content: flex-start;
}

.emoji-grid span {
    font-size: 20px;
    cursor: pointer;
    padding: 3px;
    text-align: center;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    line-height: 1;
}

.emoji-grid span:hover {
    background: var(--hover-bg);
    transform: scale(1.1);
}

/* Файлы в сообщениях */
.message-file {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Изображения */
.message-image {
    cursor: pointer;
    position: relative;
    display: inline-block;
    max-width: 350px;
    border-radius: 8px;
    overflow: hidden;
}

.message-image img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.message-image .file-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
    border-radius: 8px;
}

.message-image:hover .file-overlay {
    opacity: 1;
}

.message-image .file-overlay i {
    color: white;
    font-size: 24px;
}

/* Видео */
.message-video {
    position: relative;
    max-width: 400px;
}

.message-video video {
    width: 100%;
    max-height: 400px;
    border-radius: 8px;
    background: var(--dark-black);
    display: block;
}

.message-video video::-webkit-media-controls {
    background: rgba(0, 0, 0, 0.5);
}

.video-file-info {
    margin-top: 8px;
    padding: 8px 0;
    color: var(--text-light);
}

.video-file-info .file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 4px;
    word-break: break-word;
}

.video-file-info .file-size {
    font-size: 11px;
    color: var(--text-gray);
}

.message-video .file-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

/* Аудио */
.message-audio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--medium-gray);
    border-radius: 8px;
}

.message-audio audio {
    flex: 1;
    height: 40px;
}

.message-audio .file-info {
    min-width: 120px;
}

/* Голосовые сообщения - специальный стиль (как в Telegram) */
.message-audio.voice-message {
    padding: 10px 14px;
    background: var(--dark-gray);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    gap: 12px;
    max-width: 400px;
    cursor: default;
    display: flex;
    align-items: center;
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    background: var(--primary-orange);
    border: none;
    border-radius: 50%;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    outline: none;
}

.voice-play-btn:hover {
    background: var(--light-orange);
    transform: scale(1.1);
}

.voice-play-btn:active {
    transform: scale(0.95);
}

.voice-waveform-container {
    flex: 1;
    min-width: 0;
    height: 40px;
    display: flex;
    align-items: center;
    position: relative;
}

.voice-waveform {
    width: 100%;
    height: 40px;
    display: block;
}

.voice-duration {
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 70px;
    text-align: right;
}

.voice-audio {
    display: none;
}

/* Документы */
.message-document {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--medium-gray);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.message-document:hover {
    background: var(--light-gray);
}

.file-icon-large {
    font-size: 40px;
    color: var(--primary-orange);
    min-width: 40px;
}

.message-document .file-info {
    flex: 1;
    min-width: 0;
}

.message-document .file-name {
    font-weight: 600;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.message-document .file-size {
    font-size: 12px;
    color: var(--text-gray);
}

.message-document .file-actions {
    display: flex;
    gap: 8px;
}

/* Кнопки действий с файлами */
.btn-open, .btn-download {
    background: var(--primary-orange);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-open:hover, .btn-download:hover {
    background: var(--light-orange);
    transform: scale(1.05);
}

.btn-open i, .btn-download i {
    font-size: 12px;
}

.message-video .btn-download {
    background: rgba(255, 107, 53, 0.9);
    padding: 6px 10px;
    font-size: 12px;
}

.message-audio .btn-download {
    background: var(--primary-orange);
    padding: 6px 10px;
    font-size: 12px;
}

/* Модальное окно для просмотра файлов */
.file-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    cursor: pointer;
}

.modal-content-large {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
}

.modal-content-large img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
}

.btn-close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-footer {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-file-info {
    color: var(--text-light);
    font-size: 14px;
    text-align: center;
    margin-bottom: 10px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-file-info-large {
    color: var(--text-light);
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 10px;
}

.modal-content-audio {
    position: relative;
    background: var(--medium-gray);
    padding: 40px;
    border-radius: 12px;
    max-width: 500px;
    width: 90vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
}

.modal-audio-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.modal-footer .btn-download {
    background: var(--primary-orange);
    padding: 12px 24px;
    font-size: 16px;
}

/* Модальное окно для документов */
.modal-content-document {
    position: relative;
    background: var(--medium-gray);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    cursor: default;
    overflow: hidden;
}

.modal-document-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--dark-gray);
}

.document-viewer {
    flex: 1;
    width: 100%;
    border: none;
    background: white;
    min-height: 0;
    display: block;
}

/* Если PDF не загружается в iframe, показываем альтернативу */
.document-viewer[type="application/pdf"] {
    min-height: 600px;
}

.text-viewer {
    flex: 1;
    padding: 20px;
    background: var(--dark-black);
    color: var(--text-light);
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.modal-content-document .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--dark-gray);
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-content-document .btn-open {
    background: var(--primary-orange);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-content-document .btn-open:hover {
    background: var(--light-orange);
    transform: scale(1.05);
}

/* Модальное окно звонка */
.call-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.call-modal-content {
    width: 100%;
    max-width: 800px;
    height: 100%;
    max-height: 600px;
    background: var(--dark-black);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.call-header {
    padding: 20px;
    background: var(--medium-gray);
    border-bottom: 1px solid var(--border-color);
}

.call-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.call-user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 40px;
    border: 3px solid var(--primary-orange);
}

.call-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.call-user-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-light);
}

.call-status {
    font-size: 14px;
    color: var(--text-gray);
}

.call-video-container {
    flex: 1;
    position: relative;
    background: var(--dark-black);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#local-video {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: 150px;
    border-radius: 12px;
    border: 2px solid var(--primary-orange);
    object-fit: cover;
    background: var(--dark-gray);
}

.call-audio-only {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: var(--primary-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 60px;
}

.call-controls {
    padding: 20px;
    background: var(--medium-gray);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s;
    color: var(--text-light);
}

.call-btn-mute {
    background: var(--medium-gray);
    border: 2px solid var(--border-color);
}

.call-btn-mute:hover {
    background: var(--hover-bg);
    border-color: var(--primary-orange);
}

.call-btn-mute.muted {
    background: rgba(196, 30, 58, 0.8);
    border-color: rgba(196, 30, 58, 1);
}

.call-btn-video {
    background: var(--medium-gray);
    border: 2px solid var(--border-color);
}

.call-btn-video:hover {
    background: var(--hover-bg);
    border-color: var(--primary-orange);
}

.call-btn-video.disabled {
    background: rgba(196, 30, 58, 0.8);
    border-color: rgba(196, 30, 58, 1);
}

.call-btn-end {
    background: rgba(196, 30, 58, 0.9);
    border: 2px solid rgba(196, 30, 58, 1);
}

.call-btn-end:hover {
    background: rgba(196, 30, 58, 1);
    transform: scale(1.1);
}

