/*
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. Ciemna, kinowa estetyka, w pełni konfigurowalny układ.
Version: 2.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: tubeprestige
License: GPL v2 or later
*/

/* ═══════════════════════════════════════════
   CSS 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-navbar-height: 56px;
    --tp-transition: .2s cubic-bezier(.4,0,.2,1);
    --tp-shadow: 0 1px 3px rgba(0,0,0,.5), 0 4px 20px rgba(0,0,0,.3);
    --tp-shadow-lg: 0 8px 40px rgba(0,0,0,.6);
    --tp-max-width: 1400px;
    --tp-grid-cols: 3;
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--tp-font-body);
    background: var(--tp-bg);
    color: var(--tp-text);
    line-height: 1.6;
    padding-top: calc(var(--tp-topbar-height) + var(--tp-navbar-height));
    overflow-x: hidden;
}

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 24px;
}

.tp-section {
    padding: 48px 0;
}

.tp-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.tp-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.tp-section-title svg {
    width: 22px;
    height: 22px;
    fill: var(--tp-primary);
    vertical-align: -3px;
    margin-right: 8px;
}

.tp-section-subtitle {
    color: var(--tp-text-muted);
    font-size: .9rem;
}

.tp-section-link {
    color: var(--tp-text-muted);
    font-size: .85rem;
    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; }

/* ═══════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════ */
.tp-navbar {
    position: fixed;
    top: var(--tp-topbar-height);
    left: 0;
    right: 0;
    height: var(--tp-navbar-height);
    background: rgba(9,9,11,.85);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid transparent;
    z-index: 1000;
    transition: border-color var(--tp-transition), background var(--tp-transition);
}

.tp-navbar--scrolled {
    background: rgba(9,9,11,.95);
    border-bottom-color: var(--tp-border);
}

.tp-navbar-inner {
    max-width: var(--tp-max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tp-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--tp-font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tp-text-heading);
    letter-spacing: -.02em;
    flex-shrink: 0;
}

.tp-logo-icon {
    width: 30px;
    height: 30px;
    background: var(--tp-primary);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tp-logo-icon svg { width: 16px; height: 16px; fill: #fff; }

.tp-logo span { color: var(--tp-primary); }

/* Nav links */
.tp-nav { display: flex; align-items: center; gap: 4px; }

.tp-nav a {
    padding: 6px 12px;
    font-size: .85rem;
    font-weight: 500;
    color: var(--tp-text-muted);
    border-radius: var(--tp-radius-sm);
    transition: color var(--tp-transition), background var(--tp-transition);
}

.tp-nav a:hover {
    color: var(--tp-text-heading);
    background: var(--tp-surface);
}

/* Subscribe button */
.tp-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    font-size: .82rem;
    font-weight: 600;
    background: var(--tp-primary);
    color: #fff;
    border-radius: 50px;
    transition: transform var(--tp-transition), opacity var(--tp-transition);
}

.tp-subscribe-btn:hover { transform: scale(1.04); opacity: .92; }
.tp-subscribe-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* Hamburger */
.tp-hamburger {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: var(--tp-radius-sm);
    transition: background var(--tp-transition);
}

.tp-hamburger:hover { background: var(--tp-surface); }

.tp-hamburger span,
.tp-hamburger span::before,
.tp-hamburger span::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--tp-text);
    border-radius: 1px;
    transition: transform .3s ease;
    position: relative;
}

.tp-hamburger span::before,
.tp-hamburger span::after { content: ''; position: absolute; left: 0; }
.tp-hamburger span::before { top: -6px; }
.tp-hamburger span::after { top: 6px; }

.tp-hamburger--active span { background: transparent; }
.tp-hamburger--active span::before { top: 0; transform: rotate(45deg); background: var(--tp-text); }
.tp-hamburger--active span::after { top: 0; transform: rotate(-45deg); background: var(--tp-text); }

/* Mobile Menu */
.tp-mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    top: calc(var(--tp-topbar-height) + var(--tp-navbar-height));
    background: var(--tp-bg);
    z-index: 999;
    padding: 24px;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

.tp-mobile-menu--open { opacity: 1; pointer-events: auto; }

.tp-mobile-menu a {
    display: block;
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--tp-text);
    border-radius: var(--tp-radius);
    transition: background var(--tp-transition);
}

.tp-mobile-menu a:hover { background: var(--tp-surface); }

/* ═══════════════════════════════════════════
   CHANNEL HEADER (mini hero)
   ═══════════════════════════════════════════ */
.tp-channel-header {
    padding: 36px 0 20px;
    border-bottom: 1px solid var(--tp-border);
}

.tp-channel-info {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.tp-channel-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--tp-border);
    flex-shrink: 0;
}

.tp-channel-text { flex: 1; min-width: 200px; }
.tp-channel-name { font-size: 1.25rem; font-weight: 700; }
.tp-channel-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--tp-text-muted);
    font-size: .82rem;
    margin-top: 4px;
    flex-wrap: wrap;
}

.tp-channel-meta span { white-space: nowrap; }

.tp-channel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   FEATURED / HERO VIDEO
   ═══════════════════════════════════════════ */
.tp-featured {
    padding: 32px 0 0;
}

.tp-featured-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.tp-featured-layout--side {
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}

.tp-featured-player {
    position: relative;
    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: 12px;
    padding: 18px 0;
}

.tp-featured-layout--side .tp-featured-info {
    padding: 4px 0;
}

.tp-featured-title {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
}

.tp-featured-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--tp-text-muted);
    font-size: .82rem;
}

.tp-featured-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tp-featured-meta-item svg { width: 14px; height: 14px; fill: currentColor; }

.tp-featured-desc {
    color: var(--tp-text-muted);
    font-size: .88rem;
    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 (16:9 responsive iframe)
   ═══════════════════════════════════════════ */
.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 {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
}

.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);
}

.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, 3), 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); border-radius: var(--tp-radius); }

.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, filter .4s ease;
}

.tp-video-card:hover .tp-video-card-thumb img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* Play overlay */
.tp-video-card-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
}

.tp-video-card:hover .tp-video-card-play { opacity: 1; }

.tp-video-card-play-icon {
    width: 52px;
    height: 52px;
    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 ease;
}

.tp-video-card:hover .tp-video-card-play-icon { transform: scale(1); }
.tp-video-card-play-icon svg { width: 22px; height: 22px; fill: #fff; margin-left: 2px; }

/* Duration badge */
.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;
    letter-spacing: .03em;
}

/* Card body */
.tp-video-card-body {
    padding: 10px 2px 4px;
}

.tp-video-card-title {
    font-size: .88rem;
    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: 4px;
}

.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: .78rem;
}

.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 ease;
    padding: 24px;
}

.tp-lightbox--open { opacity: 1; pointer-events: auto; }

.tp-lightbox-inner {
    width: 100%;
    max-width: 1100px;
    border-radius: var(--tp-radius-lg);
    overflow: hidden;
    box-shadow: var(--tp-shadow-lg);
}

.tp-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    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);
}

.tp-lightbox-close:hover { background: rgba(255,255,255,.2); }

/* ═══════════════════════════════════════════
   ABOUT SECTION (minimal)
   ═══════════════════════════════════════════ */
.tp-about {
    border-top: 1px solid var(--tp-border);
}

.tp-about-inner {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.tp-about-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--tp-border);
    flex-shrink: 0;
}

.tp-about-content { flex: 1; min-width: 260px; }
.tp-about-name { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }

.tp-about-bio {
    color: var(--tp-text-muted);
    font-size: .88rem;
    line-height: 1.6;
    max-width: 600px;
}

.tp-about-stats {
    display: flex;
    gap: 28px;
    margin-top: 16px;
}

.tp-about-stat-value {
    font-family: var(--tp-font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--tp-text-heading);
}

.tp-about-stat-label {
    font-size: .75rem;
    color: var(--tp-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.tp-social-links {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.tp-social-link {
    width: 36px;
    height: 36px;
    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: 16px; height: 16px; fill: currentColor; }

/* ═══════════════════════════════════════════
   CTA
   ═══════════════════════════════════════════ */
.tp-cta {
    border-top: 1px solid var(--tp-border);
    text-align: center;
}

.tp-cta h2 { font-size: 1.5rem; margin-bottom: 8px; }

.tp-cta p {
    color: var(--tp-text-muted);
    font-size: .9rem;
    margin-bottom: 20px;
}

.tp-cta-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.tp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: .88rem;
    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: 48px;
    padding: 32px 0;
    border-top: 1px solid var(--tp-border);
    color: var(--tp-text-muted);
    font-size: .8rem;
}

.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: 30px;
    height: 30px;
    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 / SPINNER
   ═══════════════════════════════════════════ */
.tp-grid-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 0;
    color: var(--tp-text-muted);
    font-size: .88rem;
}

.tp-spinner {
    width: 24px;
    height: 24px;
    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); } }

/* Admin debug notice */
.tp-admin-notice {
    background: rgba(255,165,0,.08);
    border: 1px solid rgba(255,165,0,.25);
    border-radius: var(--tp-radius);
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: .84rem;
    line-height: 1.6;
    color: var(--tp-text);
}

.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: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    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); background: var(--tp-surface-hover); }
.tp-back-to-top svg { width: 18px; height: 18px; fill: var(--tp-text); }

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

.tp-animate.tp-animated {
    opacity: 1;
    transform: translateY(0);
}

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

@media (max-width: 900px) {
    :root { --tp-grid-cols: 2; }

    .tp-nav { display: none; }
    .tp-hamburger { display: flex; }
    .tp-mobile-menu { display: flex; }

    .tp-channel-info { gap: 14px; }
    .tp-channel-actions { width: 100%; }
}

@media (max-width: 560px) {
    :root { --tp-grid-cols: 1; }

    .tp-container { padding: 0 16px; }
    .tp-section { padding: 32px 0; }
    .tp-channel-header { padding: 24px 0 16px; }
    .tp-featured { padding: 20px 0 0; }

    .tp-video-grid { gap: 16px; }
    .tp-about-inner { gap: 16px; }
    .tp-about-stats { gap: 20px; }
}
