* {
    box-sizing: border-box;
}
body {
    background: #1a1a1a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    color: #eee;
}
.hidden { display: none !important; }

/* Авторизация */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #1e1e1e;
    padding: 20px;
}
.auth-welcome {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}
.auth-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 20px;
    margin: 0 auto 15px;
    display: block;
}
.auth-welcome h1 {
    font-size: 1.8rem;
    color: #6c63ff;
    margin: 0 0 8px;
}
.auth-welcome p {
    color: #aaa;
    font-size: 0.9rem;
    margin: 0;
}
.auth-box {
    background: #2d2d2d;
    padding: 30px;
    border-radius: 12px;
    width: 100%;
    max-width: 320px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.auth-box h2 { margin: 0 0 20px; text-align: center; }
.auth-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    background: #3a3a3a;
    border: none;
    border-radius: 6px;
    color: #eee;
    font-size: 16px; /* предотвращает масштабирование на iOS */
}
.auth-box button {
    width: 100%;
    padding: 10px;
    background: #6c63ff;
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}
.auth-switch {
    text-align: center;
    margin-top: 15px;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
}
.error-msg { color: #ff6b6b; font-size: 12px; margin-bottom: 10px; text-align: center; }

/* Основной интерфейс */
#mainContainer {
    max-width: 1200px;
    margin: 20px auto;
    background: #2c2c2c;
    border-radius: 16px;
    overflow: hidden;
}
.top-bar {
    background: #3a3a3a;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tabs {
    display: flex;
    background: #252525;
}
.tab-btn {
    flex: 1;
    padding: 12px;
    background: #2c2c2c;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
}
.tab-btn.active {
    background: #3a3a3a;
    color: #6c63ff;
    border-bottom: 2px solid #6c63ff;
}
.tab-content {
    display: flex;
    height: 70vh;
}
.tab-content.hidden {
    display: none;
}
#publicTab {
    flex-direction: column;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.message {
    background: #3a3a3a;
    border-radius: 12px;
    padding: 8px 12px;
    max-width: 80%;
    align-self: flex-start;
}
.message.own {
    align-self: flex-end;
    background: #6c63ff;
}
.message .username {
    font-weight: bold;
    font-size: 0.8rem;
    color: #aaa;
}
.message .text { margin: 4px 0; }
.message .time { font-size: 0.7rem; color: #888; text-align: right; }
.input-area {
    display: flex;
    padding: 12px;
    gap: 8px;
    background: #252525;
}
.input-area input {
    flex: 1;
    padding: 10px;
    background: #3a3a3a;
    border: none;
    border-radius: 40px;
    color: #eee;
    font-size: 16px;
}
.input-area button {
    background: #6c63ff;
    border: none;
    border-radius: 40px;
    padding: 10px 20px;
    color: white;
    cursor: pointer;
}
#privateTab {
    display: flex;
}
.dialogs-panel {
    width: 250px;
    background: #252525;
    border-right: 1px solid #3a3a3a;
    padding: 10px;
    overflow-y: auto;
}
.dialogs-panel h3 { margin: 0 0 10px; font-size: 1rem; }
.dialog-item {
    padding: 8px;
    margin-bottom: 5px;
    background: #3a3a3a;
    border-radius: 8px;
    cursor: pointer;
}
.dialog-item.active { background: #6c63ff; }
.dialog-item .contact { font-weight: bold; }
.dialog-item .last-msg { font-size: 0.8rem; color: #aaa; }
.new-dialog {
    margin-top: 10px;
    display: flex;
    gap: 5px;
}
.new-dialog input {
    flex: 1;
    padding: 6px;
    background: #3a3a3a;
    border: none;
    border-radius: 6px;
    color: #eee;
    font-size: 16px;
}
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.chat-header {
    padding: 10px;
    background: #3a3a3a;
    border-bottom: 1px solid #4a4a4a;
}
/* Запрет масштабирования на iOS для полей ввода */
input, textarea, select {
    font-size: 16px !important;
    touch-action: manipulation;
}