/* TikTok Style Feed CSS - Scoped to only affect the feed container */

/* Only apply these styles inside the TikTok feed */
#tiktok-feed-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#tiktok-feed-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #000;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Header Styles */
.tiktok-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    z-index: 100;
    color: white;
}

.live-icon {
    background: rgba(255,255,255,0.3);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.header-tabs {
    display: flex;
    gap: 20px;
}

.tab-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    position: relative;
    transition: color 0.3s;
}

.tab-link.active {
    color: white;
    font-weight: 700;
}

.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 3px;
    background: white;
    border-radius: 2px;
}

.search-icon {
    font-size: 24px;
    cursor: pointer;
    display: none;
}

/* Posts Wrapper */
#tiktok-posts-wrapper {
    width: 100%;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#tiktok-posts-wrapper::-webkit-scrollbar {
    display: none;
}

/* Individual Post */
.tiktok-post-item {
    position: relative;
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.post-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* No default background - will be set inline in PHP */
}

/* Media should fill entire background */
.post-media {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    z-index: 1 !important;
    display: block !important;
    image-rendering: -webkit-optimize-contrast !important;
    image-rendering: crisp-edges !important;
    backface-visibility: hidden !important;
    transform: translateZ(0) !important;
}

/* Ensure videos display and play properly */
video.post-media {
    background: #000;
}

/* Ensure images are sharp and crisp */
img.post-media {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-font-smoothing: subpixel-antialiased;
}

/* Dark overlay for better text readability - only at bottom */
.post-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        transparent 60%, 
        rgba(0,0,0,0.4) 80%, 
        rgba(0,0,0,0.9) 100%);
    z-index: 2;
    pointer-events: none;
}

/* Text content overlay - for posts without media ONLY */
.post-text-only {
    position: absolute;
    bottom: 120px;
    left: 16px;
    right: 80px;
    text-align: left;
    z-index: 3;
    color: white;
    font-size: 24px;
    line-height: 1.4;
    text-shadow: 0 3px 15px rgba(0,0,0,0.95), 0 0 50px rgba(0,0,0,0.7);
    font-weight: 600;
}

/* Remove old centered text styles */
.post-text-content {
    display: none !important;
}

/* Action Buttons */
.post-actions {
    position: absolute;
    right: 8px;
    bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 10;
    align-items: center;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.user-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid white;
    overflow: visible;
    display: block;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.live-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff006e, #ff4d6d);
    color: white;
    font-size: 9px;
    font-weight: 900;
    padding: 3px 6px;
    border-radius: 4px;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(255, 0, 110, 0.5);
    letter-spacing: 0.5px;
}

.follow-btn {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    background: #fe2c55;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #000;
    cursor: pointer;
    line-height: 1;
}

.action-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: transform 0.2s;
    padding: 0;
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
    width: 36px;
    height: 36px;
}

.action-btn .count,
.action-btn .label {
    font-size: 12px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    color: white;
}

/* WhatsApp style button like in the image */
.whatsapp-btn {
    position: fixed;
    right: 16px;
    bottom: 180px;
    width: 56px;
    height: 56px;
    background: #25d366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 11;
}

.whatsapp-btn svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Post Info - appears at bottom over content */
.post-info {
    position: absolute;
    left: 16px;
    right: 80px;
    bottom: 100px;
    color: white;
    z-index: 10;
}

.post-author {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.post-caption {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-music {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* Search bar at bottom */
.tiktok-search-bar {
    position: fixed;
    bottom: 60px;
    left: 16px;
    right: 16px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 22px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    z-index: 99;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-text {
    font-weight: 600;
}

.search-query {
    opacity: 0.8;
    font-weight: 400;
}

/* Footer Navigation */
.tiktok-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 10px;
    position: relative;
    transition: color 0.3s;
}

.footer-item.active {
    color: white;
}

.footer-item svg {
    width: 24px;
    height: 24px;
}

.footer-item.create {
    margin: 0 10px;
}

.create-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.footer-item.create span {
    display: none;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: 8px;
    background: #fe2c55;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tiktok-post-item.active {
    animation: fadeIn 0.4s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .header-tabs {
        gap: 12px;
    }
    
    .tab-link {
        font-size: 14px;
    }
    
    .post-text-content h2 {
        font-size: 28px;
    }
    
    .post-text-content p {
        font-size: 16px;
    }
}

/* Full-screen page styles - ONLY on pages with tiktok-fullscreen-page class */
body.tiktok-fullscreen-page {
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

body.tiktok-fullscreen-page header,
body.tiktok-fullscreen-page footer,
body.tiktok-fullscreen-page .site-header,
body.tiktok-fullscreen-page .site-footer,
body.tiktok-fullscreen-page #masthead,
body.tiktok-fullscreen-page #colophon,
body.tiktok-fullscreen-page nav:not(.tiktok-header):not(.tiktok-footer),
body.tiktok-fullscreen-page .navigation,
body.tiktok-fullscreen-page #wpadminbar {
    display: none !important;
}

body.tiktok-fullscreen-page #page,
body.tiktok-fullscreen-page #content,
body.tiktok-fullscreen-page .site-content,
body.tiktok-fullscreen-page .site,
body.tiktok-fullscreen-page main,
body.tiktok-fullscreen-page article {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Status bar styling for mobile */
@supports (padding-top: env(safe-area-inset-top)) {
    .tiktok-header {
        padding-top: calc(env(safe-area-inset-top) + 10px);
        height: calc(60px + env(safe-area-inset-top));
    }
    
    .tiktok-footer {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(60px + env(safe-area-inset-bottom));
    }
}