﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.screen {
    display: none;
    width: 100%;
    height: 100vh;
}

    .screen.active {
        display: flex;
        align-items: center;
        justify-content: center;
    }

.scrollable-div {
    overflow: auto; /* Добавляем полосы прокрутки при необходимости */
}

/* Стили экрана авторизации */
#authScreen .auth-container {
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 400px;
    max-width: 90vw;
    text-align: center;
}

#authScreen h1 {
    color: #667eea;
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

#authScreen .form-container h2 {
    margin-bottom: 2rem;
    color: #333;
    font-size: 1.8rem;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

    .input-group label {
        display: block;
        margin-bottom: 0.5rem;
        font-weight: 500;
        color: #555;
    }

    .input-group input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e1e5e9;
        border-radius: 8px;
        font-size: 1rem;
        transition: border-color 0.3s ease;
    }

        .input-group input:focus {
            outline: none;
            border-color: #667eea;
        }

#loginForm button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

    #loginForm button:hover {
        background: #5a6fd8;
    }

#authError {
    color: #ff4444;
    margin-top: 1rem;
    min-height: 20px;
}

/* Стили экрана чата */
#chatScreen {
    align-items: flex-start;
    justify-content: center;
}

.chat-container {
    background: white;
    width: 800px;
    max-width: 95vw;
    height: 90vh;
    max-height: 95vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .chat-header h1 {
        color: #667eea;
        font-size: 1.8rem;
    }

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#currentUser {
    font-weight: 500;
    color: #555;
}

#logoutBtn {
    padding: 8px 16px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

    #logoutBtn:hover {
        background: #cc0000;
    }

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.messages-area {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 70%;
    margin-bottom: 1rem;
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
    animation: messageSlideIn 0.3s ease-out;
}

.own-message {
    align-self: flex-end;
    background: #667eea;
    color: white;
}

.other-message {
    align-self: flex-start;
    background: #f1f3f4;
    color: #333;
}

.message b {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    position: absolute;
    bottom: 4px;
    right: 8px;
}

.message-form {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e1e5e9;
}

#message {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

    #message:focus {
        border-color: #667eea;
    }

#sendBtn {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

    #sendBtn:hover:not(:disabled) {
        background: #5a6fd8;
    }

    #sendBtn:disabled {
        background: #cccccc;
        cursor: not-allowed;
    }

/* Анимации */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .chat-container {
        width: 95vw;
        height: 95vh;
    }

    #authScreen .auth-container {
        padding: 2rem;
        width: 90vw;
    }

    .chat-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .user-info {
        align-self: flex-end;
    }
}

.messages-area {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    /* Стили для полосы прокрутки */
    scrollbar-width: thin; /* Для Firefox */
    scrollbar-color: #667eea #f1f3f4; /* Для Firefox: цвет бегунка и дорожки */
}

    /* Стили для WebKit (Chrome, Edge, Safari) */
    .messages-area::-webkit-scrollbar {
        width: 8px;
    }

    .messages-area::-webkit-scrollbar-track {
        background: #f1f3f4;
        border-radius: 4px;
    }

    .messages-area::-webkit-scrollbar-thumb {
        background: #667eea;
        border-radius: 4px;
        transition: background 0.3s ease;
    }

        .messages-area::-webkit-scrollbar-thumb:hover {
            background: #5a6fd8;
        }


.message a {
    color: #0066cc;
    text-decoration: underline;
    cursor: pointer;
}

    .message a:hover {
        color: #004d99;
    }

    .message a:visited {
        color: #6600cc;
    }