/* Telegram-стиль виджет - точная копия интерфейса */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #212121;
    color: #ffffff;
    line-height: 1.4;
    font-size: 15px;
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Паттерн фона - точечный как в Telegram */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    z-index: 0;
    pointer-events: none;
}

.telegram-widget-container {
    max-width: 100%;
    margin: 0;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* Хедер как в Telegram */
.telegram-header {
    background: #212121;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(33, 33, 33, 0.95);
}

.telegram-header-content {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    gap: 12px;
}

.telegram-channel-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.telegram-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.telegram-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.telegram-channel-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.telegram-channel-name {
    font-weight: 600;
    font-size: 17px;
    color: #ffffff;
    line-height: 1.2;
}

.telegram-menu-button {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
    text-decoration: none;
}

.telegram-menu-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.telegram-menu-button svg {
    width: 20px;
    height: 20px;
}

/* Разделитель даты */
.telegram-date-separator {
    text-align: center;
    padding: 16px 0;
    position: relative;
}

.telegram-date-badge {
    display: inline-block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
    font-weight: 500;
    padding: 0;
    background: transparent;
    border: none;
}

/* Список постов */
.telegram-posts-list {
    background: transparent;
    padding: 0;
}

.telegram-post {
    background: transparent;
    padding: 0;
    margin: 0;
    border: none;
    position: relative;
    animation: fadeIn 0.3s ease-in;
}

.telegram-post + .telegram-post {
    margin-top: 0;
}

/* Медиа контент */
.telegram-post-media {
    margin: 0;
    width: 100%;
    display: block;
    position: relative;
    background: rgba(0, 0, 0, 0.1);
}

.telegram-post-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    margin: 0;
    max-width: 100%;
    object-fit: cover;
}

.telegram-post-video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
    margin: 0;
}

/* Текст поста */
.telegram-post-text {
    font-size: 15px;
    line-height: 1.5;
    color: #ffffff;
    padding: 12px 16px;
    word-wrap: break-word;
    background: transparent;
}

.telegram-post-text:first-child {
    padding-top: 16px;
}

/* Списки в стиле Telegram */
.telegram-post-text .telegram-list {
    list-style: none;
    padding: 0;
    margin: 8px 0;
    padding-left: 20px;
}

.telegram-post-text .telegram-list li {
    position: relative;
    padding-left: 16px;
    margin: 4px 0;
    line-height: 1.5;
    color: #ffffff;
}

.telegram-post-text .telegram-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: rgba(255, 255, 255, 0.6);
    font-weight: bold;
}

/* Футер поста */
.telegram-post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 16px 16px;
    gap: 8px;
    border: none;
    margin: 0;
}

.telegram-post-time {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.telegram-post-link {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.4);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.telegram-post-link:hover {
    color: rgba(255, 255, 255, 0.6);
}

.telegram-post-link::before {
    content: '';
    display: none;
}

/* Футер виджета */
.telegram-footer {
    padding: 16px;
    background: transparent;
    border: none;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

/* Кнопка обновления */
.telegram-refresh-button {
    display: none;
}

/* Стили для форматирования текста */
.telegram-hashtag {
    color: #3390ec;
    font-weight: 500;
    text-decoration: none;
}

.telegram-mention {
    color: #3390ec;
    font-weight: 500;
    text-decoration: none;
}

.telegram-post-text strong {
    font-weight: 600;
    color: #ffffff;
}

.telegram-post-text em {
    font-style: italic;
    color: #ffffff;
}

.telegram-post-text a {
    color: #3390ec;
    text-decoration: none;
}

.telegram-post-text a:hover {
    text-decoration: underline;
}

/* Состояния загрузки */
.telegram-loading {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 15px;
}

.telegram-error {
    padding: 20px 16px;
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border: none;
    margin: 16px;
    border-radius: 0;
    font-size: 14px;
}

/* Анимации */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(8px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Адаптивность */
@media (max-width: 480px) {
    .telegram-header-content {
        padding: 10px 12px;
    }
    
    .telegram-post-text {
        padding: 12px;
        font-size: 14px;
    }
    
    .telegram-post-footer {
        padding: 8px 12px 12px 12px;
    }
    
    .telegram-avatar {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .telegram-channel-name {
        font-size: 16px;
    }
    
    .telegram-channel-members {
        font-size: 13px;
    }
}
