/**
 * YouTube-style Theme CSS
 * Custom CSS implementation without Tailwind
 */

/* Apply Roboto font globally */
body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #ffffff;
    color: #0f0f0f;
    margin: 0;
    padding: 0;
}

/* YouTube Color Palette */
:root {
    --yt-black: #0f0f0f;
    --yt-white: #ffffff;
    --yt-gray-100: #f2f2f2;
    --yt-gray-200: #e5e5e5;
    --yt-gray-300: #d9d9d9;
    --yt-gray-600: #606060;
    --yt-gray-700: #3f3f3f;
    --yt-gray-800: #272727;
    --yt-gray-900: #0f0f0f;
    --yt-red: #ff0000;
    --yt-blue: #065fd4;
    --yt-green: #2ba640;
    --yt-purple: #8b5cf6;
    --yt-pink: #ec4899;
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

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

a:hover,
a:focus,
a:active {
    text-decoration: none;
    outline: none;
}

/* Video thumbnail placeholder styles */
.youtube-video-thumbnail-placeholder {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    overflow: hidden;
}

.youtube-thumbnail-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.youtube-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    pointer-events: none;
}

.youtube-thumbnail-container:hover .youtube-play-overlay {
    background: rgba(0, 0, 0, 0.9);
}

button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* YouTube Header */
.youtube-header {
    /* position: fixed; */
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.youtube-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
}

.youtube-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.youtube-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .youtube-header-center {
        display: flex;
    }
}

.youtube-header button {
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    min-width: 40px;
    min-height: 40px;
}

.youtube-header button:hover {
    background-color: #f2f2f2;
}

.youtube-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.youtube-logo img {
    height: 24px;
    width: auto;
    display: block;
}

@media (min-width: 768px) {
    .youtube-logo img {
        height: 32px;
    }
}

.youtube-search-container {
    display: flex;
    width: 100%;
}

.youtube-search-input {
    flex: 1;
    padding: 8px 16px 8px 40px;
    border: 1px solid #e5e5e5;
    border-radius: 20px 0 0 20px;
    background-color: #f2f2f2;
    font-size: 16px;
    color: #0f0f0f;
    outline: none;
}

.youtube-search-input:focus {
    border-color: #065fd4;
    box-shadow: 0 0 0 2px rgba(6, 95, 212, 0.3);
}

.youtube-search-button {
    border-left: none;
    color: #0f0f0f;
    transition: background-color 0.2s ease;
}

.youtube-search-button:hover {
    background-color: #e5e5e5;
}

.youtube-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #606060;
}

.youtube-search-wrapper {
    position: relative;
    flex: 1;
}

/* YouTube Desktop Category Pills */
.youtube-desktop-categories {
    display: none;
    padding: 12px 16px;
    border-top: 1px solid #e5e5e5;
    overflow-x: auto;
    gap: 8px;
}

@media (min-width: 768px) {
    .youtube-desktop-categories {
        display: flex;
    }
}

.youtube-category-pill {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    background-color: #f2f2f2;
    color: #0f0f0f;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.youtube-category-pill:hover {
    background-color: #e5e5e5;
}

.youtube-category-pill.active {
    background-color: #0f0f0f;
    color: #ffffff;
}

/* YouTube Mobile Navigation */
.youtube-mobile-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 40;
    background-color: #ffffff;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
    .youtube-mobile-nav {
        top: 106px;
        display: none;
    }
}

.youtube-mobile-nav-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
}

.youtube-tab-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    background-color: #f2f2f2;
    color: #0f0f0f;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.youtube-tab-button:hover {
    transform: scale(1.02);
}

.youtube-tab-button.active {
    background-color: #0f0f0f;
    color: #ffffff;
}

/* YouTube Main Content */
.youtube-main-content {
    padding-bottom: 80px;
}

@media (min-width: 768px) {
    .youtube-main-content {
        padding-top: 140px;
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* YouTube Video Grid */
.youtube-video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 641px) {
    .youtube-video-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .youtube-video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1281px) {
    .youtube-video-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* YouTube Video Card */
.youtube-video-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 0px;
    position: relative;
}

/* Invisible overlay link for reliable navigation */
.video-card-overlay-link {
    text-decoration: none;
    color: inherit;
    pointer-events: auto;
}

.youtube-video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.youtube-video-card a {
    display: block;
    text-decoration: none;
    color: inherit;
    position: relative;
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
}

.youtube-video-card a:hover {
    text-decoration: none;
}

.youtube-video-card a:active {
    text-decoration: none;
}

.youtube-video-card a:focus {
    outline: none;
    text-decoration: none;
}

.youtube-thumbnail-container {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #f2f2f2;
}

.youtube-thumbnail-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.youtube-video-card:hover .youtube-thumbnail-container img {
    transform: scale(1.05);
}

.youtube-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.youtube-video-info {
    display: flex;
    gap: 12px;
    margin: 5px 0;
    padding: 0 10px;
}

.youtube-channel-avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
}

.youtube-video-details {
    flex: 1;
    min-width: 0;
}

.youtube-video-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f0f0f;
    margin: 0 0 0 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.youtube-channel-name {
    font-size: 12px;
    color: #606060;
    margin: 0 0 2px 0;
    transition: color 0.2s ease;
}

.youtube-channel-name:hover {
    color: #0f0f0f;
}

.youtube-video-meta {
    font-size: 12px;
    color: #606060;
    margin: 0;
}

.youtube-options-menu {
    flex-shrink: 0;
}

.youtube-options-menu button {
    padding: 4px;
    border-radius: 50%;
    color: #606060;
    transition: background-color 0.2s ease;
}

.youtube-options-menu button:hover {
    background-color: #f2f2f2;
}

/* YouTube Bottom Navigation */
.youtube-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: #ffffff;
    border-top: 1px solid #e5e5e5;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.1);
}

/* Hide bottom navigation on shorts page only */
body.page-shorts .youtube-bottom-nav {
    display: none;
}

.youtube-bottom-nav-content {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 0;
}

.youtube-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    text-decoration: none;
    color: inherit;
    min-width: 44px;
    min-height: 44px;
}

.youtube-nav-item i {
    font-size: 20px;
    color: #606060;
    transition: color 0.2s ease;
}

.youtube-nav-item span {
    font-size: 12px;
    color: #606060;
    font-weight: 500;
    transition: color 0.2s ease;
}

.youtube-nav-item:hover i,
.youtube-nav-item:hover span {
    color: #0f0f0f;
}

.youtube-nav-item.active i,
.youtube-nav-item.active span {
    color: #0f0f0f;
}

.youtube-nav-item.active .nav-indicator {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background-color: #0f0f0f;
    border-radius: 2px;
}

.youtube-create-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: none;
    border: none;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}

.youtube-create-button .create-icon-container {
    width: 40px;
    height: 32px;
    background-color: #f2f2f2;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.youtube-create-button:hover .create-icon-container {
    background-color: #e5e5e5;
}

.youtube-create-button i {
    font-size: 18px;
    color: #0f0f0f;
}

/* Responsive Typography */
@media (max-width: 640px) {
    .youtube-video-title {
        font-size: 14px;
    }
    
    .youtube-channel-name,
    .youtube-video-meta {
        font-size: 12px;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Hide Scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    .youtube-header button,
    .youtube-mobile-nav button,
    .youtube-bottom-nav button,
    .youtube-bottom-nav a {
        min-height: 44px;
        min-width: 44px;
    }
}

/* YouTube Shorts Section */
.youtube-shorts-section {
    margin: 32px 0;
    padding: 0 16px;
}

@media (min-width: 768px) {
    .youtube-shorts-section {
        padding: 0 24px;
    }
}

.youtube-shorts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.youtube-shorts-title {
    font-size: 20px;
    font-weight: 600;
    color: #0f0f0f;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.youtube-shorts-title i {
    color: #ff0000;
}

.youtube-shorts-view-all {
    font-size: 14px;
    color: #065fd4;
    font-weight: 500;
    text-decoration: none;
}

.youtube-shorts-view-all:hover {
    text-decoration: underline;
}

/* YouTube Shorts Grid */
.youtube-shorts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 641px) {
    .youtube-shorts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1025px) {
    .youtube-shorts-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1281px) {
    .youtube-shorts-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }
}

/* YouTube Short Card */
.youtube-short-card {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.youtube-short-card:hover {
    transform: scale(1.02);
}

.youtube-short-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* YouTube Short Thumbnail - 9:6 aspect ratio */
.youtube-short-thumbnail {
    position: relative;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: 12px;
    background-color: #f2f2f2;
}

.youtube-short-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.youtube-short-card:hover .youtube-short-thumbnail img {
    transform: scale(1.05);
}

.youtube-short-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}

.youtube-short-views {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
}

.youtube-short-views i {
    font-size: 14px;
}

/* YouTube Short Info */
.youtube-short-info {
    margin-top: 8px;
}

.youtube-short-title {
    font-size: 14px;
    font-weight: 500;
    color: #0f0f0f;
    margin: 0 0 4px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.youtube-short-channel {
    font-size: 12px;
    color: #606060;
    margin: 0;
}

/* Mobile specific adjustments for shorts */
@media (max-width: 640px) {
    .youtube-shorts-section {
        margin: 24px 0;
    }
    
    .youtube-shorts-title {
        font-size: 18px;
    }
    
    .youtube-short-title {
        font-size: 13px;
    }
    
    .youtube-short-channel {
        font-size: 11px;
    }
}

/* YouTube Shorts Reel - TikTok/Instagram Style */
.youtube-shorts-reel {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    position: relative;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.youtube-shorts-reel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.shorts-back-button {
    position: fixed;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
    z-index: 1000;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

.shorts-back-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.youtube-reel-item {
    height: 100%;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.youtube-reel-video {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.reel-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reel-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #ffffff;
}

.reel-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.reel-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
}

.reel-username {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
}

.reel-follow {
    padding: 6px 16px;
    background-color: #ff0000;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.reel-follow:hover {
    background-color: #cc0000;
}

.reel-details {
    margin-bottom: 16px;
}

.reel-title {
    font-size: 14px;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reel-views {
    font-size: 12px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.9;
}

.reel-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: absolute;
    right: 16px;
    bottom: 80px;
}

.reel-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.reel-action:hover {
    transform: scale(1.1);
}

.reel-action i {
    font-size: 24px;
}

.reel-action span {
    font-size: 11px;
}

/* Reel Ad Section */
.reel-ad-section {
    height: 100%;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    background-color: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px;
}

.reel-ad-countdown {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 4px;
    text-align: center;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
}

.countdown-number {
    font-size: 18px;
    font-weight: bold;
}

.countdown-text {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reel-ad-section.countdown-active {
    pointer-events: none;
}

.reel-ad-item {
    background-color: #1a1a1a;
    border-radius: 8px;
    padding: 8px;
}

/* Shorts Section Header */
.youtube-shorts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.youtube-videos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 10px;
}

.view-all-button {
    color: #065fd4;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.view-all-button:hover {
    text-decoration: underline;
}

/* Desktop adjustments for reel */
@media (min-width: 768px) {
    .youtube-shorts-reel {
        max-width: 400px;
        margin: 0 auto;
        height: 100vh;
    }
    
    .reel-info {
        padding: 20px;
    }
    
    .reel-actions {
        right: 20px;
        bottom: 100px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.rounded-full {
    border-radius: 9999px;
}

/* Mobile specific adjustments */
@media (max-width: 768px) {
    body:not(.video-details-page) {
        padding-bottom: 60px;
    }
}

/* Loading state */
.skeleton {
    background: linear-gradient(90deg, #f2f2f2 25%, #e5e5e5 50%, #f2f2f2 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}