* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; width: 100%; max-width: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f4f6f8; color: #202124; line-height: 1.5; }
img { max-width: 100%; height: auto; display: block; }

/* TREND BAR / TOP KANALI */
.trend-bar { background: #ffffff; border-bottom: 1px solid #edf0f2; padding: 8px 0; font-size: 12.5px; overflow-x: auto; white-space: nowrap; width: 100%; -webkit-overflow-scrolling: touch; }
.trend-bar-inner { max-width: 1240px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.trend-tag { text-decoration: none; font-weight: 700; padding: 4px 10px; border-radius: 20px; background: #f5f3ff; color: #4338ca; border: 1px solid #e0e7ff; display: inline-flex; align-items: center; gap: 6px; transition: all 0.15s; flex-shrink: 0; }
.trend-tag:hover { background: #ede9fe; color: #6366f1; border-color: #c7d2fe; }
.trend-tag.active { background: #6366f1; color: #fff; border-color: #6366f1; box-shadow: 0 2px 6px rgba(99,102,241,0.25); }
.trend-rank-badge { font-size: 10px; font-weight: 800; background: #e0e7ff; color: #4338ca; padding: 1px 5px; border-radius: 10px; line-height: 1.2; }
.trend-tag.active .trend-rank-badge { background: #4338ca; color: #fff; }
.channel-logo-top { max-height: 16px; max-width: 32px; object-fit: contain; }

.portal-layout { max-width: 1240px; margin: 25px auto; padding: 0 20px; display: grid; grid-template-columns: 310px 1fr; gap: 30px; align-items: start; width: 100%; }
.main-tv-feed { min-width: 0; width: 100%; }

.tv-sidebar { 
    background: #ffffff; 
    border: 1px solid #e2e8f0; 
    border-radius: 16px; 
    padding: 18px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.03); 
    position: sticky; 
    top: 80px; 
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-title { font-size: 14px; font-weight: 800; color: #0f172a; border-bottom: 2px solid #6366f1; padding-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.tv-groups-container { display: flex; flex-direction: column; gap: 6px; max-height: 480px; overflow-y: auto; padding-right: 2px; }
.tv-group-header { font-size: 13px; font-weight: 700; color: #334155; background: #f8fafc; border: 1px solid #e2e8f0; padding: 9px 12px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: all 0.2s; user-select: none; }
.tv-group-header:hover { background: #f5f3ff; color: #6366f1; }
.tv-group-header::after { content: '▼'; font-size: 9px; transition: transform 0.2s; }
.tv-group-header.active::after { transform: rotate(180deg); }
.tv-group-header.active { background: #e0e7ff; color: #4338ca; border-color: #c7d2fe; }

.tv-group-content { display: none; flex-direction: column; gap: 4px; padding-left: 6px; margin-top: 4px; margin-bottom: 6px; }
.tv-group-content.open { display: flex; }

.channel-item-link { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: #334155; background: #ffffff; border: 1px solid #f1f5f9; transition: all 0.2s; font-size: 13px; font-weight: 600; }
.channel-item-link:hover { background: #f5f3ff; color: #6366f1; border-color: #ddd6fe; }
.channel-item-link.active { background: #6366f1; color: #fff; border-color: #6366f1; }

.channel-logo-img { max-height: 20px; max-width: 42px; object-fit: contain; }
.channel-logo-hero { max-height: 38px; max-width: 80px; object-fit: contain; }

.tv-schedule-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 26px; box-shadow: 0 4px 14px rgba(0,0,0,0.03); }
.tv-hero-header { display: flex; justify-content: space-between; align-items: center; gap: 15px; border-bottom: 2px solid #6366f1; padding-bottom: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.tv-channel-title { font-size: 22px; font-weight: 800; color: #0f172a; display: flex; align-items: center; gap: 12px; margin: 0; }

.tv-date-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tv-date-tab { padding: 8px 18px; font-size: 13.5px; font-weight: 700; text-decoration: none; color: #334155; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 20px; transition: all 0.2s; }
.tv-date-tab:hover { background: #f5f3ff; color: #6366f1; border-color: #ddd6fe; }
.tv-date-tab.active { background: #6366f1; color: #fff; border-color: #6366f1; box-shadow: 0 2px 8px rgba(99,102,241,0.3); }

.genre-chips-wrapper { 
    display: flex; 
    gap: 8px; 
    margin-bottom: 18px; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
    scrollbar-width: none; 
    padding-bottom: 4px; 
}
.genre-chips-wrapper::-webkit-scrollbar { display: none; }
.genre-chip {
    padding: 6px 14px;
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    user-select: none;
}
.genre-chip:hover { background: #ede9fe; color: #6366f1; border-color: #ddd6fe; }
.genre-chip.active { background: #4338ca; color: #fff; border-color: #4338ca; box-shadow: 0 2px 6px rgba(67,56,202,0.25); }

.prime-time-box { background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%); border-radius: 14px; padding: 18px; color: #fff; margin-bottom: 22px; box-shadow: 0 4px 16px rgba(30,27,75,0.25); border-left: 4px solid #a855f7; }
.prime-time-title { font-size: 14px; font-weight: 800; color: #c084fc; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.prime-time-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.prime-item { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 10px; }
.prime-item-time { font-size: 12px; font-weight: 800; color: #38bdf8; margin-bottom: 2px; }
.prime-item-name { font-size: 13.5px; font-weight: 700; color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tv-schedule-list { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.tv-row { background: #ffffff; border: 1px solid #e2e8f0; padding: 14px 16px; border-radius: 10px; display: flex; align-items: flex-start; gap: 16px; transition: all 0.2s; }
.tv-row:hover { border-color: #cbd5e1; background: #f8fafc; }
.tv-row.aktuelna-emisija { border-left: 5px solid #6366f1; background: #f5f3ff; border-color: #c7d2fe; box-shadow: 0 2px 10px rgba(99,102,241,0.12); }

.tv-time { font-size: 15px; font-weight: 800; color: #6366f1; min-width: 55px; padding-top: 2px; }
.tv-details { flex-grow: 1; min-width: 0; }
.tv-show-title { font-size: 15.5px; font-weight: 800; color: #0f172a; margin-bottom: 3px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.tv-show-desc { font-size: 13px; color: #64748b; line-height: 1.5; }

.live-badge { display: inline-flex; align-items: center; gap: 4px; background: #e11d48; color: #fff; font-size: 10.5px; font-weight: 800; padding: 2px 8px; border-radius: 12px; text-transform: uppercase; animation: liveBlink 1.5s infinite; }
@keyframes liveBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.social-share-strip { display: flex; align-items: center; gap: 8px; margin-top: 15px; margin-bottom: 15px; flex-wrap: wrap; }
.share-label { font-size: 12.5px; font-weight: 700; color: #64748b; margin-right: 4px; }
.share-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; text-decoration: none; font-size: 14px; font-weight: bold; transition: opacity 0.2s, transform 0.2s; }
.share-btn:hover { opacity: 0.85; transform: scale(1.08); }
.share-fb { background: #1877f2; }
.share-tw { background: #000000; }
.share-wa { background: #25d366; }
.share-vb { background: #7360f2; }
.share-tg { background: #24a1de; }

.side-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 18px; box-shadow: 0 4px 12px rgba(0,0,0,0.03); width: 100%; margin-top: 10px; }
.side-card-title { font-size: 13.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid #f1f3f4; display: flex; justify-content: space-between; align-items: center; }
.news-mini-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.news-mini-item { display: flex; gap: 10px; text-decoration: none; color: inherit; align-items: center; border-bottom: 1px solid #f8fafc; padding-bottom: 8px; }
.news-mini-item:hover .news-mini-title { color: #6366f1; }
.news-mini-thumb { width: 55px; height: 45px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #e2e8f0; }
.news-mini-title { font-size: 13px; font-weight: 700; line-height: 1.35; color: #1e293b; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 1024px) {
    .portal-layout { grid-template-columns: 1fr; }
    .tv-sidebar { position: static; }
}

@media (max-width: 768px) {
    .portal-layout { padding: 0 10px; margin: 15px auto; gap: 20px; }
    .tv-schedule-card { padding: 16px; border-radius: 12px; }
    .tv-channel-title { font-size: 18px; }
    .tv-row { padding: 10px 12px; gap: 12px; }
    .tv-time { font-size: 13.5px; min-width: 45px; }
    .tv-show-title { font-size: 14.5px; }
}