html{
    height: 100%;
    width: 100%;
}

body {
    font-family: sans-serif;
    background: #f5f5f5;
    height: 95%;
    width: 98%;
}
/* body {
    font-family: sans-serif;
    background: #f5f5f5;
    height: auto;
    width: 100%;
} */


.login-box {
    width: 60%;
    margin: 80px auto;
    padding: 20px;
    background: white;
    border-radius: 10px;
}

input {
    display: block;
    width: 70%;
    padding: 8px;
    margin: 6px 0;
    margin-left: auto;
    margin-right: auto;
}

button {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
}

.error {
    color: red;
    margin-top: 10px;
}
/* .sidebar {
    width: 200px;
    background: #f0f0f0;
    padding: 10px;
    overflow-y: auto;
    border-left: 1px solid #ccc;
    flex-shrink: 0;
   
    height: 98%;
} 
.sidebar {
    position: absolute;
    right: 0;
    top: 0;
    width: 200px;
    height: 100%;
    background: #f0f0f0;
    padding: 10px;
    overflow-y: auto;
    border-left: 1px solid #ccc;
    flex-shrink: 0;
}
.chat-box {
    position: relative;
    width: 100%;
    height: 100%;
    padding-right: 200px; 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
} */
.chat-box {
    /* display: flex; */

    flex: 1;
    height: 96%;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: white;
    border: 1px solid #ccc;
   
    height: 92%;
}

#messageInput {
    width: calc(100% );
    padding: 8px;
    box-sizing: border-box;
}

#sendButton {
    width: 100px;
    padding: 8px;
}
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.online {
    background-color: #4caf50;
}

.status-dot.offline {
    background-color: #9e9e9e;
}
.message {
    width: 100%;
    display: flex;
    margin: 6px 0;
    overflow: hidden;
    animation: message-appear 0.25s ease-out;
}

.message.mine {
    justify-content: flex-end;
}

.message.theirs {
    justify-content: flex-start;
}

.bubble {
    max-width: 60%;
    padding: 10px 14px;
    border-radius: 14px;
    background: #e0f7fa;
    position: relative;
}

.message.mine .bubble {
    background: #c8e6c9;
}

.text {
    font-size: 15px;
    margin-bottom: 4px;
}

.meta {
    font-size: 11px;
    color: #555;
    text-align: right;
}
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    width: 100%;
    padding-right: 5px; /* место для глазика */
}

.password-wrapper .eye {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 18px;
    user-select: none;
}
@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.date-separator {
    text-align: center;
    margin: 15px 0;
    font-size: 13px;
    color: #666;
    font-weight: 500;
    opacity: 0.8;
}
.typing-indicator {
    height: 20px;
    font-size: 13px;
    color: #666;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.typing-indicator.visible {
    opacity: 1;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #ccc;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    flex-shrink: 0;
    font-size: 16px;
}

.message.mine .avatar {
    margin-right: 0;
    margin-left: 8px;
}
.input-bar {
    display: flex;
    align-items: center;
    padding: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-top: 8px;
}

.input-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 8px;
}

.input-bar button {
    background: #4a90e2;
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.input-bar button:hover {
    background: #3a78c2;
}
.chat-layout {
    display: flex;
    height: 96%;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
    
}

.chat-item:hover {
    background: #e9e9e9;
}

.chat-item .avatar {
    margin-right: 10px;
}

.chat-item .info {
    display: flex;
    flex-direction: column;
}

.chat-item .name {
    font-weight: 600;
}

.chat-item .last-message {
    font-size: 13px;
    color: #666;
}
/* Мобильная версия */
/* ДЕСКТОП — две колонки */
.chat-list {
    width: 280px;
    background: #f5f5f5;
    border-right: 1px solid #ddd;
    overflow-y: auto;
}
#Chats-zag{
    font-size: 20px;   
    font-weight: bold;
}

.chat-box {
    flex: 1;
    display: block;
}

/* Кнопка назад по умолчанию скрыта */
#backButton {
    display: none;
}

/* МОБИЛЬНЫЙ РЕЖИМ */
/* 
@media (max-width: 1000px) {

   
    .chat-list {
        width: 100%;
        display: block;
        font-size: 1vw;
    }
    .chat-item {
         font-size: 10vw;
    }
    .chat-item .avatar {
        margin-right: 10px;
        font-size: 7vw;
        width: 10vw;
        height: 10vw;
        border-radius: 5vw;
    }

    .chat-item .info {
        display: flex;
        flex-direction: column;
        font-size: 5vw;
    }

    .chat-item .name {
        font-weight: 600;
    }

    .chat-item .last-message {
        font-size: 13px;
        color: #666;
        font-size: 5vw;
    }

    
    .chat-box {
        display: none;
        
    }

  
    body.showChat .chat-list {
        display: none;
    }
    body.showChat .chat-zag {
        display: none;
    }

    body.showChat .chat-box {
        display: block;
        width: 100%;
    }

   
    #backButton {
        display: block;
        font-size: 6vw;
        padding: 10px;
        background: #eee;
        border-bottom: 1px solid #ccc;
    }
    .input-bar {
       
        border-radius: 2vw;
        
        margin-top: 3vw;
    }

    .input-bar input {
      
        font-size: 5vw;
        padding: 8px;
    }

    .input-bar button {
        background: #4a90e2;
        border: none;
        color: white;
        padding: 8px 14px;
        border-radius: 2vw;
        cursor: pointer;
        font-size: 5vw;
        transition: background 0.2s;
    }
    .message {
        font-size: 10vw;
    }
    .date-separator {
        font-size: 5vw;
    }
    .typing-indicator {
        font-size: 5vw;
    }
        
    .message.mine {
      
        font-size: 10vw;
    }

    .message.theirs {
       
        font-size: 10vw;
    }

    .bubble {
       
        font-size: 10vw;
    }
        
    .text {
        font-size: 5vw;
       
    }

    .meta {
        font-size: 4vw;
      
    }
    .login-box {
        font-size: 5vw;
    }
    input {
        font-size: 5vw;
    }
    button {
        font-size: 5vw;
    }
    .error {
        font-size: 5vw;
    }
    .avatar {
        width: 10vw;
        height: 10vw;
        border-radius: 5vw;
        font-size: 7vw;
    }
    .typing-indicator.visible {
        font-size: 4vw;
    }
    #Chats-zag{
        font-size: 8vw;   
    }
} */

@media (max-width: 1000px) {

    /* Лэйаут: одна колонка */
    .chat-layout {
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    /* Контейнер с заголовком и списком чатов */
    .chat-list1 {
        width: 100%;
        border-right: none;
        display: flex;
        flex-direction: column;
    }

    /* Заголовок "Чаты" */
    #Chats-zag {
        font-size: clamp(26px, 7vw, 40px);
        padding: 14px 18px;
        background: #fff;
        border-bottom: 1px solid #ddd;
        font-weight: 600;
    }

    /* Список чатов */
    .chat-list {
        width: 100%;
        display: block;
        overflow-y: auto;
    }

    /* Элемент списка чатов */
    .chat-item {
        padding: 14px 16px;
    }

    .chat-item .avatar {
        width: clamp(48px, 12vw, 64px);
        height: clamp(48px, 12vw, 64px);
        border-radius: 50%;
        font-size: clamp(20px, 10vw, 48px);
        margin-right: 12px;
    }

    .chat-item .name {
        font-size: clamp(22px, 7vw, 50px);
        font-weight: 600;
    }

    .chat-item .last-message {
        font-size: clamp(16px, 6.5vw, 34px);
        color: #666;
    }

    /* По умолчанию чат скрыт */
    .chat-box {
        display: none;
        width: 100%;
        height: 100%;
    }

    /* Когда выбран чат — показываем чат, скрываем список */
    body.showChat .chat-list1 {
        display: none;
    }

    body.showChat .chat-box {
        display: block;
        width: 100%;
    }

    /* Кнопка "Назад" */
    #backButton {
        display: block;
        font-size: clamp(22px, 10vw, 42px);
        padding: 12px 16px;
        background: #eee;
        border: none;
        border-bottom: 1px solid #ccc;
        text-align: left;
    }

    /* Сообщения */
    #messages {
        max-height: calc(100vh - 220px);
    }

    .bubble {
        max-width: 80%;
        border-radius: 16px;
        padding: 12px 16px;
    }

    .text {
        font-size: clamp(20px, 10vw, 48px);
        line-height: 1.35;
    }

    .meta {
        font-size: clamp(11px, 5.5vw, 36px);
    }

    .date-separator {
        font-size: clamp(14px, 7vw, 30px);
    }

    .typing-indicator,
    .typing-indicator.visible {
        font-size: clamp(14px, 7vw, 30px);
    }

    /* Нижняя панель ввода */
    .input-bar {
        border-radius: 14px;
        margin-top: 10px;
        padding: 10px;
    }

    .input-bar input {
        font-size: clamp(20px, 10vw, 48px);
        padding: 10px;
    }

    .input-bar button {
        border-radius: 12px;
        font-size: clamp(20px, 10vw, 48px);
        padding: 10px 16px;
    }

    /* Логин-форма */
    .login-box {
        width: 90%;
        font-size: clamp(20px, 10vw, 48px);
        margin: 40px auto;
    }

    .login-box input {
        width: 100%;
        font-size: clamp(20px, 10vw, 48px);
    }

    .login-box button {
        font-size: clamp(20px, 10vw, 48px);
    }

    .error {
        font-size: clamp(16px, 4.5vw, 22px);
    }

    /* Аватар внутри сообщений */
    .avatar {
        width: clamp(48px, 12vw, 64px);
        height: clamp(48px, 12vw, 64px);
        border-radius: 50%;
        font-size: clamp(20px, 10vw, 48px);
    }
}
