/* ============================================
   DailyTube — Cinematic Dark Theme
   ============================================ */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a26;
    --bg-card-hover: #222233;
    --bg-glass: rgba(20, 20, 35, 0.85);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);

    --text-primary: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;

    --accent: #00d4ff;
    --accent-hover: #00b8e0;
    --accent-glow: rgba(0, 212, 255, 0.15);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 50px;

    --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', system-ui, -apple-system, sans-serif;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container */
.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ HEADER ============ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 64px;
}

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

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent), #0088cc);
    border-radius: 10px;
    font-size: 14px;
    color: #fff;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Search Form */
.search-form {
    display: flex;
    position: relative;
    flex: 1;
    max-width: 520px;
}

.search-form input {
    width: 100%;
    padding: 10px 48px 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    transition: var(--transition);
}

.search-form input::placeholder {
    color: var(--text-muted);
}

.search-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.search-btn:hover {
    color: var(--accent);
}

.header-nav {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.header-nav a {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.header-nav a:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

/* ============ HERO ============ */
.hero {
    padding: 80px 0 60px;
    text-align: center;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 60%);
}

.hero__title {
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.accent {
    color: var(--accent);
}

.hero__sub {
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 32px;
}

.hero-search {
    max-width: 600px;
    margin: 0 auto;
}

.hero-search input {
    padding: 14px 80px 14px 24px;
    font-size: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.hero-search .search-btn {
    right: 6px;
    background: linear-gradient(135deg, var(--accent), #0088cc);
    color: #fff;
    border-radius: var(--radius-pill);
    padding: 8px 20px;
    font-size: 14px;
    font-family: var(--font-body);
    font-weight: 500;
}

.hero-search .search-btn:hover {
    opacity: 0.9;
}

/* ============ CHANNEL BAR ============ */
.channel-bar {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.channel-bar__scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
}

.channel-bar__scroll::-webkit-scrollbar {
    display: none;
}

.channel-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text-secondary);
    transition: var(--transition);
}

.channel-pill:hover,
.channel-pill--active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.channel-pill__icon {
    font-size: 15px;
}

/* ============ SECTIONS ============ */
.section {
    padding: 48px 0;
}

.section__title {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.result-count {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-muted);
}

/* ============ VIDEO GRID ============ */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.video-grid--featured {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* ============ VIDEO CARD ============ */
.video-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}

.video-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.video-card__thumb-link {
    display: block;
}

.video-card__thumb {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bg-secondary);
}

.video-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.video-card:hover .video-card__thumb img {
    transform: scale(1.05);
}

.video-card__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.video-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: var(--transition);
}

.video-card:hover .video-card__overlay {
    opacity: 1;
}

.play-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--accent);
    color: #000;
    border-radius: 50%;
    font-size: 18px;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.video-card__info {
    padding: 14px 16px;
}

.video-card__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.video-card__owner {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-decoration: none;
}

.video-card__owner--link {
    display: inline-block;
    transition: var(--transition);
}

.video-card__owner--link:hover {
    color: var(--accent);
}

.video-card__stats {
    font-size: 12px;
    color: var(--text-muted);
}

/* Large card */
.video-card--large .video-card__title {
    font-size: 16px;
}

/* ============ CATEGORY GRID ============ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
    text-align: center;
}

.category-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.category-card__icon {
    font-size: 28px;
}

.category-card__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.category-card:hover .category-card__name {
    color: var(--accent);
}

/* ============ SORT BAR ============ */
.sort-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.sort-pill {
    padding: 8px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.sort-pill:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.sort-pill--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

/* ============ SEARCH HEADER ============ */
.search-header {
    margin-bottom: 8px;
}

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.pagination__info {
    font-size: 14px;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent), #0088cc);
    color: #fff;
}

.btn--primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn--outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn--outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ============ WATCH PAGE ============ */
.watch-page {
    padding: 24px 0 60px;
}

.watch-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 32px;
}

.player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}

.player-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.watch-info {
    padding: 20px 0 16px;
}

.watch-info__title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
}

.watch-info__meta {
    display: flex;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.watch-owner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.watch-owner__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.watch-owner__info strong {
    font-size: 15px;
}

.watch-description {
    padding: 16px 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    max-height: 200px;
    overflow-y: auto;
}

/* Sidebar */
.sidebar__title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-card {
    display: flex;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.related-card:hover {
    background: var(--bg-card);
}

.related-card__thumb {
    position: relative;
    width: 160px;
    min-width: 160px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-secondary);
}

.related-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-card__info h4 {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.related-card__meta {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ============ CHANNEL HERO ============ */
.channel-hero {
    padding: 48px 0 32px;
    text-align: center;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 60%);
}

.channel-hero__icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.channel-hero__title {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state__hint {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ============ FOOTER ============ */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    padding: 48px 0 24px;
    margin-top: 40px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border);
}

.footer-brand .logo-text {
    font-size: 18px;
}

.footer-tagline {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

.footer-links {
    display: flex;
    gap: 60px;
}

.footer-col h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.footer-col a {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    padding: 4px 0;
    transition: var(--transition);
}

.footer-col a:hover {
    color: var(--accent);
}

.footer-bottom {
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.muted {
    color: var(--text-muted);
    font-size: 14px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .watch-layout {
        grid-template-columns: 1fr;
    }

    .related-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .related-card {
        flex-direction: column;
    }

    .related-card__thumb {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header-nav {
        display: none;
    }

    .header-inner {
        gap: 12px;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 16px;
    }

    .hero {
        padding: 48px 0 40px;
    }

    .hero__sub {
        font-size: 15px;
    }

    .footer-inner {
        flex-direction: column;
        gap: 24px;
    }

    .footer-links {
        gap: 40px;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .category-card {
        padding: 16px 8px;
    }
}

@media (max-width: 480px) {
    .video-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 0 14px;
    }

    .watch-info__title {
        font-size: 18px;
    }

    .related-list {
        grid-template-columns: 1fr;
    }
}

/* ============ USER CHANNEL PAGE ============ */
.user-hero {
    padding: 48px 0 32px;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-glow) 0%, transparent 60%);
}

.user-hero__inner {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-hero__avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
    flex-shrink: 0;
}

.user-hero__avatar--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), #0088cc);
    color: #fff;
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 700;
}

.user-hero__info {
    flex: 1;
}

.user-hero__name {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.user-hero__desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.user-hero__stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.user-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-stat__value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.user-stat__label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============ WATCH OWNER LINK ============ */
.watch-owner__link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

.watch-owner__link:hover {
    opacity: 0.85;
}

.watch-owner__channel-label {
    display: block;
    font-size: 12px;
    color: var(--accent);
    margin-top: 2px;
    font-weight: 500;
}

/* ============ RANDOM BUTTON ============ */
.hero__actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn--random {
    background: linear-gradient(135deg, #ff6b35, #f72585);
    color: #fff;
    padding: 12px 28px;
    border-radius: var(--radius-pill);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-body);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(247, 37, 133, 0.3);
}

.btn--random:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(247, 37, 133, 0.4);
}

.btn--random .btn__dice {
    font-size: 18px;
    animation: shake 2s ease-in-out infinite;
}

.btn--sm {
    padding: 6px 16px;
    font-size: 13px;
}

.btn--sm .btn__dice {
    font-size: 14px;
}

.header-nav .random-btn {
    background: linear-gradient(135deg, #ff6b35, #f72585);
    color: #fff !important;
}

.header-nav .random-btn:hover {
    opacity: 0.9;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(-10deg); }
    20% { transform: rotate(10deg); }
    30% { transform: rotate(-8deg); }
    40% { transform: rotate(8deg); }
    50% { transform: rotate(0deg); }
}

/* ============ AD SLOTS ============ */
.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    max-width: 1320px;
}

.ad-slot:empty,
.ad-slot:not(:has(ins)):not(:has(img)):not(:has(iframe)) {
    display: none;
}

.ad-slot--banner {
    padding: 12px 20px;
}

.ad-slot--content-top {
    padding: 0 0 24px;
}

.ad-slot--in-feed {
    padding: 24px 0 0;
}

.ad-slot--sidebar {
    margin-bottom: 20px;
}

.ad-slot--below-player {
    padding: 12px 0;
}

.ad-slot--footer-top {
    padding: 24px 20px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

.ad-slot--sticky {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 8px 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.ad-slot__close {
    position: absolute;
    top: -8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1;
}

.ad-slot__close:hover {
    background: var(--accent);
    color: #000;
}

/* ============ RESPONSIVE: USER PAGE ============ */
@media (max-width: 768px) {
    .user-hero__inner {
        flex-direction: column;
        text-align: center;
    }

    .user-hero__stats {
        justify-content: center;
    }

    .user-hero__name {
        font-size: 24px;
    }

    .user-hero__avatar {
        width: 80px;
        height: 80px;
    }
}

/* ============ ANIMATIONS ============ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-card {
    animation: fadeUp 0.4s ease both;
}

.video-card:nth-child(1)  { animation-delay: 0.00s; }
.video-card:nth-child(2)  { animation-delay: 0.04s; }
.video-card:nth-child(3)  { animation-delay: 0.08s; }
.video-card:nth-child(4)  { animation-delay: 0.12s; }
.video-card:nth-child(5)  { animation-delay: 0.16s; }
.video-card:nth-child(6)  { animation-delay: 0.20s; }
.video-card:nth-child(7)  { animation-delay: 0.24s; }
.video-card:nth-child(8)  { animation-delay: 0.28s; }
.video-card:nth-child(9)  { animation-delay: 0.32s; }
.video-card:nth-child(10) { animation-delay: 0.36s; }
.video-card:nth-child(11) { animation-delay: 0.40s; }
.video-card:nth-child(12) { animation-delay: 0.44s; }

.section {
    animation: fadeUp 0.5s ease both;
}