/* Telegram-стиль для всего сайта — ТЁМНАЯ ТЕМА (активная) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #181818;        /* тёмный фон страницы */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.tg-container {
    max-width: 600px;
    width: 100%;
    background-color: #1f1f1f;        /* фон контейнера */
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Верхняя панель */
.tg-header {
    border-bottom: 1px solid #2f2f2f;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(44, 44, 44, 0.96);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.channel-name {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;                   /* белый текст */
}

.header-icons {
    font-size: 24px;
    line-height: 1;
    color: #aaaaaa;                   /* светлые иконки */
    cursor: default;
}

/* Лента сообщений */
.chat {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

/* Группа: пузырёк + кнопки */
.message-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 90%;
    position: relative;
}

/* Сам пузырёк (текст) */
.message {
    background-color: #3f3f3f;        /* фон пузырька */
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 4px rgba(0,0,0,0.2);
    padding: 8px 12px;
    border: 1px solid #3a3a3a;        /* тёмная граница */
    word-wrap: break-word;
    width: fit-content;
    max-width: 100%;
    color: #ffffff;                   /* текст сообщения */
}

/* (Класс .message-text можно оставить для совместимости, но он уже не используется) */
.message-text {
    font-size: 16px;
    line-height: 1.5;
    color: #ffffff;
    white-space: pre-wrap;
}

/* Блок кнопок под сообщением */
.message-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 6px;
    max-width: 100%;
}

/* Сами кнопки */
.tg-button {
    background-color: #3a3a3a;        /* тёмные кнопки */
    border: none;
    border-radius: 24px;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 500;
    color: #8ab4f8;                   /* голубоватый текст (как в Telegram) */
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    border: 1px solid #4a4a4a;
}

.tg-button:hover {
    background-color: #4a4a4a;        /* чуть светлее при наведении */
    text-decoration: none;
}

a.tg-button {
    text-decoration: none;
}

/* Пагинация теперь встраивается как обычное сообщение */
.pagination {
    margin: 20px 0 10px;
}

.pagination .tg-button {
    background-color: #3a3a3a;
    min-width: 40px;
    padding: 8px 12px;
    color: #8ab4f8;
}

.pagination .tg-button:disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

/* Кнопка "На главную" */
.back-home {
    margin-top: 20px;
    margin-bottom: 20px;
}

/* Адаптация для мобильных */
@media (max-width: 480px) {
    .message-group {
        max-width: 100%;
    }
    
    .message {
        max-width: 100%;
    }
    
    .tg-header {
        padding: 10px 12px;
    }
    
    .channel-name {
        font-size: 16px;
    }
}

.tg-button:active {
    transform: scale(0.97);
}

.system-message {
    text-align: center;
    font-size: 0.85rem;
    color: #aaaaaa;                   /* серый текст для системных сообщений */
    margin: 12px 0 6px;
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Стикеры (крупные эмодзи без фона) */
.message.sticker {
    background: none;
    border: none;
    box-shadow: none;
    padding: 4px 8px;
    font-size: 96px;
    line-height: 1.2;
    width: fit-content;
    max-width: 100%;
    transition: transform 0.1s ease;
}

.message.sticker-large {
    font-size: 128px;
    padding: 8px;
}

/* Сообщение с фото */
.message.photo {
    padding: 0;
    background: none;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 1px 4px rgba(0,0,0,0.2);
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
}

.message.photo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    border-radius: 18px;
    object-fit: cover;
    max-height: 400px;
}

.message.photo + .message-buttons {
    margin-top: 6px;
}

/* Контекстное меню в хедере */
.tg-header {
    position: relative; /* чтобы меню позиционировалось внутри */
}

.context-menu {
    display: none;
    position: absolute;
    top: 60px; /* регулируй по высоте хедера */
    right: 16px;
    background-color: #2b2b2b;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    padding: 8px 0;
    min-width: 160px;
    z-index: 200;
    border: 1px solid #3a3a3a;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 15px;
    color: #ffffff;
    cursor: pointer;
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #3a3a3a;
}


@font-face {
  font-family: 'Noto Color Emoji';
  src: url('/fonts/NotoColorEmoji-Regular.svg#NotoColorEmoji') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Noto Color Emoji';
  src: url('/fonts/NotoColorEmoji-Regular.ttf') format('truetype') tech(color-COLRv1);
  font-display: swap;
}

.message.sticker {
  font-family: 'Noto Color Emoji', 
               'Apple Color Emoji', 
               'Segoe UI Emoji', 
               sans-serif;
  background: none;
  border: none;
  box-shadow: none;
  padding: 4px 8px;
  font-size: 96px;
  line-height: 1.2;
  width: fit-content;
  max-width: 100%;
}

/* Аудиосообщение */
.message.audio {
    padding: 12px;
    background-color: #2b2b2b;      /* фон пузырька (в тёмной теме) */
    min-width: 260px;
}

/* Для светлой темы переопределим позже в light.css */

/* Плеер */






/* ввв */
/* Аудиосообщение */

/* Аудиосообщение */
.message.audio {
    position: relative;
    padding: 12px;
    min-height: 70px;               /* фиксированная высота для центрирования */
    display: flex;
    align-items: center;            /* центрируем плеер по вертикали */
    background-color: #2b2b2b;      /* фон пузырька (тёмная тема) */
    border-radius: 18px;
    width: fit-content;
    max-width: 100%;
}

/* Название трека (поверх, слева) */
.audio-title {
    position: absolute;
    left: 15%;
    top: 15%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #aaa;
    pointer-events: none;           /* клики проходят сквозь к плееру */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
    z-index: 2;
    padding: 2px 6px;
    border-radius: 12px;
}


/* Время/длительность (поверх, справа) */
.audio-time-duration {
    position: absolute;
    left: 16%;
    top: 75%;
    transform: translateY(-50%);
    font-size: 13px;
    color: #aaa;
    pointer-events: none;
    z-index: 2;
    /* background: rgba(0,0,0,0.3);    небольшой фон для читаемости */
    padding: 2px 6px;
    border-radius: 12px;
    white-space: nowrap;
}

/* Плеер (основа) */
.audio-player {
    position: relative;
    z-index: 1;                     /* под названием и временем */
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Кнопка воспроизведения */
.audio-play-pause {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #3a3a3a;
    border: none;
    color: #ffffff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.audio-play-pause:hover {
    background-color: #4a4a4a;
}

/* Полоса прогресса */
.audio-progress-container {
    flex-grow: 1;
    height: 4px;
    background-color: #3a3a3a;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.audio-progress-bar {
    width: 0%;
    height: 100%;
    background-color: #8ab4f8;
    border-radius: 2px;
    transition: width 0.1s linear;
}

/* Скрываем старые элементы, если они ещё есть */
.audio-time, .audio-duration {
    display: none;
}

/* Адаптация для мобильных */
@media (max-width: 480px) {
    .message.audio {
        padding: 10px;
        min-height: 60px;
    }
    .audio-title {
        font-size: 13px;
        max-width: calc(100% - 100px);
    }
    .audio-time-duration {
        font-size: 12px;
        padding: 2px 4px;
    }
    .audio-play-pause {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* =============================================== */
/* СВЕТЛАЯ ТЕМА (закомментирована для будущего использования) */
/* =============================================== */
/*
. Light theme styles 
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #e7ebf0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.tg-container {
    max-width: 600px;
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.tg-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255,255,255,0.96);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.channel-name {
    font-size: 18px;
    font-weight: 600;
    color: #222;
}

.header-icons {
    font-size: 24px;
    line-height: 1;
    color: #5e6f8d;
    cursor: default;
}

.chat {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
}

.message-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 90%;
    position: relative;
}

.message {
    background-color: #ffffff;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
    padding: 8px 12px;
    border: 1px solid rgba(0,0,0,0.04);
    word-wrap: break-word;
    width: fit-content;
    max-width: 100%;
}

.message-text {
    font-size: 16px;
    line-height: 1.5;
    color: #000000;
    white-space: pre-wrap;
}

.message-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 6px;
    max-width: 100%;
}

.tg-button {
    background-color: #f1f4f9;
    border: none;
    border-radius: 24px;
    padding: 8px 16px;
    font-size: 15px;
    font-weight: 500;
    color: #2e6bb5;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.03);
}

.tg-button:hover {
    background-color: #e3e9f2;
    text-decoration: none;
}

a.tg-button {
    text-decoration: none;
}

.pagination {
    margin: 20px 0 10px;
}

.pagination .tg-button {
    background-color: #f1f4f9;
    min-width: 40px;
    padding: 8px 12px;
}

.pagination .tg-button:disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.back-home {
    margin-top: 20px;
    margin-bottom: 20px;
}

@media (max-width: 480px) {
    .message-group {
        max-width: 100%;
    }
    .message {
        max-width: 100%;
    }
    .tg-header {
        padding: 10px 12px;
    }
    .channel-name {
        font-size: 16px;
    }
}

.tg-button:active {
    transform: scale(0.97);
}

.system-message {
    text-align: center;
    font-size: 0.85rem;
    color: #8e8e93;
    margin: 12px 0 6px;
    font-weight: 400;
    letter-spacing: 0.2px;
}

.message.sticker {
    background: none;
    border: none;
    box-shadow: none;
    padding: 4px 8px;
    font-size: 96px;
    line-height: 1.2;
    width: fit-content;
    max-width: 100%;
    transition: transform 0.1s ease;
}

.message.sticker-large {
    font-size: 128px;
    padding: 8px;
}

.message.photo {
    padding: 0;
    background: none;
    border: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
}

.message.photo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    border-radius: 18px;
    object-fit: cover;
    max-height: 400px;
}

.message.photo + .message-buttons {
    margin-top: 6px;
}
*/