/* === ОБЩИЕ СТИЛИ === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Calibri, sans-serif;
    font-size: 16px;
    color: #f8faff;
    line-height: 1.5;
}

body {
    display: flex;
    height: 100vh;
    background: #292929;
}

/* === Login === */

.logout-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #444; /* Тёмно-серый */
    color: white;
    border: none;
    padding: 10px 15px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #666; /* Светлее при наведении */
}

.login-container {
    background: #2A2A2A; /* Тёмно-серый блок */
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    text-align: center;
    max-width: 400px;
    width: 100%;
}

h2 {
    color: #f8faff; /* Светлый текст */
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
    text-align: left;
}

.input-group label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #f8faff;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 16px;
    background: #333;
    color: #f8faff;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.login-btn:hover {
    background: #666;
}

.error {
    color: red;
    margin-top: 10px;
    display: none;
}

/* === SIDEBAR === */
.new-chat {
    background: #2A2A2A;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #f8faff;
}

.sidebar {
    width: 280px;
    background: #1E1E1E;
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #333;
}

.sidebar h2 {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #f8faff;
}

.chat-list {
    flex-grow: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px;
    padding-left: 7px;
    margin-bottom: 3px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
    color: #f8faff;
    background: #2A2A2A;
    position: relative;
}

.chat-item:hover {
    background: #3A3A3A;
}

.chat-actions {
    position: relative;
    display: flex;
    align-items: center;
}

.chat-options-btn {
    background: transparent;
    border: none;
    color: #f8faff;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.chat-options-btn:hover {
    color: #bbb;
}

/* Выпадающее меню теперь рядом с кнопкой ⋮ */
.chat-options {
    display: none;
    position: absolute;
    top: 70%;
    right: 40px; /* Смещаем влево от троеточия */
    transform: translateY(-50%);
    background: #444;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    width: 140px;
    z-index: 10;
}

.chat-options button {
    width: 100%;
    padding: 8px;
    background: none;
    border: none;
    color: #f8faff;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-options button:hover {
    background: #666;
}

.tg-chat-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2A2A2A;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    width: 300px;
    text-align: center;
    z-index: 3000;
    color: #f8faff;
}

.popup-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.close-popup {
    background: #444;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 10px;
    color: #f8faff;
}

.close-popup:hover {
    background: #666;
}

.tg-chat-item {
    background: #444;
    border: none;
    padding: 5px;
    margin: 5px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    color: #f8faff;
    text-align: center;
    transition: background 0.2s, transform 0.1s;
}

.tg-chat-item:hover {
    background: #666;
    transform: scale(1.05);
}
/* === ОСНОВНОЕ ОКНО === */
.date-picker-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.date-picker-container span {
    color: #f8faff;
    font-weight: bold;
}

.message-input-date {
    background: #333;
    color: #f8faff;
    border: 1px solid #444;
    border-radius: 5px;
    padding: 6px 10px;
    font-size: 16px;
}

.message-input-date::placeholder {
    color: #999;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    padding: 20px;
}

.logo-text {
    font-size: 28px;
    font-weight: bold;
    color: #f8faff;
    margin-bottom: 10px;
}

/* === СООБЩЕНИЯ === */
.chat-box {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 10px;
    margin: 10px;
    background: #292929;
}

.message {
    max-width: 70%;
    padding: 12px;
    border-radius: 10px;
    margin: 10px 0;
    font-size: 16px;
    word-wrap: break-word;
    white-space: pre-wrap;
    color: #f8faff;
}

.user {
    align-self: flex-end;
    border: 2px solid #444;
    background: #333;
    color: #f8faff;
    text-align: right;
}

.ai {
    align-self: flex-start;
    background: #222;
    text-align: left;
}

/* === ВВОД СООБЩЕНИЯ === */
.message-box {
    display: flex;
    align-items: center;
    background: #2A2A2A;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

.message-input {
    width: 100%;
    max-height: 150px;
    overflow: hidden;
    resize: none;
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid #444;
    line-height: 1.5;
    background: #333;
    color: #f8faff;
}

.send-btn {
    background: #444;
    border: none;
    padding: 8px 15px;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 10px;
}

.send-btn:hover {
    background: #666;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: #3A3A3A;
    border-radius: 5px;
    width: fit-content;
    font-size: 18px;
    color: #f8faff;
}

.typing-indicator span {
    animation: blink 1.5s infinite;
    display: inline-block;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

.menu-btn {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    background: #444;
    color: white;
    font-size: 18px;
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 5px;
    z-index: 2000;
}

.menu-btn:hover {
    background: #666;
}

.ai-model-selection {
        margin-top: 20px;
        padding: 10px;
        background: #222;
        border-radius: 5px;
        color: #fff;
    }

    .ai-model-selection label {
        font-size: 14px;
        margin-right: 10px;
    }

    .ai-model-selection select {
        background: #333;
        color: white;
        border: none;
        padding: 5px;
        border-radius: 4px;
    }

/* === MOBILE === */
@media (max-width: 768px) {
    body {
        display: flex;
        height: 92vh;
        background-color: #1E1E1E;
    }

    .menu-btn {
        display: block;
    }
    .logout-btn {
        position: absolute;
        top: 15px;
        right: 70px;
        background: #333;
        font-size: 14px;
        padding: 8px 12px;
    }
    .sidebar {
        position: fixed;
        width: 100%;
        height: 100%;
        transform: translateX(-100%);
        z-index: 1000;
    }

    .sidebar.show {
        transform: translateX(0);
    }
}

@media (max-width: 600px) {
    .date-picker-container {
        flex-wrap: wrap;
    }
    .date-picker-container span,
    .message-input-date {
        width: 100%;
        margin: 5px 0;
    }
}

.flatpickr-current-month input.cur-year {
    color: black !important;
}