/* ===========================
   FACEBOOK HEADER
=========================== */
.fb-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: var(--header-height);
    background: var(--fb-white);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.fb-header-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--fb-blue);
    letter-spacing: -0.5px;
    font-family: 'Georgia', serif;
}

.fb-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fb-header-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fb-gray-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fb-dark);
    transition: background 0.2s;
    position: relative;
}

.fb-header-icon-btn:hover,
.fb-header-icon-btn:active {
    background: var(--fb-gray-border);
}

.fb-header-icon-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.fb-notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #F02849;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid white;
}

/* ===========================
   STORIES ROW
=========================== */
.fb-stories {
    background: var(--fb-white);
    padding: 8px 0;
    border-bottom: 1px solid var(--fb-gray-border);
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    display: flex;
    gap: 8px;
    padding: 8px 12px;
}

.fb-story-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 64px;
    cursor: pointer;
}

.fb-story-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--fb-blue);
    padding: 2px;
    background: var(--fb-white);
    overflow: hidden;
    position: relative;
}

.fb-story-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.fb-story-add-icon {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: var(--fb-blue);
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 700;
}

.fb-story-name {
    font-size: 11px;
    color: var(--fb-dark);
    text-align: center;
    white-space: normal;
    word-break: break-word;
    max-width: 64px;
    line-height: 1.2;
}

/* ===========================
   CREATE POST BOX
=========================== */
.fb-create-post {
    background: var(--fb-white);
    padding: 10px 12px;
    margin-top: 8px;
    border-top: 1px solid var(--fb-gray-border);
    border-bottom: 1px solid var(--fb-gray-border);
}

.fb-create-post-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fb-create-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--fb-gray-bg);
    overflow: hidden;
    flex-shrink: 0;
}

.fb-create-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fb-create-input {
    flex: 1;
    padding: 9px 14px;
    border: 1px solid var(--fb-gray-border);
    border-radius: 24px;
    background: var(--fb-gray-bg);
    font-size: 15px;
    color: var(--fb-gray-text);
    cursor: pointer;
}

.fb-create-actions {
    display: flex;
    justify-content: space-around;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--fb-gray-border);
}

.fb-create-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--fb-gray-text);
    transition: background 0.2s;
}

.fb-create-action-btn:active {
    background: var(--fb-gray-bg);
}

/* ===========================
   POST CARD
=========================== */
.fb-post-card {
    background: var(--fb-white);
    margin-top: 8px;
    border-top: 1px solid var(--fb-gray-border);
    border-bottom: 1px solid var(--fb-gray-border);
}

.fb-post-header {
    display: flex;
    align-items: center;
    padding: 12px 12px 8px;
    gap: 10px;
}

.fb-post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--fb-blue-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fb-post-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.fb-post-avatar-icon {
    color: var(--fb-blue);
    font-size: 20px;
    font-weight: 700;
}

.fb-post-meta {
    flex: 1;
}

.fb-post-author {
    font-size: 15px;
    font-weight: 700;
    color: var(--fb-dark);
    line-height: 1.2;
}

.fb-post-time {
    font-size: 12px;
    color: var(--fb-gray-text);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.fb-post-time svg {
    width: 12px;
    height: 12px;
    fill: var(--fb-gray-text);
}

.fb-post-more-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fb-gray-text);
    font-size: 20px;
    font-weight: 700;
}

.fb-post-text {
    padding: 0 12px 10px;
    font-size: 15px;
    color: var(--fb-dark);
    line-height: 1.4;
}

/* Post Image — clickable */
.fb-post-image-link {
    display: block;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.fb-post-image {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    transition: transform 0.2s;
}

.fb-post-image-link:active .fb-post-image {
    transform: scale(0.98);
}

.fb-post-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity 0.2s;
}

.fb-post-image-link:hover .fb-post-play-overlay {
    opacity: 1;
}

.fb-play-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fb-play-icon svg {
    width: 28px;
    height: 28px;
    fill: var(--fb-blue);
    margin-left: 4px;
}

/* Post Actions (Like, Comment, Share) */
.fb-post-stats {
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--fb-gray-text);
}

.fb-post-stats-reactions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fb-reaction-emoji {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
}

.fb-post-actions {
    display: flex;
    border-top: 1px solid var(--fb-gray-border);
    padding: 2px 6px;
}

.fb-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 4px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--fb-gray-text);
    transition: background 0.2s;
}

.fb-action-btn:active {
    background: var(--fb-gray-bg);
    color: var(--fb-blue);
}

.fb-action-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ===========================
   BOTTOM NAVIGATION
=========================== */
.fb-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    height: var(--bottom-nav-height);
    background: var(--fb-white);
    border-top: 1px solid var(--fb-gray-border);
    display: flex;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
}

.fb-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 6px 0;
    color: var(--fb-gray-text);
    transition: color 0.15s;
    position: relative;
}

.fb-nav-item.active {
    color: var(--fb-blue);
}

.fb-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15%;
    right: 15%;
    height: 3px;
    background: var(--fb-blue);
    border-radius: 2px 2px 0 0;
}

.fb-nav-item svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

/* ===========================
   VIDEO PAGE STYLES
=========================== */
.fb-video-page {
    background: #000;
    min-height: 100vh;
}

.fb-video-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    height: var(--header-height);
    background: var(--fb-dark);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
    z-index: 1000;
}

.fb-back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.fb-back-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.fb-video-title-header {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    color: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fb-video-page-content {
    padding-top: var(--header-height);
    background: #000;
}

.fb-video-player-wrapper {
    width: 100%;
    background: #000;
    position: relative;
}

.fb-video-player {
    width: 100%;
    max-height: 56vw;
    aspect-ratio: 16/9;
    display: block;
    background: #000;
    object-fit: cover;
}

.fb-video-iframe {
    width: 100%;
    aspect-ratio: 16/9;
    border: none;
    display: block;
}

.fb-video-info {
    background: var(--fb-white);
    padding: 12px;
}

.fb-video-post-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--fb-dark);
    margin-bottom: 6px;
    line-height: 1.3;
}

.fb-video-post-meta {
    font-size: 12px;
    color: var(--fb-gray-text);
}

.fb-video-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--fb-white);
    font-size: 13px;
    color: var(--fb-gray-text);
    border-top: 1px solid var(--fb-gray-border);
}

.fb-video-actions {
    display: flex;
    background: var(--fb-white);
    border-top: 1px solid var(--fb-gray-border);
    border-bottom: 1px solid var(--fb-gray-border);
    padding: 2px 6px;
}

/* ===========================
   MORE FOR YOU SECTION
=========================== */
.fb-mfy-section {
    background: var(--fb-white);
    margin-top: 8px;
}

.fb-mfy-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--fb-dark);
    padding: 12px 12px 8px;
    border-bottom: 1px solid var(--fb-gray-border);
}

.fb-mfy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    background: var(--fb-gray-bg);
}

.fb-mfy-item {
    display: block;
    background: var(--fb-white);
    overflow: hidden;
    position: relative;
}

.fb-mfy-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.fb-mfy-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
    padding: 20px 8px 8px;
}

.fb-mfy-post-title {
    font-size: 13px;
    font-weight: 600;
    color: white;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===========================
   VIDEO PAGE AD WRAPPERS
=========================== */
.fb-video-ad-wrapper {
    background: var(--fb-white);
    border-top: 1px solid var(--fb-gray-border);
    border-bottom: 1px solid var(--fb-gray-border);
    margin-top: 8px;
}

.fb-video-header-ad {
    background: var(--fb-white);
    border-bottom: 1px solid var(--fb-gray-border);
}

.fb-video-footer-ad {
    background: var(--fb-white);
    border-top: 1px solid var(--fb-gray-border);
    margin-top: 8px;
    padding-bottom: calc(var(--bottom-nav-height) + 12px);
}

/* ===========================
   EMPTY STATE
=========================== */
.fb-empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--fb-gray-text);
}

.fb-empty-state svg {
    width: 64px;
    height: 64px;
    fill: var(--fb-gray-border);
    margin: 0 auto 16px;
}

.fb-empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--fb-dark);
    margin-bottom: 8px;
}

.fb-empty-state p {
    font-size: 15px;
}

/* ===========================
   RESPONSIVE / DESKTOP CENTER
=========================== */
@media (min-width: 501px) {
    .fb-app {
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    }
}

/* ===========================
   LOADING SHIMMER
=========================== */
@keyframes shimmer {
    0% {
        background-position: -400px 0;
    }

    100% {
        background-position: 400px 0;
    }
}

.fb-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite;
}