/* ======================= */
/* Базовые стили страницы  */
/* ======================= */
body {
    background-color: black;
    background-image: url('/static/haunted.png');
    background-size: 60% auto;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: left center;
    color: white;
    font-family: Arial, sans-serif;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* предотвращаем горизонтальный скролл */
}

.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
}

.text-container {
    text-align: center;
    width: 100%;
    margin-bottom: 20px;
    margin-top: 4em;
}

h1 {
    font-size: 4rem; /* десктоп */
    margin: 0;
}

h2 {
    font-size: 3rem; /* десктоп */
    margin-top: 10px;
    color: rgba(255, 0, 0, 0.9);
}

.telegram-container p {
    font-size: 1rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px black, -1px -1px 2px black, 1px -1px 2px black, -1px 1px 2px black;
}

.telegram-image {
    width: 100px;
    height: 100px;
}

/* ======================= */
/* Контакт email           */
/* ======================= */
.contact-email {
    position: fixed;  
    bottom: 10px;
    left: 10px;
    font-size: 1.2rem;
    color: rgba(255, 0, 0, 0.9);
    z-index: 10;  
    text-align: left;
}

/* ======================= */
/* Контейнер чата          */
/* ======================= */
.chat-wrapper {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: Arial, sans-serif;
}

.chat-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start; /* ВСЕГДА слева */
    text-align: left;       /* текст внутри тоже слева */
    width: 300px;
    height: 400px;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    overflow-y: auto;
}

/* ======================= */
/* Сообщения               */
/* ======================= */
.chat-message {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    width: 100%;
    margin-bottom: 8px; /* расстояние между сообщениями */
}

.chat-message .message-header {
    display: flex;
    align-items: flex-start;
    text-align: left;
}

.chat-message .user-id {
    font-weight: bold;
    margin-right: 5px;
    color: inherit;
}

.chat-message .message-text {
    color: #ddd;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    max-width: 80%;
    text-align: left;
    background-color: rgba(50, 0, 0, 0.3);
    padding: 3px 5px;
    border-radius: 2px;
    margin-top: -5px;
}

/* ======================= */
/* Поле ввода чата         */
/* ======================= */
.chat-input-container {
    display: flex;
    width: 100%;
    margin-top: 10px;
}

.chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #555;
    border-radius: 5px;
    background-color: rgba(68, 68, 68, 0.2);
    color: white;
}

.chat-send-button {
    padding: 10px;
    border: 1px solid #ff0000;
    border-radius: 5px;
    background-color: rgba(255, 0, 0, 0.3);
    color: white;
    cursor: pointer;
    margin-left: 10px;
}

/* ======================= */
/* Медиа-запросы для адаптивности */
/* ======================= */

/* Средние экраны */
@media (max-width: 1200px) {
    h1 { font-size: 3rem; }
    h2 { font-size: 2.2rem; }

    .chat-wrapper {
        align-items: flex-start;
        transform: none;
        width: 90%;
        margin-top: 20px;
    }

    .chat-container {
        width: 90%;
        height: 300px;
    }

    .chat-input-container {
        width: 90%;
    }
}

/* Мобильные устройства */
@media (max-width: 780px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }

    .contact-email {
        position: relative;
        margin: 10px auto 0 auto;
        bottom: auto;
        left: auto;
        right: auto;
        padding-top: 0;
        font-size: 1.1rem;
        text-align: center;
        color: rgba(255, 0, 0, 0.9);
    }

    .chat-wrapper {
        position: relative;
        top: auto;
        right: auto;
        transform: none;
        width: 95%;
        align-items: center;
        margin-bottom: 10px;
    }

    .chat-container {
        width: 100%;
        height: 250px;
    }

    .chat-input-container {
        width: 100%;
    }

    .text-container {
        margin-top: 2em;
    }
}
