/*
Theme Name: Viral App Theme
Description: A mobile-first, TikTok-style viral news theme with built-in ad management and infinite scroll.
Author: Senior WP Developer
Version: 1.0.0
*/

/* ==========================================
   1. GLOBAL VARIABLES (LIGHT & DARK MODE)
   ========================================== */
:root {
    --bg-color: #ffffff;
    --text-color: #111827;
    --primary-color: #ef4444; /* Boredodo Red */
    --card-bg: #f3f4f6;
    --border-radius: 16px;
    --bg-color-rgb: 255, 255, 255;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: #1e293b;
    --bg-color-rgb: 15, 23, 42;
}

/* ==========================================
   2. BASE HTML & TYPOGRAPHY
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden; 
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ==========================================
   3. LAYOUT & GRID
   ========================================== */
.site-main-wrapper {
    padding: 20px 15px; 
    max-width: 1050px; 
    margin: 0 auto;
    width: 100%;
}

.site-sidebar {
    display: none; /* Hidden on mobile */
}

/* Desktop Grid */
@media (min-width: 1024px) {
    .site-main-wrapper {
        display: grid;
        grid-template-columns: 1fr 300px; 
        gap: 30px; 
        padding: 40px 20px; 
    }
    .site-sidebar {
        display: block; 
    }
    .sticky-sidebar-inner {
        position: sticky;
        top: 80px; 
        height: max-content;
    }
    #mobile-bottom-nav,
    .sticky-bottom-ad {
        display: none !important;
    }
}

/* ==========================================
   4. ARTICLE STYLING (SINGLE.PHP)
   ========================================== */
.entry-content img {
    border-radius: 8px;
    margin: 25px 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.entry-content iframe {
    max-width: 100%;
}

.entry-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.entry-content a:hover {
    border-bottom: 2px solid var(--primary-color);
    opacity: 0.8;
}

[data-theme="dark"] .entry-content a {
    filter: brightness(1.3); 
}

/* ==========================================
   5. ADVERTISEMENT WRAPPERS
   ========================================== */
.viral-ad-wrapper {
    text-align: center;
    margin: 25px auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Global fallback styling for the Sponsored labels */
.viral-ad-wrapper span.ad-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 10px;
    letter-spacing: 1px;
    font-weight: bold;
}

/* ==========================================
   6. CARDS & FEEDS
   ========================================== */
.clickable-feed-card {
    text-decoration: none !important;
    display: block;
    cursor: pointer;
}

.feed-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feed-card:hover {
    transform: translateY(-6px); 
    box-shadow: 0 20px 40px rgba(0,0,0,0.08) !important; 
    border-color: rgba(150,150,150,0.15) !important;
}

.clickable-feed-card h2 {
    transition: color 0.2s ease;
}

.clickable-feed-card:hover h2 {
    color: var(--primary-color) !important; 
}

/* ==========================================
   7. CATEGORY CHIPS
   ========================================== */
.category-chips::-webkit-scrollbar {
    display: none; 
}

.chip {
    background: var(--card-bg);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(150, 150, 150, 0.15);
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1; 
}

.chip-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px !important; 
    flex-shrink: 0 !important; 
    min-width: 20px; 
    line-height: 1;
    transform: translateY(-1px);
}

.chip-text {
    display: inline-flex;
    align-items: center;
    white-space: nowrap; 
    flex-shrink: 0;
}

.chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}

.active-chip {
    background: var(--primary-color) !important;
    color: #ffffff !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.4) !important; /* Updated to match Boredodo Red */
}

/* ==========================================
   8. BUTTONS & UI ACTIONS
   ========================================== */
.viral-share-btn {
    transition: color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}
.viral-share-btn:hover {
    background: var(--text-color) !important;
    color: var(--bg-color) !important;
    border-color: var(--text-color) !important;
}

.facebook-style {
    transition: background-color 0.2s ease, transform 0.2s ease !important;
    color: #fff !important; 
}
.facebook-style:hover {
    background: #166fe5 !important; 
    transform: translateY(-2px);
    color: #fff !important; 
    border-color: transparent !important;
}

.header-actions button {
    transition: color 0.2s ease, transform 0.2s ease;
}
.header-actions button:hover {
    color: var(--primary-color) !important;
    transform: scale(1.1);
}

/* Dark Mode Toggle Fix */
[data-theme="dark"] #dark-mode-toggle {
    background-color: rgba(255, 255, 255, 0.1) !important; 
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
[data-theme="dark"] #dark-mode-toggle svg {
    stroke: #ffffff !important; 
    fill: none !important;
}

#load-more-trigger {
    text-align: center;
    padding: 15px 20px;
    font-weight: 800;
    color: var(--primary-color);
    cursor: pointer;
    border: 2px solid var(--primary-color);
    border-radius: 30px;
    margin: 20px auto;
    max-width: 300px;
    transition: all 0.2s ease;
    background: transparent;
}
#load-more-trigger:hover {
    background: var(--primary-color);
    color: #fff !important;
}

.newsletter-widget button {
    transition: background-color 0.2s ease;
}
.newsletter-widget button:hover {
    background-color: #374151 !important; 
}

/* ==========================================
   9. NAVIGATION MENUS (MOBILE APP & DRAWER)
   ========================================== */
.menu-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(3px); 
}
.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.menu-drawer {
    position: fixed;
    top: 0; left: -320px; 
    width: 300px; 
    max-width: 85vw; 
    height: 100%;
    background: var(--bg-color);
    z-index: 1002;
    box-shadow: 4px 0 25px rgba(0,0,0,0.15);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.menu-drawer.active {
    left: 0; 
}

.drawer-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.drawer-menu-list li {
    border-bottom: 1px solid rgba(150,150,150,0.1);
}
.drawer-menu-list li:last-child {
    border-bottom: none;
}
.drawer-menu-list a {
    display: block;
    padding: 16px 5px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
}
.drawer-menu-list a:hover {
    color: var(--primary-color);
    padding-left: 10px; 
}

/* Mobile Bottom Navigation */
.mobile-bottom-ul {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}
.mobile-bottom-ul li {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%; 
}
.app-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    width: 100%;
    height: 100%;
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.5;
    transform: scale(0.95);
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    gap: 4px;
    position: relative; 
}
.app-nav-link:hover,
.active-nav-item {
    opacity: 1 !important;
    color: var(--primary-color) !important;
    transform: scale(1) !important;
}
.app-nav-link svg {
    margin-bottom: 2px;
    display: block; 
}
.app-nav-link::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    position: absolute;
    bottom: 8px; 
    left: 50%; 
    transform: translateX(-50%); 
    opacity: 0;
    transition: opacity 0.2s ease;
}
.active-nav-item::after,
.app-nav-link:hover::after {
    opacity: 1;
}

/* ==========================================
   10. GUTENBERG BLOCKS & ANIMATIONS
   ========================================== */
.wp-block-viralapp-fact-box {
    background-color: rgba(245, 158, 11, 0.1);
    border-left: 4px solid #f59e0b;
    padding: 20px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin: 30px 0;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}
.wp-block-viralapp-fact-box .fact-header {
    font-weight: 800;
    color: #b45309;
    font-size: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wp-block-viralapp-fact-box .fact-content {
    margin: 0 !important;
    font-size: 17px;
    color: var(--text-color);
    line-height: 1.6;
    font-weight: 600;
}
[data-theme="dark"] .wp-block-viralapp-fact-box {
    background-color: rgba(245, 158, 11, 0.15);
}
[data-theme="dark"] .wp-block-viralapp-fact-box .fact-header {
    color: #fcd34d;
}

@keyframes swipeHint {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(6px); }
}
.swipe-animation {
    animation: swipeHint 1.5s infinite ease-in-out;
}
.fade-out-indicator {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Fix Custom Logo */
.custom-logo-wrapper img {
    max-height: 45px;
    width: auto;
    object-fit: contain;
}