* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Roboto', sans-serif;
    background-color: #E6EAEF;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: #000;
}
.login-container {
    background: #ffffff;
    width: 360px;
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    text-align: center;
}
.logo-container {
    margin-bottom: 25px;
}
.logo {
    width: 100px;
    height: 100px;
    background-color: #3390ec;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}
.logo svg {
    width: 50px;
    height: 50px;
    fill: white;
    margin-right: 4px;
}
h1 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #000;
}
p.subtitle {
    font-size: 15px;
    color: #707579;
    margin-bottom: 35px;
    line-height: 1.5;
}
.input-group {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}
.input-group input {
    width: 100%;
    padding: 15px 15px;
    font-size: 16px;
    border: 1px solid #dfe1e5;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-group input:focus {
    border-color: #3390ec;
    box-shadow: 0 0 0 2px rgba(51, 144, 236, 0.2);
}
.input-group label {
    position: absolute;
    top: -10px;
    left: 12px;
    background: white;
    padding: 0 5px;
    font-size: 13px;
    color: #3390ec;
    font-weight: 500;
}
.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    font-size: 15px;
    color: #000;
    cursor: pointer;
}
.checkbox-container input {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: #3390ec;
    cursor: pointer;
}
.btn-next {
    width: 100%;
    background-color: #3390ec;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 16px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn-next:hover {
    background-color: #2b7bc9;
}
.qr-login {
    margin-top: 25px;
    font-size: 15px;
    color: #3390ec;
    font-weight: 500;
    cursor: pointer;
    text-transform: uppercase;
}
.qr-login:hover {
    text-decoration: underline;
}

/* Стили для мессенджера (dialog.html) */
body.dialog-body {
    background-color: #ffffff;
    align-items: stretch;
}
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}
.sidebar {
    width: 320px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}
.menu-btn {
    color: #707579;
    margin-right: 16px;
    cursor: pointer;
}
.search-bar {
    flex-grow: 1;
}
.search-bar input {
    width: 100%;
    padding: 10px 16px;
    border: none;
    background-color: #f4f4f5;
    border-radius: 20px;
    outline: none;
    font-size: 15px;
}
.chat-list {
    flex-grow: 1;
    overflow-y: auto;
}
.chat-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.chat-item:hover {
    background-color: #f4f4f5;
}
.chat-item.active {
    background-color: #3390ec;
    color: white;
}
.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 20px;
    font-weight: 500;
    margin-right: 12px;
    flex-shrink: 0;
}
.chat-info {
    flex-grow: 1;
    overflow: hidden;
}
.chat-name-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.chat-name {
    font-weight: 500;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-time {
    font-size: 12px;
    color: #8c939a;
}
.chat-item.active .chat-time {
    color: #d1e6fa;
}
.chat-last-message {
    font-size: 15px;
    color: #707579;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-item.active .chat-last-message {
    color: #d1e6fa;
}

.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-image: url('https://web.telegram.org/a/chat-bg-pattern-light.png');
    background-size: cover;
    background-color: #92b7d3;
    position: relative;
}
.chat-header {
    background-color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    z-index: 2;
}
.chat-header-info {
    display: flex;
    flex-direction: column;
}
.chat-header-title {
    font-size: 18px;
    font-weight: 500;
}
.chat-header-status {
    font-size: 13px;
    color: #707579;
}
.chat-header-actions {
    color: #707579;
    display: flex;
    gap: 20px;
}
.chat-header-actions svg {
    cursor: pointer;
}

.messages-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.message-wrapper {
    display: flex;
    margin-bottom: 10px;
    width: 100%;
}
.message-in {
    justify-content: flex-start;
}
.message-out {
    justify-content: flex-end;
}
.message {
    max-width: 60%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
}
.message-in .message {
    background-color: #ffffff;
    border-bottom-left-radius: 4px;
}
.message-out .message {
    background-color: #e3f2fd;
    border-bottom-right-radius: 4px;
}
.message-time {
    font-size: 11px;
    color: #8c939a;
    float: right;
    margin-left: 10px;
    margin-top: 5px;
}
.message-out .message-time {
    color: #6da2cd;
}

.chat-input-area {
    padding: 15px 20px;
    background: transparent;
}
.input-wrapper {
    background: #ffffff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    padding: 8px 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.attach-btn, .send-btn {
    color: #8c939a;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.send-btn {
    color: #3390ec;
    margin-left: 15px;
}
.input-wrapper input {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 5px 15px;
    background: transparent;
}

/* Кнопка "Назад" для мобильных */
.back-btn {
    display: none;
    color: #707579;
    margin-right: 15px;
    cursor: pointer;
}

/* Адаптивность под мобильные устройства */
@media (max-width: 768px) {
    .app-container {
        position: relative;
    }
    
    .sidebar {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 10;
        transition: transform 0.3s ease;
    }
    
    .chat-area {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 5;
    }

    /* Когда чат открыт на мобильном, прячем сайдбар влево */
    .app-container.chat-active .sidebar {
        transform: translateX(-100%);
    }
    
    /* Когда чат открыт, чат зона становится поверх всех (чтобы скрыть другие чаты) */
    .app-container.chat-active .chat-area {
        z-index: 20;
    }

    .back-btn {
        display: flex;
        align-items: center;
    }

    /* На мобильных форма логина должна занимать всю ширину экрана или быть близкой к ней */
    .login-container {
        width: 90%;
        max-width: 360px;
        padding: 30px 20px;
    }
}