/*
Theme Name: TubePrestige
Theme URI: https://tubeprestige.dev
Author: TubePrestige
Description: Motyw WordPress dla twórców YouTube — filmy z kanału wyświetlane automatycznie przez YouTube Data API v3.
Version: 2.1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: tubeprestige
License: GPL v2 or later
*/

/* ═══════ VARIABLES ═══════ */
:root {
    --tp-primary: #ff0033;
    --tp-accent: #ffd700;
    --tp-bg: #09090b;
    --tp-bg-alt: #111114;
    --tp-surface: #18181b;
    --tp-surface-hover: #222226;
    --tp-border: #27272a;
    --tp-text: #e4e4e7;
    --tp-text-heading: #fafafa;
    --tp-text-muted: #71717a;
    --tp-font-heading: 'Outfit', sans-serif;
    --tp-font-body: 'Geist', 'DM Sans', sans-serif;
    --tp-radius: 10px;
    --tp-radius-lg: 14px;
    --tp-radius-sm: 6px;
    --tp-topbar-height: 0px;
    --tp-logo-size: 90px;
    --tp-transition: .2s cubic-bezier(.4,0,.2,1);
    --tp-shadow-lg: 0 8px 40px rgba(0,0,0,.6);
    --tp-max-width: 1400px;
    --tp-grid-cols: 3;
}

/* ═══════ RESET ═══════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
    font-family: var(--tp-font-body);
    background: var(--tp-bg);
    color: var(--tp-text);
    line-height: 1.6;
    padding-top: var(--tp-topbar-height);
    overflow-x: hidden;
    min-width: 0;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
h1,h2,h3,h4 { font-family: var(--tp-font-heading); color: var(--tp-text-heading); font-weight: 700; line-height: 1.2; }

/* ═══════ LAYOUT ═══════ */
.tp-container { max-width: var(--tp-max-width); margin: 0 auto; padding: 0 20px; width: 100%; }
.tp-section { padding: 40px 0; }
.tp-section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.tp-section-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.tp-section-title svg { width: 20px; height: 20px; fill: var(--tp-primary); vertical-align: -2px; margin-right: 6px; }
.tp-section-link { color: var(--tp-text-muted); font-size: .82rem; display: inline-flex; align-items: center; gap: 4px; transition: color var(--tp-transition); flex-shrink: 0; }
.tp-section-link:hover { color: var(--tp-primary); }
.tp-section-link svg { width: 14px; height: 14px; fill: currentColor; }

/* ═══════ HERO AREA ═══════ */
.tp-hero-area { position: relative; overflow: hidden; }

/* ═══════ SITE HEADER ═══════ */
.tp-site-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0 14px;
    flex-wrap: wrap;
}

.tp-logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.tp-logo-icon {
    width: var(--tp-logo-size);
    height: var(--tp-logo-size);
    background: var(--tp-primary);
    border-radius: calc(var(--tp-logo-size) * .24);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(255,0,51,.3);
    flex-shrink: 0;
}
.tp-logo-icon svg { width: calc(var(--tp-logo-size) * .5); height: calc(var(--tp-logo-size) * .5); fill: #fff; }

.tp-logo-img {
    height: var(--tp-logo-size);
    width: auto;
    max-width: 280px;
    border-radius: calc(var(--tp-logo-size) * .2);
    object-fit: contain;
}

.tp-logo-text {
    font-family: var(--tp-font-heading);
    font-size: clamp(1.4rem, 4vw, 2.4rem);
    font-weight: 700;
    color: var(--tp-text-heading);
    letter-spacing: -.03em;
    line-height: 1.1;
}
.tp-logo-text span { color: var(--tp-primary); }

/* Channel bar inside header */
.tp-channel-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    flex-shrink: 1;
    min-width: 0;
}

.tp-channel-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--tp-border); flex-shrink: 0; }
.tp-channel-text { min-width: 0; }
.tp-channel-name { font-size: .9rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-channel-meta { display: flex; gap: 10px; color: var(--tp-text-muted); font-size: .75rem; flex-wrap: wrap; }
.tp-channel-meta span { white-space: nowrap; }

.tp-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: .82rem;
    font-weight: 600;
    background: var(--tp-primary);
    color: #fff;
    border-radius: 50px;
    transition: transform var(--tp-transition), opacity var(--tp-transition);
    flex-shrink: 0;
    white-space: nowrap;
}
.tp-subscribe-btn:hover { transform: scale(1.04); opacity: .92; }
.tp-subscribe-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* ═══════ MENU BAR ═══════ */
.tp-menu-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 10px 0;
    border-top: 1px solid var(--tp-border);
    border-bottom: 1px solid var(--tp-border);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tp-menu-bar::-webkit-scrollbar { display: none; }

.tp-menu-link {
    padding: 6px 16px;
    font-size: .88rem;
    font-weight: 500;
    color: var(--tp-text-muted);
    border-radius: var(--tp-radius-sm);
    transition: color var(--tp-transition), background var(--tp-transition);
    white-space: nowrap;
    flex-shrink: 0;
}
.tp-menu-link:hover { color: var(--tp-text-heading); background: var(--tp-surface); }

/* ═══════ FEATURED VIDEO ═══════ */
.tp-featured { padding: 24px 0 0; }
.tp-featured-layout { display: grid; grid-template-columns: 1fr; }
.tp-featured-layout--side { grid-template-columns: 1.6fr 1fr; gap: 24px; }
.tp-featured-player { border-radius: var(--tp-radius-lg); overflow: hidden; background: #000; }
.tp-featured-player .tp-video-wrapper { border-radius: var(--tp-radius-lg); overflow: hidden; }
.tp-featured-info { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; }
.tp-featured-layout--side .tp-featured-info { padding: 4px 0; }
.tp-featured-title { font-size: 1.15rem; font-weight: 700; line-height: 1.35; }
.tp-featured-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--tp-text-muted); font-size: .8rem; }
.tp-featured-meta-item { display: inline-flex; align-items: center; gap: 4px; }
.tp-featured-meta-item svg { width: 14px; height: 14px; fill: currentColor; }
.tp-featured-desc { color: var(--tp-text-muted); font-size: .86rem; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tp-featured-layout--side .tp-featured-desc { -webkit-line-clamp: 6; }

/* ═══════ VIDEO WRAPPER ═══════ */
.tp-video-wrapper { position: relative; padding-bottom: 56.25%; background: #000; }
.tp-video-wrapper iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ═══════ PLAYLIST TABS ═══════ */
.tp-playlist-tabs-wrap {
    position: relative;
    margin-bottom: 20px;
}

/* Gradient fade indicators */
.tp-playlist-tabs-wrap::before,
.tp-playlist-tabs-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
}
.tp-playlist-tabs-wrap::before { left: 0; background: linear-gradient(90deg, var(--tp-bg) 0%, transparent 100%); }
.tp-playlist-tabs-wrap::after { right: 0; background: linear-gradient(-90deg, var(--tp-bg) 0%, transparent 100%); }
.tp-playlist-tabs-wrap.can-scroll-left::before { opacity: 1; }
.tp-playlist-tabs-wrap.can-scroll-right::after { opacity: 1; }

.tp-playlist-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    scroll-snap-type: x proximity;
}
.tp-playlist-tabs::-webkit-scrollbar { display: none; }

.tp-playlist-tab {
    padding: 7px 16px;
    font-size: .82rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--tp-text-muted);
    background: var(--tp-surface);
    border: 1px solid var(--tp-border);
    border-radius: 50px;
    transition: all var(--tp-transition);
    flex-shrink: 0;
    scroll-snap-align: start;
}
.tp-playlist-tab:hover { color: var(--tp-text); border-color: var(--tp-text-muted); }
.tp-playlist-tab.active { color: #fff; background: var(--tp-primary); border-color: var(--tp-primary); }
.tp-playlist-tab small { opacity: .6; margin-left: 3px; font-size: .75em; }

/* ═══════ VIDEO GRID ═══════ */
.tp-video-grid { display: grid; grid-template-columns: repeat(var(--tp-grid-cols), 1fr); gap: 20px; }

/* ═══════ VIDEO CARD ═══════ */
.tp-video-card { cursor: pointer; border-radius: var(--tp-radius); transition: transform var(--tp-transition); outline: none; }
.tp-video-card:hover { transform: translateY(-3px); }
.tp-video-card:focus-visible { box-shadow: 0 0 0 2px var(--tp-primary); }
.tp-video-card-thumb { position: relative; border-radius: var(--tp-radius); overflow: hidden; background: var(--tp-surface); aspect-ratio: 16/9; }
.tp-video-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.tp-video-card:hover .tp-video-card-thumb img { transform: scale(1.05); }
.tp-video-card-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .25s; }
.tp-video-card:hover .tp-video-card-play { opacity: 1; }
.tp-video-card-play-icon { width: 48px; height: 48px; background: rgba(255,0,51,.92); border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 20px rgba(255,0,51,.4); transform: scale(.85); transition: transform .25s; }
.tp-video-card:hover .tp-video-card-play-icon { transform: scale(1); }
.tp-video-card-play-icon svg { width: 20px; height: 20px; fill: #fff; margin-left: 2px; }
.tp-video-card-duration { position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,.82); color: #fff; font-size: .72rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; font-variant-numeric: tabular-nums; }
.tp-video-card-body { padding: 8px 2px 4px; }
.tp-video-card-title { font-size: .86rem; font-weight: 600; line-height: 1.35; color: var(--tp-text-heading); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 3px; }
.tp-video-card-title a { color: inherit; }
.tp-video-card-title a:hover { color: var(--tp-primary); }
.tp-video-card-meta { display: flex; align-items: center; gap: 8px; color: var(--tp-text-muted); font-size: .75rem; }
.tp-video-card-meta span { white-space: nowrap; }
.tp-video-card-meta .tp-dot::before { content: '·'; margin: 0 2px; }

/* ═══════ LIGHTBOX ═══════ */
.tp-lightbox { position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .3s; padding: 16px; }
.tp-lightbox--open { opacity: 1; pointer-events: auto; }
.tp-lightbox-inner { width: 100%; max-width: 1100px; border-radius: var(--tp-radius-lg); overflow: hidden; }
.tp-lightbox-close { position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.5rem; border-radius: 50%; background: rgba(255,255,255,.1); backdrop-filter: blur(10px); transition: background var(--tp-transition); z-index: 1; }
.tp-lightbox-close:hover { background: rgba(255,255,255,.2); }

/* ═══════ ABOUT ═══════ */
.tp-about { border-top: 1px solid var(--tp-border); }
.tp-about-inner { display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.tp-about-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 2px solid var(--tp-border); flex-shrink: 0; }
.tp-about-content { flex: 1; min-width: 200px; }
.tp-about-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.tp-about-bio { color: var(--tp-text-muted); font-size: .86rem; line-height: 1.6; max-width: 600px; }
.tp-about-stats { display: flex; gap: 24px; margin-top: 14px; flex-wrap: wrap; }
.tp-about-stat-value { font-family: var(--tp-font-heading); font-size: 1.2rem; font-weight: 700; color: var(--tp-text-heading); }
.tp-about-stat-label { font-size: .72rem; color: var(--tp-text-muted); text-transform: uppercase; letter-spacing: .05em; }
.tp-social-links { display: flex; gap: 8px; margin-top: 14px; }
.tp-social-link { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: var(--tp-surface); border: 1px solid var(--tp-border); border-radius: 50%; transition: all var(--tp-transition); }
.tp-social-link:hover { border-color: var(--tp-primary); background: rgba(255,0,51,.1); color: var(--tp-primary); }
.tp-social-link svg { width: 15px; height: 15px; fill: currentColor; }

/* ═══════ CTA ═══════ */
.tp-cta { border-top: 1px solid var(--tp-border); text-align: center; }
.tp-cta h2 { font-size: 1.4rem; margin-bottom: 6px; }
.tp-cta p { color: var(--tp-text-muted); font-size: .88rem; margin-bottom: 18px; }
.tp-cta-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tp-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; font-size: .86rem; font-weight: 600; border-radius: 50px; transition: all var(--tp-transition); }
.tp-btn svg { width: 16px; height: 16px; fill: currentColor; }
.tp-btn-primary { background: var(--tp-primary); color: #fff; }
.tp-btn-primary:hover { opacity: .9; transform: translateY(-1px); }
.tp-btn-outline { background: var(--tp-surface); color: var(--tp-text); border: 1px solid var(--tp-border); }
.tp-btn-outline:hover { border-color: var(--tp-text-muted); }

/* ═══════ FOOTER ═══════ */
.tp-footer { margin-top: 40px; padding: 28px 0; border-top: 1px solid var(--tp-border); color: var(--tp-text-muted); font-size: .78rem; }
.tp-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tp-footer-social { display: flex; gap: 6px; }
.tp-footer-social a { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: color var(--tp-transition); }
.tp-footer-social a:hover { color: var(--tp-text-heading); }
.tp-footer-social svg { width: 14px; height: 14px; fill: currentColor; }

/* ═══════ LOADING ═══════ */
.tp-grid-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px 0; color: var(--tp-text-muted); font-size: .86rem; }
.tp-spinner { width: 22px; height: 22px; border: 2.5px solid var(--tp-border); border-top-color: var(--tp-primary); border-radius: 50%; animation: tp-spin .6s linear infinite; }
@keyframes tp-spin { to { transform: rotate(360deg); } }

.tp-admin-notice { background: rgba(255,165,0,.08); border: 1px solid rgba(255,165,0,.25); border-radius: var(--tp-radius); padding: 12px 16px; margin-bottom: 18px; font-size: .82rem; line-height: 1.6; }
.tp-admin-notice a { color: var(--tp-accent); text-decoration: underline; }
.tp-admin-notice strong { color: #ffa500; }

/* Back to top */
.tp-back-to-top { position: fixed; bottom: 20px; right: 20px; width: 38px; height: 38px; background: var(--tp-surface); border: 1px solid var(--tp-border); border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transform: translateY(10px); transition: all var(--tp-transition); z-index: 100; }
.tp-back-to-top--visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.tp-back-to-top:hover { border-color: var(--tp-primary); }
.tp-back-to-top svg { width: 18px; height: 18px; fill: var(--tp-text); }

/* ═══════ SCROLL ANIMATIONS ═══════ */
.tp-animate { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.tp-animate.tp-animated { opacity: 1; transform: translateY(0); }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 1100px) {
    .tp-featured-layout--side { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    :root { --tp-grid-cols: 2; --tp-logo-size: 64px; }
    .tp-site-header { gap: 12px; }
    .tp-channel-bar { display: none; } /* Hide on tablet, info is in about section */
    .tp-logo-text { font-size: 1.6rem; }
}

@media (max-width: 560px) {
    :root { --tp-grid-cols: 1; --tp-logo-size: 52px; }
    .tp-container { padding: 0 14px; }
    .tp-section { padding: 28px 0; }
    .tp-site-header { padding: 12px 0 10px; gap: 10px; }
    .tp-logo { gap: 10px; }
    .tp-logo-text { font-size: 1.3rem; }
    .tp-logo-img { max-width: 180px; }
    .tp-featured { padding: 16px 0 0; }
    .tp-featured-player { border-radius: var(--tp-radius); }
    .tp-featured-player .tp-video-wrapper { border-radius: var(--tp-radius); }
    .tp-featured-info { padding: 10px 0; gap: 8px; }
    .tp-featured-title { font-size: 1rem; }
    .tp-video-grid { gap: 14px; }
    .tp-video-card-play-icon { width: 42px; height: 42px; }
    .tp-video-card-play-icon svg { width: 18px; height: 18px; }
    .tp-about-inner { gap: 14px; }
    .tp-about-avatar { width: 56px; height: 56px; }
    .tp-about-stats { gap: 16px; }
    .tp-cta h2 { font-size: 1.2rem; }
    .tp-subscribe-btn { padding: 7px 14px; font-size: .78rem; }
    .tp-btn { padding: 9px 18px; font-size: .82rem; }
    .tp-menu-link { padding: 6px 12px; font-size: .82rem; }
    .tp-lightbox { padding: 8px; }
    .tp-playlist-tab { padding: 6px 12px; font-size: .78rem; }
    .tp-section-title { font-size: 1.15rem; }
}

@media (max-width: 380px) {
    .tp-container { padding: 0 10px; }
    .tp-subscribe-btn span { display: none; } /* Just icon on very small */
    .tp-logo-text { font-size: 1.1rem; }
}
