/*
Theme Name: FB Clone Theme
Theme URI: https://example.com/fb-clone-theme
Author: Your Name
Author URI: https://example.com
Description: A Facebook-style WordPress theme with advanced ad management, custom post types for profiles and videos, and optimized mobile performance.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fb-clone
Tags: facebook, social, mobile-first, responsive, ads
*/

/* ==========================================
   RESET & BASE STYLES
========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --fb-blue: #1877f2;
    --fb-blue-dark: #166fe5;
    --fb-blue-light: #4267B2;
    --fb-bg: #f0f2f5;
    --fb-white: #ffffff;
    --fb-text: #050505;
    --fb-text-secondary: #65676b;
    --fb-border: #dadde1;
    --fb-hover: #f2f3f5;
    --ad-bg: #fffbf2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--fb-bg);
    color: var(--fb-text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.8;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================
   LAYOUT & CONTAINER
========================================== */
.site-container {
    max-width: 100%;
    margin: 0 auto;
    background: var(--fb-bg);
    min-height: 100vh;
}

.content-wrapper {
    max-width: 680px;
    margin: 0 auto;
    padding: 0;
}

/* ==========================================
   HEADER STYLES (Facebook-style)
========================================== */
.site-header {
    background: var(--fb-white);
    border-bottom: 1px solid var(--fb-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-inner {
    max-width: 100%;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-size: 28px;
    font-weight: bold;
    color: var(--fb-blue);
    letter-spacing: -1px;
}

.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--fb-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.nav-icon:hover {
    background: var(--fb-border);
}

/* ==========================================
   AD SLOT STYLES
========================================== */
.ad-slot {
    margin: 12px 0;
    width: 100%;
    overflow: visible;
    display: block;
}

.ad-slot-header {
    margin: 16px 0;
}

.ad-content {
    width: 100%;
    text-align: center;
    overflow: visible;
}

/* Hide ad slots that are empty */
.ad-slot:empty {
    display: none;
    margin: 0;
}

/* ==========================================
   PROFILE CARD STYLES (Homepage)
========================================== */
.profiles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
}

.profile-card {
    background: var(--fb-white);
    border-bottom: 8px solid var(--fb-bg);
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
    overflow: hidden;
}

.profile-card:hover {
    background: var(--fb-hover);
}

.profile-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    /* 4:3 aspect ratio - better for desktop */
    overflow: hidden;
    background: #e4e6eb;
    max-height: 400px;
    /* Limit max height on desktop */
}

.profile-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    padding: 12px 16px;
}

.profile-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--fb-text);
    margin-bottom: 4px;
    line-height: 1.3;
}

.profile-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--fb-text-secondary);
}

.profile-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==========================================
   VIDEO PAGE STYLES
========================================== */
.single-video-container {
    background: var(--fb-white);
    min-height: 100vh;
}

.video-wrapper {
    position: relative;
    width: 100%;
    background: #000;
}

.video-player {
    width: 100%;
    height: auto;
    display: block;
    max-height: 70vh;
    object-fit: contain;
}

.video-info {
    padding: 16px;
    background: var(--fb-white);
}

.video-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--fb-text);
    margin-bottom: 8px;
    line-height: 1.4;
}

.video-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--fb-text-secondary);
    margin-bottom: 16px;
}

.video-actions {
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    border-top: 1px solid var(--fb-border);
    border-bottom: 1px solid var(--fb-border);
}

.action-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--fb-text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}

.action-btn:hover {
    background: var(--fb-hover);
    border-radius: 4px;
}

/* ==========================================
   MORE FOR YOU SECTION
========================================== */
.more-for-you {
    background: var(--fb-white);
    padding-top: 16px;
    border-top: 8px solid var(--fb-bg);
}

.more-for-you-header {
    padding: 0 16px 12px;
    font-size: 17px;
    font-weight: 700;
    color: var(--fb-text);
    border-bottom: 1px solid var(--fb-border);
}

.related-posts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.related-post-card {
    padding: 12px 16px;
    border-bottom: 1px solid var(--fb-border);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    gap: 12px;
}

.related-post-card:hover {
    background: var(--fb-hover);
}

.related-post-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.related-post-info {
    flex: 1;
}

.related-post-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--fb-text);
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-post-meta {
    font-size: 13px;
    color: var(--fb-text-secondary);
}

/* ==========================================
   FOOTER
========================================== */
.site-footer {
    background: var(--fb-white);
    padding: 20px 16px;
    text-align: center;
    border-top: 1px solid var(--fb-border);
    margin-top: 20px;
    font-size: 13px;
    color: var(--fb-text-secondary);
}

/* ==========================================
   RESPONSIVE - TABLET & DESKTOP
========================================== */
@media (min-width: 768px) {
    .content-wrapper {
        max-width: 680px;
        margin: 0 auto;
        padding: 0;
    }

    /* Keep single column layout like mobile */
    .profiles-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .profile-card {
        border-radius: 0;
        border-bottom: 8px solid var(--fb-bg);
    }

    .related-posts {
        grid-template-columns: 1fr;
        gap: 0;
        padding: 0;
    }

    .related-post-card {
        border: none;
        border-bottom: 1px solid var(--fb-border);
        border-radius: 0;
        flex-direction: row;
    }

    .related-post-thumbnail {
        width: 120px;
        height: 120px;
    }
}

@media (min-width: 1024px) {

    /* Keep mobile layout on desktop too */
    .profiles-grid {
        grid-template-columns: 1fr;
    }

    .content-wrapper {
        max-width: 680px;
    }
}

/* ==========================================
   UTILITY CLASSES
========================================== */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.p-1 {
    padding: 8px;
}

.p-2 {
    padding: 16px;
}

/* Loading state */
.loading-spinner {
    border: 3px solid var(--fb-border);
    border-top: 3px solid var(--fb-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}