


/* Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}



/* ОБЩИЕ СТИЛИ */


:root {

    --background: linear-gradient(0turn,rgba(101,110,165,1) 29%,rgba(164,58,116,0.91) 100%);
    --white: rgb(246, 243, 247);
    --gray: #bfbfbf;
    --purple: rgba(101,110,165,1);
    --pink: rgba(164,58,116,0.91);
    --red: #b04d4d;
    --blue: #5192f3;
    --green:  #16a65c;
    --text-gray: #666;
    --border: rgb(235, 232, 236);

    --shadow-out: 0 10px 30px rgba(35, 19, 71, 0.3);
    --shadow-out-light: 0 2px 6px rgba(35, 19, 71, 0.3);
    --shadow-iner: inset 0 2px 4px rgba(35, 19, 71, 0.3);

    --radius-box: 30px;

}


.error-message {
    background: var(--white);
    color: var(--red);
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
}


body {
    font-family: 'Tahoma', Verdana, sans-serif;
    background: var(--background);
    height: 100vh;
    overflow: hidden;
    min-width: 300px;
}
.container {
    height: 100vh;
}




/* СТРАНИЦА ВХОДА */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 100vh;
    background: var(--background);
}
.login-card {
    background: var(--white);
    padding: 40px;
    border-radius: 56px;
    box-shadow: var(--shadow-out);
    width: 100%;
    max-width: 400px;
}
@media (max-width: 768px) {
    .login-container {
        padding: 16px;
    }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 30px;
}
.logo-image {
    width: 60px; 
    height: 60px;
}

.input-group {
    margin-bottom: 20px;
}
.input-with-icon {
    position: relative;
}

.input-field, .form-control, #username-input {
    width: 100%;
    padding: 15px 45px 15px 15px;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-iner);
    border-radius: 18px;
    font-size: 0.9em;
    transition: border-color 0.3s;
    color: var(--text-gray);
}
@media (max-width: 768px) {
    .input-field, .form-control, #username-input {
        border: 1px solid var(--border);
        font-size: 0.85em;
    }
}

.input-field:focus {
    outline: none;
}
.form-control:focus {
    outline: none;
}
#username-input:focus {
    outline: none;
}

.remember-me {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
}
.remember-me label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 14px;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: var(--white);
    font-size: 0.8em;
    color: var(--gray);
    border: 1px solid var(--gray);
}
.remember-me input[type="checkbox"] {
    display: none;
}
.checkmark {
    display: none;
}
.remember-me input[type="checkbox"]:checked + .checkmark + label {
    background: var(--gray);
    color: var(--white);
    font-weight: 300;
    border: 1px solid var(--gray);
}
.remember-me label:hover {
    background: var(--gray);
    color: var(--white);
    border: 1px solid var(--gray);
}

.btn-login-main, .btn-primary {
    padding: 15px 30px;
    border: none;
    border-radius: 18px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    color: var(--white);
    background: var(--purple);
    box-shadow: var(--shadow-out-light);
}
@media (max-width: 768px) {
    .btn-login-main, .btn-primary {
        font-size: 0.8em;
    }
}
.btn-login-main:hover {
    background: var(--pink);
}
.btn-primary:hover {
    background: var(--pink);
}



/* ШАПКА */

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--background);
    padding: 20px;
}
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px;
    background: var(--white);
    color: var(--text-gray);
    font-size: 0.95em;
    box-shadow: var(--shadow-out);
    margin-bottom: 20px;
    border-radius: var(--radius-box);
}
.header-left {
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-logo-image {
    width: 80px; 
    height: auto;
}
.header-right {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}
.user-info {
    font-weight: 500;
}
.header-actions {
    display: flex;
    gap: 10px;
    padding: 0 10px;
}
.header-cont-image {
    display: none;
    width: 36px; 
    height: auto;
}
.header-out-image {
    width: 20px; 
    height: auto;
}
.header-out-image:hover {
    filter: brightness(0) saturate(100%) invert(36%) sepia(47%) saturate(800%) hue-rotate(280deg) brightness(90%) contrast(85%);
}

.inline-form {
    display: inline;
}
.inline-form button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

@media (max-width: 768px) {
    .chat-container {
        padding: 0px;
    }
    .chat-header {
        margin-bottom: 10px;
        border-radius: 0;
        padding: 12px 10px;
    }
    .header-cont-image {
        display: block;
    }
    .header-logo-image {
        width: 66px; 
        height: auto;
    }
    .header-cont-image {
        width: 30px; 
    }
}


/* ЛЕВЫЙ БЛОК */

.chat-layout {
    display: flex;
    flex: 1;
    height: calc(100vh - 140px);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    width: 320px;
    background: var(--white);
    border-radius: var(--radius-box);
    margin-right: 20px;
}

.search-container {
    position: relative;
    padding: 20px;
    border-radius: var(--radius-box);
    box-shadow: var(--shadow-out-light);
    z-index: 50;
}
.search-input {
    width: 100%;
    padding: 10px;
    box-shadow: inset 0 1px 3px rgba(35, 19, 71, 0.2);;
    border-radius: 16px;
    font-size: 0.8em;
    transition: border-color 0.3s;
    color: var(--text-gray);
    border: 1px solid var(--border);
}
.search-input:focus {
    outline: none;
}

@media (max-width: 768px) {
    .sidebar {
        display: flex;
        width: 100%;
        border-radius: 0px;
        margin-right: 0px;
    }
    .sidebar.hidden-mobile {
        display: none !important;
    }
    .search-container {
        border-radius: 0px;
    }
}

.dialogs-section {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px;
}
@media (max-width: 768px) {
    .dialogs-section {
        padding: 10px 10px;
    }
}

.dialogs-list {
    display: flex;
    flex-direction: column;
}
.dialog-item {
    display: flex;
    padding: 15px 10px;
    border-radius: var(--radius-box);
    background: var(--white);
    box-shadow: var(--shadow-out-light);
    cursor: pointer;
    transition: transform 0.3s ease;
    margin-bottom: 5px;
}
.dialog-item:hover {
    transform: scale(1.02);
}
.dialog-item.active {
    transform: scale(1.02);
}
@media (max-width: 768px) {
    .dialog-item {
        border-radius: 26px;
    }
}

.dialog-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--pink);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    margin-right: 15px;
}

.dialog-info {
    flex: 1;
    min-width: 0;
}

.dialog-name {
    font-size: 0.9em;
    font-weight: 300;
    color: var(--text-gray);
    margin-bottom: 5px;
}

.dialog-preview {
    color: var(--gray);
    font-size: 0.8em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.new-message-indicator {
    color: var(--green);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}
.unread-dot {
    width: 10px;
    height: 10px;
    background: var(--green);
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.unread-count {
    background: var(--green);
    color: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.no-new-messages {
    color: var(--gray);
}
.no-messages {
    color: var(--gray);
}

.dialog-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}
.dialog-time {
    font-size: 0.7em;
    color: var(--gray);
    padding-right: 4px;
}

.btn-new-chat {
    background: var(--purple);
    box-shadow: var(--shadow-out-light);
    color: var(--white);
    border: none;
    padding: 15px 30px;
    border-radius: 18px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s;
    margin: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-new-chat:hover {
    background: var(--pink);
}
@media (max-width: 768px) {
    .btn-new-chat {
        font-size: 0.8em;
    }
}





/* ВЕРХ ЧАТА */

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
@media (max-width: 768px) {
    .chat-main {
        display: none;
    }
    .chat-main.visible-mobile {
        display: flex !important; 
    }
}

.chat-header-info {
    display: flex;
    flex-direction: row;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--white);
    border-radius: var(--radius-box);
}
@media (max-width: 768px) {
    .chat-header-info {
        border-radius: 0px;
        padding: 8px 10px;
    }
}

.chat-partner {
    display: flex;
    align-items: center;
    gap: 15px;
}
.partner-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--pink);
    color: var(--white);
    font-size: 1.1em;
}
@media (max-width: 768px) {
    .partner-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.9em;
    }
}

.partner-info {
    display: flex;
    flex-direction: column;
}
.partner-name {
    font-weight: 300;
    font-size: 1.0em;
    color: var(--text-gray);
}

.btn-delete-chat {
    border: none;
    background: var(--gray);
    color: var(--white);
    width: 36px;
    height: 36px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 14px;
    margin-left: 10px;
}
.btn-delete-chat:hover {
    background: var(--red);
}

@media (max-width: 768px) {
    .partner-name {
        font-size: 0.85em;
    }
    .btn-delete-chat {
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 12px;
    }
}



/* ОКНО СООБЩЕНИЙ */

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: var(--radius-box);
}

.message {
    max-width: 70%;
    padding: 14px 18px;
    border-radius: 22px;
    position: relative;
    animation: messageAppear 0.3s ease-out;
    word-wrap: break-word; 
    overflow-wrap: break-word; 
    word-break: break-word; 
}

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

.message-self {
    align-self: flex-end;
    background: var(--blue);
    color: var(--white);
    border-bottom-right-radius: 5px;
}

.message-other {
    align-self: flex-start;
    background: #dcd9de;
    color: #404040;
    border-bottom-left-radius: 5px;
}

.message-content {
    margin-bottom: 5px;
    font-size: 0.9em;
    line-height: 1.4;
    white-space: pre-wrap; 
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    hyphens: auto;
    -webkit-hyphens: auto;
    -ms-hyphens: auto;
}
.message-time {
    font-size: 0.7em;
    opacity: 0.5;
    text-align: right;
}
@media (max-width: 768px) {
    .message {
        max-width: 90%;
        padding: 14px 12px;
    }
    .messages-container {
        border-radius: 0px;
        padding: 10px;
        gap: 6px;
    }
    .message-content {
        margin-bottom: 2px;
        font-size: 0.8em;
        line-height: 1.3;
    }
    .message-time {
        font-size: 0.6em;
        opacity: 0.4;
    }
}



/* ВВОД СООБЩЕНИЙ */

.message-input-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    gap: 10px;
}

.message-input {
    width: 100%;
    min-height: 44px;
    max-height: 220px;
    padding: 12px 15px;
    box-shadow: inset 0 1px 2px rgba(35, 19, 71, 0.1);
    border-radius: 20px;
    font-size: 0.8em;
    color: var(--white);
    background: var(--purple);
    outline: none;
    resize: none;
    overflow-y: auto;
    line-height: 1.4;
    box-sizing: border-box;
    border: none;
    font-family: inherit;
    transition: height 0.2s ease;
    border: 1px solid rgb(89, 96, 142);
}
.message-input:focus {
    outline: none;
}
@media (max-width: 768px) {
    .message-input-container {
        padding: 10px 10px 20px;
    }
    .message-input {
        border-radius: 16px;
        font-size: 0.75em;
        line-height: 1.3;
    }
}

.btn-send {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--white);
    border: none;
    cursor: pointer;
    font-size: 26px;
}
.btn-send:hover {
    transform: scale(1.2);
}

.character-counter {
    font-size: 12px;
    text-align: right;
    margin-top: 5px;
    color: var(--purple);
}
.character-counter.over-limit {
    color: var(--red);
    font-weight: bold;
}

/* Стили для ссылок диалогов */
.dialogs-list a {
    text-decoration: none;
    color: inherit;
    display: block;
}
.dialogs-list a:hover .dialog-item {
    background: var(--white);
}
.dialogs-list a .dialog-item.active {
    background: rgba(192, 209, 246, 0.191);
}





/* МОДАЛЬНОЕ ОКНО МАСТЕР ПАРОЛЬ */

.modal {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background);
    z-index: 10000;
}
.modal-content {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    text-align: center;
    background: var(--white);
    padding: 40px;
    border-radius: 56px;
    box-shadow: var(--shadow-out);
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 15px;
    color: var(--purple);
    font-weight: 300;
}
.modal-content p {
    margin-bottom: 20px;
    color: var(--text-gray);
    line-height: 1.5;
}

.form-group {
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .modal {
        padding: 16px;
    }
    .modal-content {
        padding: 20px;
        border-radius: 40px;
        max-width: 400px;
    }
    .modal-content h2 {
        font-size: 1.4em;
    }
    .modal-content p {
        line-height: 1.3;
        font-size: 0.9em;
    }
}





/* МОДАЛЬНОЕ ОКНО НОВЫЙ ДИАЛОГ */

#new-chat-modal .modal-content {
    max-width: 400px;
}

.form-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-secondary {
    background: var(--gray);
    color: var(--white);
    border: none;
    padding: 8px 16px;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-secondary:hover {
    background-color: var(--text-gray);
}

































