/* ==========================================
   ExplodingViews — Global SaaS Styles
   ========================================== */

:root {
    --bg: #0a0a0b;
    --bg-raised: #141416;
    --bg-hover: #1c1c20;
    --border: #27272a;
    --text: #f0f0f2;
    --text-muted: #8b8b94;
    --accent: #ef4444;
    --accent-glow: rgba(239, 68, 68, 0.15);
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.08);
    --blue: #60a5fa;
    --purple: #a78bfa;
    --purple-bg: rgba(167, 139, 250, 0.1);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    /* Czysty, profesjonalny font systemowy zamiast zewnętrznych fontów Google */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* --- UKŁAD (LAYOUT) --- */
.app-layout { display: flex; min-height: 100vh; }

.main-content {
    flex: 1;
    margin-left: 260px; /* Miejsce na sidebar */
    display: flex;
    flex-direction: column;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-raised);
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    display: flex; align-items: center; gap: 12px;
    padding: 24px; font-size: 20px; font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo span { color: var(--accent); }
.logo-icon { font-size: 24px; }

.sidebar-section { padding: 24px 16px 0; }
.sidebar-label { 
    font-size: 11px; text-transform: uppercase; color: var(--text-muted); 
    margin-bottom: 12px; padding-left: 8px; font-weight: 600; letter-spacing: 0.5px;
}

.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 8px;
    color: var(--text-muted); font-weight: 500; font-size: 14px;
    transition: all 0.2s; margin-bottom: 4px; position: relative;
}

.sidebar-link:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-link.active { background: var(--accent-glow); color: var(--accent); }

.link-badge {
    font-size: 10px; padding: 2px 6px; border-radius: 4px;
    margin-left: auto; font-weight: 700;
}
.link-badge-new  { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.link-badge-soon { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.link-badge-beta { background: rgba(96,165,250,0.12); color: #60a5fa; border: 1px solid rgba(96,165,250,0.2); }

.sidebar-footer { 
    padding: 24px; border-top: 1px solid var(--border); 
    font-size: 12px; color: var(--text-muted); margin-top: auto; 
}

/* --- SIDEBAR SUBMENU (Rankings) --- */
.sidebar-group { position: relative; }

.sidebar-toggle {
    width: 100%; text-align: left; cursor: pointer;
    background: none; border: none; font-family: inherit;
}
.sidebar-toggle .toggle-arrow {
    margin-left: auto; transition: transform 0.2s ease;
}
.sidebar-group.open .toggle-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    max-height: 0; overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    opacity: 0;
}
.sidebar-group.open .sidebar-submenu {
    max-height: 200px; opacity: 1;
}

.sidebar-sublink {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px 8px 40px; border-radius: 6px;
    color: var(--text-muted); font-size: 13px; font-weight: 500;
    transition: all 0.15s; text-decoration: none; margin-bottom: 2px;
}
.sidebar-sublink:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-sublink.active { color: var(--accent); background: var(--accent-glow); }
.sidebar-sublink .link-badge { font-size: 9px; margin-left: auto; }

/* --- KONTENT GŁÓWNY --- */
.page-inner { padding: 32px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* --- TABELA RANKINGÓW (globalna) --- */
.rankings-table { width: 100%; border-collapse: collapse; }
.rankings-table th {
    text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--text-muted); padding: 10px 12px;
    border-bottom: 2px solid var(--border); white-space: nowrap;
}
.rankings-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
.rankings-table tr:hover td { background: var(--bg-hover); }
.rankings-table tbody tr:last-child td { border-bottom: none; }
.channel-avatar { width: 28px; height: 28px; border-radius: 50%; margin-right: 8px; object-fit: cover; flex-shrink: 0; }
.channel-name-cell { display: flex; align-items: center; }
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--text-muted); font-size: 15px; }

/* FILTRY */
.filter-bar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-raised); padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50; flex-wrap: wrap; gap: 16px;
}

.filters-left { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }

.filter-btn, .filter-select, .sort-select {
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text); padding: 8px 14px; border-radius: 8px;
    font-size: 13px; font-weight: 500; cursor: pointer; transition: 0.2s;
}

.filter-btn:hover, .filter-select:hover { border-color: #444; }
.filter-bar select {
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text); padding: 7px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 500; cursor: pointer;
}
.filter-bar select:focus { outline: none; border-color: var(--accent); }
.filter-btn.active { background: var(--accent-glow); color: var(--accent); border-color: rgba(239,68,68,0.3); }

/* --- LISTA FILMÓW (KARTY) --- */
/* --- LISTA FILMÓW (KARTY) --- */
#video-list { 
    display: flex; 
    flex-direction: column; 
    gap: 32px; /* Większy odstęp, skoro nie mamy już ramek */
    margin-top: 24px; 
}

.video-card {
    display: flex; 
    background: transparent; /* Brak szarego tła */
    border: none; /* CAŁKOWITE USUNIĘCIE RAMEK */
    padding: 0; /* Usunięcie wewnętrznych marginesów */
    gap: 24px; 
    align-items: flex-start;
}

/* Opcjonalnie: bardzo delikatne podświetlenie tła po najechaniu myszką, jak na YT */
.video-card:hover { 
    background: transparent; 
    transform: none; /* Usunięty efekt "podskakiwania" */
}

.video-rank { 
    font-size: 26px; /* Delikatnie większy numer */
    font-weight: 700; 
    color: #666; /* Odrobinę jaśniejszy, żeby nie był czarną plamą */
    width: 32px; 
    text-align: right; 
    /* Miniatura ma 157px wysokości. Margines 60px idealnie wyśrodkuje numer względem niej */
    margin-top: 60px; 
}

/* Duże, ładne miniatury 16:9 - BEZ RAMEK */
.video-thumb {
    position: relative; 
    width: 280px; 
    flex-shrink: 0;
    overflow: hidden; 
    border-radius: 12px; /* Lekkie zaokrąglenie samej miniatury dla miękkiego wyglądu */
    aspect-ratio: 16/9;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }

.mobile-rank { display: none; position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,0.8); padding: 2px 8px; border-radius: 6px; font-weight: 700; font-size: 14px; z-index: 2; }
.duration-badge { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,0.85); padding: 3px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; z-index: 2; }

.video-info { flex: 1; min-width: 0; }
.video-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; display: block; line-height: 1.4; color: #fff; }
.video-title:hover { color: var(--blue); }

.video-meta { 
    font-size: 14px; /* Zwiększyliśmy rozmiar z 13px */
    color: #bbb; /* Rozjaśniliśmy kolor (wcześniej był ciemnoszary) */
    margin-bottom: 12px; 
    display: flex; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 6px; 
}

.video-meta a { 
    font-weight: 600; /* Mocniej pogrubiona nazwa kanału */
    color: #e4e4e7; /* Jaśniejsza nazwa kanału dla lepszego kontrastu */
}
.video-meta a:hover { color: #fff; }
.dot { font-size: 8px; color: #555; }

/* PLAKIETKI - CZYTELNE I KONTRASTOWE */
.video-badges { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.badge { display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.badge svg { width: 14px; height: 14px; }

/* VPH - Jasny zielony (Wzrost) */
.badge-vph { background: rgba(34, 197, 94, 0.1); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.2); }
/* Lajki - Jasny niebieski */
.badge-likes { background: rgba(56, 189, 248, 0.1); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.2); }
/* Komentarze - Jasny fioletowy (żeby nie znikał na ciemnym tle) */
.badge-comments { background: rgba(167, 139, 250, 0.1); color: #c084fc; border: 1px solid rgba(167, 139, 250, 0.2); }
/* Breakout - Pomarańczowy */
.badge-breakout { background: rgba(249, 115, 22, 0.1); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.2); }

.details-toggle { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; padding: 0 8px; }
.details-toggle:hover { color: #fff; }

/* Rozwijane szczegóły */
.video-details { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); font-size: 13px; }
.hidden { display: none !important; }
.detail-row { display: flex; margin-bottom: 8px; align-items: center; }
.detail-label { width: 100px; color: var(--text-muted); font-weight: 500; }
.detail-value { color: #fff; }
.detail-value.gray { color: #aaa; }
.detail-label.purple, .detail-value.purple { color: var(--purple); }

.tag-chip { background: var(--bg); border: 1px solid var(--border); padding: 3px 8px; border-radius: 4px; font-size: 12px; color: #aaa; }

/* Loader & Stany puste */
.loader, .empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 15px; }

/* --- MOBILE --- */
.mobile-menu-btn { display: none; background: none; border: none; color: white; cursor: pointer; }
.mobile-filter-btn { display: none; background: none; border: none; color: white; cursor: pointer; margin-left: auto; padding: 0; }
.mobile-filter-btn.active { color: var(--accent); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 90; backdrop-filter: blur(2px); }

.mobile-topbar {
    display: none;
    align-items: center;
    background: var(--bg-raised);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* VPH Timeline Chart */
.vph-clickable { cursor: pointer; transition: all 0.15s ease; }
.vph-clickable:hover { 
    background: rgba(34, 197, 94, 0.18); 
    border-color: rgba(34, 197, 94, 0.35);
    transform: translateY(-1px);
}

.vph-chart-container,
.ev-chart-container {
    margin-top: 16px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    height: 200px;
    position: relative;
}

/* Animacja wjazdu */
.vph-chart-container[style*="display: block"],
.ev-chart-container[style*="display: block"] {
    animation: chartSlideIn 0.2s ease-out;
}

@keyframes chartSlideIn {
    from { opacity: 0; transform: translateY(-8px); max-height: 0; }
    to   { opacity: 1; transform: translateY(0);    max-height: 240px; }
}

@media (max-width: 1024px) {
    .main-content { margin-left: 0; }
    .sidebar { left: -260px; transition: 0.3s ease; }
    .sidebar.open { left: 0; }
    .sidebar-overlay.active { display: block; }
    .mobile-menu-btn { display: block; }
    .mobile-filter-btn { display: flex; align-items: center; }
    .mobile-topbar { display: flex; }

    /* Na mobile filtry są schowane — toggle przez mobile-filter-btn */
    .filter-bar { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }

    .video-card { flex-direction: column; gap: 16px; }
    .video-rank { display: none; }
    .video-thumb { width: 100%; max-width: 480px; }
    .mobile-rank { display: block; }
    .sort-label-text { display: none; }
}

/* Favicon fallback — litera w kółku gdy brak URL sponsora */
.sponsor-logo {
    width: 32px; height: 32px;
    border-radius: 6px; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sponsor-logo img {
    width: 32px; height: 32px; object-fit: contain;
}
.sponsor-logo-fallback {
    width: 32px; height: 32px;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.sponsor-logo-sm { width: 24px; height: 24px; border-radius: 4px; }
.sponsor-logo-sm.sponsor-logo-fallback { font-size: 11px; }

.sponsor-logos-cell { display: flex; align-items: center; gap: 3px; }
.sponsor-extra { font-size: 11px; color: var(--text-muted); margin-left: 2px; }
.channel-avatar { width: 28px; height: 28px; border-radius: 50%; margin-right: 8px; }
.channel-name-cell { display: flex; align-items: center; }
.sponsor-name-cell { display: flex; align-items: center; gap: 8px; }

/* Sponsor Spy — paywall, sortowanie */
.paywall-fade {
    position: relative; overflow: hidden;
}
.paywall-fade::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 120px;
    background: linear-gradient(transparent, var(--bg));
    pointer-events: none;
}
.paywall-cta {
    text-align: center; padding: 24px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 12px; margin-top: 16px;
}
.paywall-cta p { color: var(--text-muted); font-size: 14px; margin: 0; }

.filter-sort { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.sort-label  { font-size: 13px; color: var(--text-muted); }
.sort-btn {
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text); padding: 6px 14px; border-radius: 20px;
    font-size: 12px; font-weight: 500; cursor: pointer; transition: 0.2s;
}
.sort-btn:hover  { border-color: var(--accent); color: var(--accent); }
.sort-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }