html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

.min-width-0 {
    min-width: 0;
}

/*-----------ОСНОВНОЙ СТИЛЬ--------*/

html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.container-fluid {
    height: 100%;
    padding: 0;
}

.row {
    height: 100%;
    margin: 0;
}

[class*="col-"] {
    padding: 0;
    height: 100%;
    overflow-y: auto;
}

/* Левая панель */
#sidebar-left {
    background-color: #2b2b3a !important; /* тёмный фиолетовый */
    color: #e0e0e0;
}

/* Resizer для левой панели */
#sidebar-left {
    position: relative;
    transition: none;
    overflow: visible;
}

.resizer {
    position: absolute;
    top: 0;
    right: -5px;
    width: 10px;
    height: 100%;
    cursor: col-resize;
    z-index: 100;
    background: transparent;
}

    .resizer:hover {
        background: rgba(255,255,255,0.2);
    }

/* Выпадающее меню в левой панели */
#sidebar-left .dropdown-menu {
    background-color: #2b2b3a;
    border: 1px solid #444;
}

#sidebar-left .dropdown-item {
    color: #e0e0e0;
    padding: 0.5rem 1.5rem;
}

    #sidebar-left .dropdown-item:hover {
        background-color: #3a3a4a;
        color: white;
    }

#sidebar-left .dropdown-divider {
    border-top-color: #444;
}

/* Поле поиска */
#sidebar-left .input-group-text {
    background-color: #2b2b3a;
    border-color: #444;
    color: #aaa;
}

#sidebar-left .form-control {
    background-color: #2b2b3a;
    border-color: #444;
    color: white;
}

    #sidebar-left .form-control:focus {
        background-color: #2b2b3a;
        color: white;
        border-color: #6f42c1;
        box-shadow: 0 0 0 0.2rem rgba(111,66,193,0.25);
    }

#sidebar-left .btn-outline-secondary {
    border-color: #444;
    color: #aaa;
}

    #sidebar-left .btn-outline-secondary:hover {
        background-color: #3a3a4a;
        border-color: #6f42c1;
        color: white;
    }

/* Правая панель */
#sidebar-right {
    background-color: #f5f5fa; /* светлый фон */
    border-left: 1px solid #d0d0e0;
}

    #sidebar-right a {
        color: #6f42c1;
    }

        #sidebar-right a:hover {
            text-decoration: underline;
        }

/* Обеспечиваем, что правая панель плавно скрывается */
#sidebar-right {
    transition: width 0.2s;
}

    #sidebar-right.d-none {
        display: none !important;
    }

/* Центральная область занимает всё оставшееся место */
#chat-area {
    flex: 1;
    min-width: 0; /* важно для flex */
}


/* Центр */
#chat-area {
    background-color: #fafaff;
}

/* Кастомные цвета для кнопок и выделений */
.bg-purple {
    background-color: #7f2163 !important; /* фиолетовый*/
}

.btn-purple {
    color: #fff;
    background-color: #6f42c1;
    border-color: #6f42c1;
}

    .btn-purple:hover {
        background-color: #5a32a0;
        border-color: #5a32a0;
    }

.text-purple {
    color: #6f42c1 !important;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: #6f42c1;
}

/* Элементы списка чатов */
.chat-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: background 0.2s;
}

    .chat-item:hover {
        background-color: #3a3a4a;
    }

    .chat-item.active {
        background-color: #4a4a5a;
        border-left: 3px solid #9b7bda;
    }

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 12px;
    background-color: #9b7bda;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-last-msg {
    font-size: 0.85rem;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 0.7rem;
    color: #888;
}

/*Скроллбар*/
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #b3a0d0;
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #9b7bda;
    }

/*Модалки*/
.modal-title {
    color: #333 !important;
}

.form-label {
    color: #333 !important;
}

/* Сообщения (исправленное выравнивание, фиолетовый акцент) */


#messagesList {
    display: flex;
    flex-direction: column;
    background-color: #f0f0f8;
    padding: 1rem;
    overflow-y: auto;
    width: 100%;
    max-width: 900px;
    margin: 0 auto; 
}}

.message-bubble {
    max-width: 70%;
    margin-bottom: 8px;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease;
}

    .message-bubble:last-child {
        margin-bottom: 0;
    }

    .message-bubble.own {
        align-self: flex-end; /* прижимаем к правому краю */
    }

        .message-bubble.own .message-content {
            background-color: #7f2163; /* фирменный фиолетовый для своих сообщений */
            color: white;
            border-radius: 18px 18px 4px 18px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

    .message-bubble.other {
        align-self: flex-start;
    }

        .message-bubble.other .message-content {
            background-color: #2b2b3aeb;
            color: white;
            border-radius: 18px 18px 18px 4px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
        }

.message-content {
    padding: 10px 14px;
    display: inline-block;
    max-width: 100%;
    line-height: 1.5;
    font-size: 0.95rem;
    transition: box-shadow 0.2s;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
    font-size: 0.85rem;
}

    .message-header .avatar {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        margin-right: 8px;
        object-fit: cover;
    }

.message-time {
    font-size: 0.7rem;
    color: #aaa;
    margin-left: 8px;
}

.message-footer {
    font-size: 0.7rem;
    color: #aaa;
    margin-top: 2px;
    text-align: right;
}

.message-sender {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #6f42c1; /* фиолетовый для имени отправителя */
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 0.7rem;
    margin-top: 4px;
    gap: 6px;
    color: #888;
}

.read-status {
    color: #6f42c1; /* фиолетовый для галочек */
    font-weight: bold;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.edited-indicator {
    font-size: 0.7rem;
    margin-left: 4px;
    color: rgba(255,255,255,0.7);
}

.message-bubble.other .edited-indicator {
    color: #999;
}

.message-actions {
    opacity: 0;
    transition: opacity 0.2s;
    display: inline-block;
    margin-left: 4px;
}

.message-bubble:hover .message-actions {
    opacity: 1;
}

.message-actions button {
    background: none;
    border: none;
    color: #999;
    font-size: 0.9rem;
    padding: 0 4px;
}

    .message-actions button:hover {
        color: #6f42c1;
    }

.attachments {
    margin-top: 6px;
}

    .attachments .badge {
        background-color: #e0e0e0;
        color: #333;
    }

.message-bubble.own .attachments .badge {
    background-color: #8a5fcf;
    color: white;
}

/* Модальное окно для картинок */
#imageViewModal .modal-content {
    background: transparent;
    box-shadow: none;
}

#imageViewModal .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#imageViewModal .modal-body {
    padding: 0;
}

/* Пустой чат */
.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #aaa;
    font-size: 1.2rem;
}

    .empty-chat i {
        font-size: 5rem;
        color: #d0bfff;
        margin-bottom: 20px;
    }

/* Левая панель: профиль */
.profile-block {
    display: flex;
    align-items: center;
    padding: 1rem;
    min-width: 0;
}

.profile-avatar {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #9b7bda;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-right: 12px;
}

.profile-info {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.profile-name {
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-status {
    font-size: 0.85rem;
    color: #aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    margin-left: 8px;
}

    .profile-actions i {
        font-size: 1.2rem;
        cursor: pointer;
        color: rgba(255,255,255,0.8);
        transition: color 0.2s;
    }

        .profile-actions i:hover {
            color: white;
        }

/* Правая панель */
#sidebar-right .participant-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #9b7bda;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    margin-right: 8px;
}

/* Адаптивность сайдбаров */
@media (max-width: 768px) {
    #sidebar-left, #sidebar-right {
        position: fixed;
        top: 0;
        bottom: 0;
        width: 80%;
        z-index: 1050;
        transition: transform 0.3s;
    }

    #sidebar-left {
        left: 0;
        transform: translateX(-100%);
    }

    #sidebar-right {
        right: 0;
        transform: translateX(100%);
    }

        #sidebar-left.show, #sidebar-right.show {
            transform: translateX(0);
        }

    .col-md-6 {
        width: 100%;
    }
}

/* ---------- СТРАНИЦА ЛОГИНА (фиолетовая тема, широкий блок) ---------- */
body.login-page {
    background-color: #7f2163; /* тёмный фиолетовый фон фирменый */
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.login-page .container {
    width: 100%;
    max-width: 500px;
    padding: 20px;
}

.login-page .logo {
    text-align: center;
    margin-bottom: 30px;
}

    .login-page .logo img {
        max-width: 200px; /* размер лого */
        height: auto;
    }

.login-page .card {
    border: none;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.login-page .card-header {
    background: #7f2163; /* фирменный фиолетовый */
    color: #fff;
    text-align: center;
    border-radius: 12px 12px 0 0;
    padding: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

.login-page .card-body {
    padding: 30px;
}

.login-page .form-floating {
    margin-bottom: 20px;
}

.login-page .form-control {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    height: 50px;
    font-size: 1rem;
    padding-left: 15px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

    .login-page .form-control:focus {
        border-color: #6f42c1; /* фиолетовый при фокусе */
        box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.2);
    }

.login-page .form-floating label {
    color: #666;
    font-size: 0.9rem;
    left: 15px;
    top: 0;
    padding-top: 15px;
}

.login-page .checkbox {
    margin: 20px 0;
}

    .login-page .checkbox label {
        color: #555;
        font-size: 0.95rem;
    }

.login-page .btn-primary {
    background: #7f2163; /*#6f42c1 фиолетовый */ /*#7f2163 - фирменный фиолетовый*/
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.2s;
    color: #fff;
    width: 100%;
}

    .login-page .btn-primary:hover {
        background: #5a32a0; /* более тёмный фиолетовый */
    }

    .login-page .btn-primary:active {
        background: #4a2a80;
    }

.login-page .card-footer {
    background: transparent;
    border-top: 1px solid #eee;
    padding: 15px;
    text-align: center;
    color: #777;
}

/* Скрываем навбар на странице логина */
.login-page .navbar {
    display: none;
}
