/*
Theme Name: Mobile News Reels
Theme URI: https://example.com
Author: Custom
Author URI: https://example.com
Description: Mobile-first news theme with reels-style vertical scrolling, auto-fetching from WorldNewsAPI, optimized for phones only.
Version: 1.0.0
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mobile-news-reels
*/

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: #000;
    color: #fff;
    position: fixed;
    width: 100%;
    height: 100vh;
    overscroll-behavior-y: contain;
}

/* Reels Container */
.reels-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* News Banner */
.news-banner {
    width: 100%;
    min-height: 120px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    display: flex;
    align-items: center;
    padding: 20px;
    margin-bottom: 0;
}

.news-banner-content {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.news-banner-text {
    flex: 1;
}

.news-banner-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.3;
}

.news-banner-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    margin: 0;
}

.news-banner-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    padding: 12px 24px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.news-banner-btn:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.news-banner-close {
    position: absolute;
    top: -10px;
    right: -10px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
    z-index: 10;
}

.news-banner-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.news-banner-close svg {
    width: 16px;
    height: 16px;
}

.reels-container::-webkit-scrollbar {
    display: none;
}

.reels-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* News Reel Card */
.news-reel-card {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Country-specific background colors */
.news-reel-card[data-country="zambia"] {
    background: linear-gradient(135deg, #198A00 0%, #0D5A00 100%);
}

.news-reel-card[data-country="india"] {
    background: linear-gradient(135deg, #FF9933 0%, #FF6600 100%);
}

.news-reel-card[data-country="usa"] {
    background: linear-gradient(135deg, #002868 0%, #001F4D 100%);
}

.news-reel-card[data-country="russia"] {
    background: linear-gradient(135deg, #0039A6 0%, #00247D 100%);
}

/* Default background if country not set */
.news-reel-card:not([data-country]) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Image section - 25% height when image exists */
.news-reel-image {
    width: 100%;
    height: 25vh;
    height: 25dvh;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

/* Hide image section when no image */
.news-reel-card:not([data-has-image]) .news-reel-image {
    display: none;
}

/* Content section - 75% when image exists, 100% when no image */
.news-reel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    height: 75vh;
    height: 75dvh;
}

/* Full height content when no image */
.news-reel-card:not([data-has-image]) .news-reel-content {
    height: 100vh;
    height: 100dvh;
    padding: 30px 20px;
}

.news-reel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

/* Smaller header when image exists */
.news-reel-card[data-has-image] .news-reel-header {
    margin-bottom: 10px;
}

.country-badge {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.publish-time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.news-reel-title {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 15px;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Smaller title when image exists */
.news-reel-card[data-has-image] .news-reel-title {
    font-size: 20px;
    margin-bottom: 12px;
}

.news-reel-summary {
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 20px;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

/* Smaller summary when image exists */
.news-reel-card[data-has-image] .news-reel-summary {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.read-full-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    padding: 14px 28px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
    margin-top: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    align-self: flex-start;
}

/* Smaller button when image exists */
.news-reel-card[data-has-image] .read-full-btn {
    padding: 12px 24px;
    font-size: 14px;
    border-radius: 20px;
}

.read-full-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.read-full-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Loading States */
.skeleton-loader {
    background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Removed skeleton-image - no images needed */

.skeleton-text {
    height: 20px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.skeleton-title {
    height: 40px;
    margin-bottom: 20px;
    border-radius: 4px;
}

/* Bottom Navigation Removed */

/* Countries Page */
.countries-page {
    padding: 20px;
    padding-bottom: 20px;
    min-height: 100vh;
    background: #000;
    position: relative;
}

#countryNews {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #000;
    padding: 20px;
    padding-bottom: 20px;
    overflow-y: auto;
}

#countryNews .reels-container {
    position: relative;
    height: auto;
    overflow: visible;
}

.country-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.country-card {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    color: #fff;
    transition: transform 0.2s, background 0.2s;
    cursor: pointer;
    border: 2px solid transparent;
}

.country-card:hover {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.1);
}

.country-card:active {
    transform: scale(0.98);
    background: #2a2a2a;
}

.country-flag {
    font-size: 48px;
    margin-bottom: 10px;
}

.country-name {
    font-size: 18px;
    font-weight: 600;
}

/* Trending Page */
.trending-page {
    padding: 20px;
    padding-bottom: 20px;
    min-height: 100vh;
    background: #000;
}

.trending-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.trending-item {
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 15px;
    text-decoration: none;
    color: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.trending-item[data-country="zambia"] {
    background: linear-gradient(135deg, #198A00 0%, #0D5A00 100%);
}

.trending-item[data-country="india"] {
    background: linear-gradient(135deg, #FF9933 0%, #FF6600 100%);
}

.trending-item[data-country="usa"] {
    background: linear-gradient(135deg, #002868 0%, #001F4D 100%);
}

.trending-item[data-country="russia"] {
    background: linear-gradient(135deg, #0039A6 0%, #00247D 100%);
}

.trending-item:not([data-country]) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.trending-item:active {
    transform: scale(0.98);
}

.trending-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.trending-content {
    flex: 1;
}

.trending-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.trending-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Search Page */
.search-page {
    padding: 20px;
    padding-bottom: 20px;
    min-height: 100vh;
    background: #000;
    display: flex;
    flex-direction: column;
}

.search-input {
    width: 100%;
    padding: 18px 24px;
    background: #1a1a1a;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    color: #fff;
    font-size: 18px;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
    background: #222;
}

.search-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.3);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-item {
    background: #1a1a1a;
    border-radius: 12px;
    padding: 15px;
    text-decoration: none;
    color: #fff;
}

.search-item-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.search-item-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Full Article View */
.full-article {
    padding: 30px 20px;
    padding-bottom: 30px;
    min-height: 100vh;
    color: #fff;
}

.full-article[data-country="zambia"] {
    background: linear-gradient(135deg, #198A00 0%, #0D5A00 100%);
}

.full-article[data-country="india"] {
    background: linear-gradient(135deg, #FF9933 0%, #FF6600 100%);
}

.full-article[data-country="usa"] {
    background: linear-gradient(135deg, #002868 0%, #001F4D 100%);
}

.full-article[data-country="russia"] {
    background: linear-gradient(135deg, #0039A6 0%, #00247D 100%);
}

.full-article:not([data-country]) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.full-article-header {
    margin-bottom: 20px;
}

.full-article-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 15px;
}

.full-article-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.full-article-image {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 20px;
}

.full-article-content {
    font-size: 18px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.9);
}

.full-article-content p {
    margin-bottom: 20px;
}

/* Desktop Fallback - Download Prompt */
@media (min-width: 768px) {
    .reels-container {
        display: none;
    }
    
    .desktop-fallback {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        padding: 20px;
    }
    
    .download-prompt {
        display: none;
        background: #fff;
        border-radius: 24px;
        padding: 40px;
        max-width: 500px;
        width: 100%;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        position: relative;
        animation: slideUp 0.5s ease-out;
    }
    
    .download-prompt.show {
        display: block;
    }
    
    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .download-prompt-content {
        text-align: center;
    }
    
    .download-icon {
        width: 80px;
        height: 80px;
        margin: 0 auto 20px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
    }
    
    .download-icon svg {
        width: 40px;
        height: 40px;
    }
    
    .download-prompt h2 {
        font-size: 28px;
        font-weight: 700;
        color: #1a1a1a;
        margin-bottom: 12px;
    }
    
    .download-prompt p {
        font-size: 16px;
        color: #666;
        line-height: 1.6;
        margin-bottom: 30px;
    }
    
    .download-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: #fff;
        padding: 16px 32px;
        border-radius: 12px;
        text-decoration: none;
        font-weight: 600;
        font-size: 16px;
        transition: transform 0.2s, box-shadow 0.2s;
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    
    .download-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    }
    
    .download-btn:active {
        transform: translateY(0);
    }
    
    .close-prompt {
        position: absolute;
        top: 15px;
        right: 15px;
        background: #f5f5f5;
        border: none;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.2s;
        color: #666;
    }
    
    .close-prompt:hover {
        background: #e0e0e0;
    }
    
    .close-prompt svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 767px) {
    .desktop-fallback {
        display: none;
    }
}

/* Desktop News Layout */
.desktop-news-layout {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    background: #000;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .reels-container {
        display: none !important;
    }
    
    .desktop-news-layout {
        display: block !important;
    }
}

@media (max-width: 767px) {
    .desktop-news-layout {
        display: none !important;
    }
    
    .reels-container {
        display: block !important;
    }
}

/* Desktop Banner */
#desktopBanner {
    margin-bottom: 30px;
}

.desktop-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.desktop-banner-content {
    flex: 1;
}

.desktop-banner-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.desktop-banner-description {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin: 0;
}

.desktop-banner-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    padding: 14px 28px;
    border-radius: 24px;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.desktop-banner-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.desktop-banner-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    transition: background 0.2s;
}

.desktop-banner-close:hover {
    background: rgba(0, 0, 0, 0.5);
}

.desktop-banner-close svg {
    width: 18px;
    height: 18px;
}

/* Desktop Featured Post */
.desktop-featured-post {
    margin-bottom: 40px;
}

.desktop-featured-card {
    background: #1a1a1a;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    text-decoration: none;
    color: #fff;
}

.desktop-featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.desktop-featured-image {
    width: 50%;
    min-height: 400px;
    object-fit: cover;
    background: #2a2a2a;
    flex-shrink: 0;
}

.desktop-featured-card-no-image .desktop-featured-content {
    width: 100%;
}

.desktop-featured-card-no-image {
    flex-direction: column;
}

.desktop-featured-content {
    width: 50%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.desktop-featured-badge {
    display: inline-block;
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 15px;
    width: fit-content;
}

.desktop-featured-title {
    font-size: 36px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    color: #fff;
}

.desktop-featured-summary {
    font-size: 18px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 25px;
}

.desktop-featured-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* Desktop News Grid */
.desktop-news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.desktop-news-card {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.desktop-news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.desktop-news-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #2a2a2a;
}

.desktop-news-card-content {
    padding: 20px;
}

.desktop-news-card-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.desktop-news-card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 10px;
    color: #fff;
}

.desktop-news-card-summary {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.desktop-news-card-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

/* Performance Optimizations */
img {
    loading: lazy;
    decoding: async;
}

/* Safe Area Insets */
@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
    
    .news-reel-card {
        padding-top: env(safe-area-inset-top);
    }
}


