/* style.css — вечерняя, мобильная тема для мини‑мессенджера */

/* Глобально */
* {
    box-sizing: border-box;
}

/* Базовая типографика и фон */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
    padding: 0;
    background: #11141c;
    color: #e3e7f0;
    font-size: 16px; /* база для десктопа */
}

/* Глобальные стили ссылок */
a {
    color: #9fc2ff;                 /* хорошо читается на #11141c */
    text-decoration: underline;
    text-decoration-thickness: 1px; /* тонкое подчёркивание */
    text-underline-offset: 2px;     /* небольшой отступ от текста */
}

a:hover {
    color: #cfe0ff;
    text-decoration-thickness: 2px; /* чуть жирнее на hover */
}

a:visited {
    color: #b79cff;                 /* лёгкий фиолетовый оттенок */
}

/* Важные ссылки‑чипы */
a.chip-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #20273a;
    color: #d8e2ff;
    font-size: 13px;
    text-decoration: none;
}

a.chip-link:hover {
    background: #2b3650;
    color: #ffffff;
}

/* На узких экранах шрифт крупнее */
@media (max-width: 600px) {
    body {
        font-size: 18px;
    }
}

/* Контейнер страницы */
.page {
    max-width: 960px;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .page {
        max-width: 100%;
    }
}

/* Липкая шапка */
header {
    position: sticky; /* можно fixed при желании */
    top: 0;
    z-index: 10;

    background: rgba(10, 12, 19, 0.97);
    color: #e3e7f0;
    border-bottom: 1px solid #252a3a;
    backdrop-filter: blur(6px);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 8px 12px;
}

/* Левая и правая часть шапки */
.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Название */
.header-title {
    font-weight: 600;
    font-size: 14px;
    color: #c7cfdd;
    white-space: nowrap;
}

/* Ссылки в шапке — чуть более «кнопочные» */
header a {
    color: #c2d4ff;
    text-decoration: none;
    font-size: 13px;
    padding: 3px 8px;
    border-radius: 999px;
    transition: background 0.15s ease, color 0.15s ease;
}

header a:hover {
    color: #ffffff;
    background: rgba(95, 122, 255, 0.18);
    text-decoration: none;
}

header span {
    font-size: 13px;
    color: #9fa9c1;
}

/* Шапка на мобиле */
@media (max-width: 600px) {
    header {
        padding: 6px 10px;
    }
    .header-title {
        font-size: 13px;
    }
    .header-left {
        gap: 6px;
    }
    .header-right {
        gap: 6px;
    }
    header a,
    header span {
        font-size: 0.9rem; /* относительный размер */
    }
}

/* Контейнер основного контента */
.container {
    padding: 12px 10px 16px;
}

/* Служебные сообщения */
.errors {
    color: #ff8383;
    margin-bottom: 10px;
}
.info {
    color: #a3e58c;
    margin-bottom: 10px;
}

/* Формы и поля ввода */
form {
    margin: 8px 0;
}

input[type=text],
input[type=password],
textarea {
    width: 100%;
    padding: 8px 10px;

    background: #181d28;
    border: 1px solid #30384a;
    border-radius: 999px;
    color: #e3e7f0;
    font-size: 14px;
}

textarea {
    border-radius: 10px;
    min-height: 110px;
    resize: vertical;
}

input[type=text]:focus,
input[type=password]:focus,
textarea:focus {
    outline: none;
    border-color: #597dff;
    box-shadow: 0 0 0 1px rgba(89, 125, 255, 0.4);
}

/* Кнопки */
button,
input[type=submit] {
    background: #3b4258;
    color: #e3e7f0;
    border: none;
    border-radius: 999px;
    padding: 7px 16px;
    cursor: pointer;
    font-size: 13px;
}
button:hover,
input[type=submit]:hover {
    background: #4a5472;
}

/* Таблицы (Inbox, пользователи) — карточки на мобиле */
.dialog-list,
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}

.dialog-list th,
.users-table th {
    display: none; /* на мобиле скрываем шапку таблицы */
}

/* Каждая строка как карточка */
.dialog-list tr,
.users-table tr {
    background: #171c27;
    border-radius: 8px;
    border: 1px solid #252c3b;
    margin-bottom: 8px;
    display: block;
    padding: 6px 8px;
}

.dialog-list td,
.users-table td {
    display: block;
    border: none;
    padding: 2px 0;
    font-size: 13px;
}

.dialog-list td:last-child,
.users-table td:last-child {
    margin-top: 4px;
}

/* На широкой ширине — классические таблицы */
@media (min-width: 768px) {
    .dialog-list,
    .users-table {
        border-collapse: collapse;
        background: #171c27;
        border-radius: 8px;
        overflow: hidden;
    }

    .dialog-list th,
    .users-table th {
        display: table-cell;
        background: #202635;
        color: #c7cfdd;
        font-weight: normal;
        text-align: left;
        padding: 6px 8px;
        font-size: 13px;
    }

    .dialog-list tr,
    .users-table tr {
        display: table-row;
        border-radius: 0;
        border: none;
        margin: 0;
        padding: 0;
    }

    .dialog-list td,
    .users-table td {
        display: table-cell;
        padding: 6px 8px;
        border-top: 1px solid #252c3b;
    }
}

/* Сообщения в диалоге — широкие «пузырьки» */
.message {
    max-width: 100%;
    width: 100%;
    padding: 10px 12px;
    margin: 4px 0;
    border-radius: 16px;
    clear: both;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.me {
    background: #2b3a5b;
    margin-left: 15%;
    text-align: left;
    border-bottom-right-radius: 4px;
}

.message.other {
    background: #1d2535;
    margin-right: 15%;
    text-align: left;
    border-bottom-left-radius: 4px;
}

.message small {
    color: #8d96aa;
    display: block;
    margin-bottom: 2px;
    font-size: 11px;
}

/* На узких экранах шрифт заметно увеличиваем */
@media (max-width: 600px) {
    body {
        font-size: 32px; /* было 18px */
    }

    header {
        padding: 8px 12px;
    }

    .header-title {
        font-size: 1.0rem; /* ~22px */
    }

    header a,
    header span {
        font-size: 0.95rem; /* ~21px */
    }

    .message {
        font-size: 1.1rem;      /* ещё крупнее текст сообщений */
        padding: 14px 18px;
    }

    input[type=text],
    input[type=password],
    textarea {
        font-size: 1.05rem;
        padding: 10px 14px;
    }

    textarea {
        min-height: 140px;
    }

    button,
    input[type=submit] {
        font-size: 1rem;
        padding: 10px 22px;
    }

    .container {
        padding: 14px 12px 32px;
    }

    .dialog-list td,
    .users-table td {
        font-size: 0.95rem;
    }
}

/* Блоки кода */
pre {
    white-space: pre-wrap;     /* сохраняет переводы строк */
    word-wrap: break-word;     /* ломает длинные слова по краю */
    overflow-wrap: anywhere;   /* можно ещё агрессивнее переносить */
}
