/* === ОБЩИЕ СТИЛИ === */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    height: 100vh;
    overflow: hidden;
}
.hidden { display: none !important; }

/* === ЭКРАН ВХОДА (С МАТРИЦЕЙ) === */
#welcome-screen {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 10%, #2a1f4d 0%, transparent 55%),
        radial-gradient(ellipse at 85% 15%, #3d1f3f 0%, transparent 50%),
        radial-gradient(ellipse at 50% 110%, #7a3b2e 0%, transparent 55%),
        linear-gradient(160deg, #14112b 0%, #0b0a12 45%, #05040a 100%);
    background-color: #0b0a12;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
#matrix {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 20px;
}
.content h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 6vw, 4rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 400;
    background: linear-gradient(90deg, #c9a227, #e8d9b0, #c9a227);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 40px #c9a22755;
    margin-bottom: 10px;
}
.line {
    width: 120px;
    height: 1px;
    margin: 28px auto;
    background: linear-gradient(90deg, transparent, #c9a227, transparent);
}
.content p {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
    line-height: 1.9;
    color: #8b7fa8;
    letter-spacing: 0.05em;
    margin-bottom: 40px;
}
.login-box {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.login-box input {
    padding: 12px 20px;
    border-radius: 6px;
    border: 1px solid #c9a22755;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1rem;
    width: 250px;
    outline: none;
    transition: border-color 0.3s;
}
.login-box input:focus {
    border-color: #c9a227;
}
.login-box button {
    padding: 12px 30px;
    border-radius: 6px;
    border: none;
    background: #c9a227;
    color: #000;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}
.login-box button:hover {
    background: #e8d9b0;
}

/* === ОСНОВНОЙ ИНТЕРФЕЙС ЧАТА === */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
#chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #121212;
}
#windows-container {
    display: grid;
    height: 100%;
    width: 100%;
    gap: 2px;
    background: #000;
}

/* Окна чатов */
.chat-window {
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    border: 1px solid #333;
    overflow: hidden;
}
.chat-header {
    padding: 10px 15px;
    background: #252525;
    border-bottom: 1px solid #333;
    font-weight: bold;
    color: #4c9aff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-header .close-btn {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1.2rem;
}
.chat-header .close-btn:hover { color: #ff4c4c; }
.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Сообщения */
.message {
    padding: 8px 12px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}
.message.own {
    background: #1c3d5a;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}
.message.other {
    background: #2a2a2a;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}
.message .sender {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
}
.message .time {
    font-size: 0.7rem;
    color: #666;
    text-align: right;
    margin-top: 4px;
}

/* === НИЖНЯЯ ПАНЕЛЬ === */
#bottom-panel {
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    border-top: 1px solid #333;
}
#zone-buttons {
    display: flex;
    gap: 10px;
    padding: 5px 15px;
    background: #151515;
}
.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    color: #fff;
}
.btn-icon:hover { background: #333; }

#input-panel {
    display: flex;
    padding: 10px 15px;
    gap: 10px;
    align-items: center;
}
#input-panel input {
    flex: 1;
    padding: 12px 20px;
    border-radius: 20px;
    border: none;
    background: #2a2a2a;
    color: #fff;
    font-size: 1rem;
    outline: none;
}
#input-panel button {
    background: #4c9aff;
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
#input-panel button {
    background: #4c9aff;
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    padding: 0;
}

#send-btn {
    font-size: 1.5rem; /* Стрелочка будет крупной */
    padding-left: 4px; /* Чуть сдвинем, чтобы визуально была по центру */
}
#send-btn {
    font-size: 0.9rem; /* Чуть уменьшим шрифт */
    font-weight: bold;
}
#btn-plus { background: #333 !important; }

#contacts-bar {
    display: flex;
    overflow-x: auto;
    padding: 5px 10px;
    gap: 10px;
    background: #151515;
    border-top: 1px solid #333;
    height: 75px;
    align-items: center;
}
#contacts-bar::-webkit-scrollbar { height: 6px; }
#contacts-bar::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

.contact-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 65px;
    cursor: pointer;
    border-radius: 8px;
    padding: 5px;
    transition: background 0.2s;
}
.contact-card:hover { background: #2a2a2a; }
.contact-card .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #4c9aff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}
.contact-card .name {
    font-size: 0.75rem;
    color: #bbb;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 65px;
}
/* Кнопка Google */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: #fff;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1rem;
    transition: background 0.3s;
}
.google-btn:hover { background: #f1f1f1; }

/* === МОБИЛЬНАЯ АДАПТАЦИЯ === */
@media (max-width: 768px) {
    /* На телефоне всегда только одно окно, без сетки */
    #windows-container {
        display: block !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
    }
    
    /* Скрываем все окна, кроме первого */
    .chat-window {
        display: none;
        height: 100%;
    }
    
    .chat-window:first-child {
        display: flex;
    }

    /* Скрываем кнопку "+" и зону кнопок на мобилке */
    #btn-plus, #zone-buttons {
        display: none;
    }

    /* Уменьшаем отступы, чтобы все влезло в ширину экрана */
    #input-panel {
        padding: 8px 10px;
        gap: 5px;
    }

    #input-panel input {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    /* Кнопки делаем чуть меньше */
    #input-panel button {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    #send-btn {
        font-size: 1.2rem;
        padding-left: 2px;
    }

    /* Уменьшаем ленту контактов */
    #contacts-bar {
        height: 60px;
        padding: 2px 5px;
        gap: 5px;
    }
    
    .contact-card {
        min-width: 50px;
    }
    
    .contact-card .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .contact-card .name {
        font-size: 0.65rem;
        max-width: 50px;
    }
}
