/* Toneeq's Telegraph - Clean CSS v2 */

/* === GLOBAL === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: #f4f1e8;
    color: #1a1a1a;
    line-height: 1.6;
    padding: 10px;
}

/* === CONTAINER === */
.newspaper {
    max-width: 95%;
    margin: 20px auto;
    background: #ffffff;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.15);
    padding: 30px;
    border: 1px solid #d4d4d4;
}

/* === HEADER === */
.masthead {
    text-align: center;
    border-bottom: 4px double #1a1a1a;
    padding-bottom: 20px;
    margin-bottom: 25px;
}

.header-decoration {
    font-size: 1.2em;
    color: #666;
    margin: 10px 0;
    letter-spacing: 10px;
}

.newspaper-title {
    font-size: 3.5em;
    font-weight: bold;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 15px 0;
}

.date {
    font-size: 1em;
    font-style: italic;
    margin: 10px 0;
    color: #444;
}

.motto {
    font-size: 0.85em;
    font-style: italic;
    color: #666;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    padding: 8px 0;
    margin-top: 12px;
}

/* Шапка и подвал - неселектируемые */
.masthead,
footer {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: default;
}

/* === MUSIC PLAYER === */
.music-player {
    background: #f9f9f9;
    border: 3px double #1a1a1a;
    padding: 15px;
    margin-bottom: 25px;
    text-align: center;
    position: relative;
}

.music-player h3 {
    font-size: 1.1em;
    margin-bottom: 10px;
}

#audio-player {
    width: 100%;
    max-width: 500px;
    margin: 10px auto;
    display: block;
    height: 35px;
}

#now-playing {
    font-weight: bold;
    margin: 10px 0;
    min-height: 1.5em;
}

/* ПЛЕЙЛИСТ - КОНТЕЙНЕР */
.playlist {
    margin-top: 10px;
    text-align: left;
    position: relative;
}

/* ФИКСИРОВАННЫЕ КНОПКИ (НОВОЕ!) */
.playlist-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 0;
    padding: 10px;
    flex-wrap: wrap;
    background: #f9f9f9;
    border-top: 2px solid #ddd;
    border-bottom: 2px solid #ddd;
    /* STICKY - прилипает к верху при скролле */
    position: sticky;
    top: 0;
    z-index: 100;
}

.playlist-btn {
    background: #666;
    color: #fff;
    border: none;
    padding: 6px 12px;
    font-size: 0.85em;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.2s;
}

.playlist-btn:hover {
    background: #444;
}

.playlist-btn.active {
    background: #1a1a1a;
}

/* СКРОЛЛИРУЕМЫЙ СПИСОК ТРЕКОВ */
#playlist-items {
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 0;
}

.playlist-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.playlist-item:last-child {
    border-bottom: none;
}

.playlist-item:hover {
    background: #f5f5f5;
}

.playlist-item.active {
    background: #e8e8e8;
    font-weight: bold;
}

/* Скроллбар для плейлиста */
#playlist-items::-webkit-scrollbar {
    width: 8px;
}

#playlist-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#playlist-items::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#playlist-items::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* === SEARCH === */
.search-container {
    margin: 25px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    max-width: 800px;
    padding: 0 20px;
}

#search-input {
    flex: 1;
    padding: 12px 20px;
    font-size: 1.05em;
    font-family: Georgia, serif;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    outline: none;
    transition: all 0.3s;
    background: #fafafa;
}

#search-input:focus {
    border-color: #666;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#clear-search {
    padding: 12px 18px;
    background: #666;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2em;
    transition: background 0.2s;
    line-height: 1;
}

#clear-search:hover {
    background: #444;
}

/* Подсветка найденного текста */
.highlight {
    background-color: #ffff00;
    font-weight: bold;
    padding: 2px 0;
}

.search-stats {
    text-align: center;
    color: #666;
    font-size: 0.95em;
    margin: -15px 0 20px 0;
    font-style: italic;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* === CONTENT GRID === */
.content-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

/* === COMMON STYLES FOR BOTH COLUMNS === */
.main-article,
.sidebar {
    padding-bottom: 0px;
    padding-left: 10px;
    border: 2px solid #d4d4d4;
}

/* === MAIN ARTICLE (LEFT) === */
.main-article {
    border-right: 2px solid #d4d4d4;
    padding-right: 30px;
}

.main-article h2 {
    font-size: 2.2em;
    border-bottom: 3px solid #1a1a1a;
    padding-bottom: 12px;
    margin-bottom: 20px;
    direction: rtl;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.channel-icon {
    width: auto;
    height: 1.2em;
    border-radius: 50%;
}

/* === COMMON SCROLLABLE AREA === */
.article-content,
.sidebar-box {
    font-size: 1.1em;
    padding: 20px;
    padding-bottom: 20px;
    overflow-y: auto;
    scroll-behavior: smooth;
    margin-bottom: 15px;
}

/* Левый блок - короче из-за заголовка */
.article-content {
    text-align: justify;
    min-height: 75vh;
    max-height: 75vh;
}

/* Правый блок - выше, нет заголовка */
.sidebar-box {
    min-height: 90vh;
    max-height: 90vh;
}

.article-content {
    text-align: justify;
}

/* === SIDEBAR SPECIFIC === */
.sidebar-box {
    background: #fafafa;
    font-size: 0.95em;
}

.sidebar-box h3 {
    display: none;
}

/* === SCROLLBAR STYLES === */
.article-content::-webkit-scrollbar,
.sidebar-box::-webkit-scrollbar {
    width: 10px;
}

.article-content::-webkit-scrollbar-track,
.sidebar-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.article-content::-webkit-scrollbar-thumb,
.sidebar-box::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.article-content::-webkit-scrollbar-thumb:hover,
.sidebar-box::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* === POSTS === */
.post-item {
    margin-bottom: 30px;
    padding: 0 15px 20px 15px;
    border-bottom: 2px solid #ddd;
}

.post-item:last-child {
    border-bottom: none;
}

.post-image {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin: 15px 0;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.post-text {
    margin-bottom: 15px;
}

.post-text p {
    margin-bottom: 10px;
}

.post-text a {
    color: #0066cc;
    text-decoration: underline;
    word-break: break-word;
}

.post-text a:hover {
    color: #004499;
}

.post-text a:visited {
    color: #551a8b;
}

.post-meta {
    font-size: 0.85em;
    color: #666;
    font-style: italic;
    margin-top: 10px;
    border-top: 1px dotted #ccc;
    padding-top: 8px;
}

/* === SIDEBAR POSTS === */
.sidebar-post {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.sidebar-post:last-child {
    border-bottom: none;
}

.sidebar-image {
    width: 100%;
    height: auto;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.sidebar-text {
    font-size: 0.9em;
}

.sidebar-text p {
    margin-bottom: 8px;
}

.sidebar-content {
    line-height: 1.7;
}

/* === HIDDEN ELEMENTS === */
.update-button-wrapper,
.refresh-btn,
.update-status {
    display: none;
}

/* === UTILITY === */
.loading {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 30px;
}

.error {
    background: #ffe6e6;
    border: 1px solid #cc0000;
    color: #cc0000;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.timestamp {
    font-size: 0.85em;
    color: #666;
    font-style: italic;
    margin-top: 10px;
    display: none;
}

/* === FOOTER === */
footer {
    text-align: center;
    border-top: 2px solid #1a1a1a;
    padding-top: 15px;
    margin-top: 10px;
    font-size: 0.9em;
    color: #666;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .newspaper {
        padding: 15px;
    }

    .newspaper-title {
        font-size: 2.5em;
    }

    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .main-article {
        border-right: none;
        padding-right: 0;
    }

    .article-content,
    .sidebar-box {
        max-height: 600px;
    }

    .playlist-controls {
        position: relative;
        top: auto;
    }
}
/* === VIDEO STYLES === */
.post-video,
.sidebar-video {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #000;
}

.post-video {
    max-height: 500px;
}

.sidebar-video {
    max-height: 300px;
}

/* Контролы видео */
video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.8);
}

/* === VIDEO STYLES === */
.post-video,
.sidebar-video {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #000;
}

.post-video {
    max-height: 500px;
}

.sidebar-video {
    max-height: 300px;
}

/* Контролы видео */
video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.8);
}

/* === УЛУЧШЕННОЕ ВИДЕО === */
.post-video,
.sidebar-video {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #000;
    object-fit: cover; /* Обрезает видео без чёрных полей */
    cursor: pointer;
}

.post-video {
    max-height: 500px;
}

.sidebar-video {
    max-height: 300px;
}

/* Скрываем контролы по умолчанию, показываем при наведении */
.post-video::-webkit-media-controls,
.sidebar-video::-webkit-media-controls {
    opacity: 0;
    transition: opacity 0.3s;
}

.post-video:hover::-webkit-media-controls,
.sidebar-video:hover::-webkit-media-controls {
    opacity: 1;
}

/* Для Firefox */
.post-video::-moz-media-controls,
.sidebar-video::-moz-media-controls {
    opacity: 0;
    transition: opacity 0.3s;
}

.post-video:hover::-moz-media-controls,
.sidebar-video:hover::-moz-media-controls {
    opacity: 1;
}

/* === ТЕГИ === */
.post-tags {
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e8f4f8;
    border: 1px solid #b8d4e0;
    border-radius: 12px;
    font-size: 0.85em;
    color: #2c5f7a;
    cursor: pointer;
    transition: all 0.2s;
    font-family: Georgia, serif;
}

.tag-badge:hover {
    background: #d0e8f2;
    border-color: #2c5f7a;
    transform: translateY(-1px);
}

/* Статистика тегов */
.tag-stats {
    text-align: center;
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 12px;
    margin: 15px auto;
    border-radius: 4px;
    max-width: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.clear-tag-btn {
    padding: 6px 12px;
    background: #666;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.clear-tag-btn:hover {
    background: #444;
}

/* Кнопка All Tags - газетный стиль */
#show-tags-btn {
    padding: 8px 12px;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    font-family: Georgia, serif;
    transition: all 0.2s;
    margin-left: 10px;
}

#show-tags-btn:hover {
    background: #e8e8e8;
    border-color: #999;
}

/* Модальное окно с облаком тегов */
.tag-cloud-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.tag-cloud-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.tag-cloud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 10px;
}

.tag-cloud-header h2 {
    margin: 0;
    font-family: Georgia, serif;
}

.close-modal {
    background: #666;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2em;
}

.close-modal:hover {
    background: #444;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.tag-item {
    padding: 8px 15px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: Georgia, serif;
    font-size: 1em;
}

.tag-item:hover {
    background: #e0e0e0;
    border-color: #999;
    transform: scale(1.05);
}

.tag-count {
    color: #666;
    font-size: 0.9em;
}

/* === TITLE LINK === */
.title-link {
    color: #1a1a1a;
    text-decoration: none;
    cursor: pointer;
}

.title-link:hover {
    color: #1a1a1a;
}
