/*
Theme Name: AI News Premium Theme
Author: Antigravity
Description: A high-end tech news theme bundled with AI News Aggregator Pro.
Version: 2.0.0
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* Default Light Mode Variables (Missing from original) */
:root {
    --primary: #6366f1;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --light: #ffffff;
    --dark: #0f172a;
    --text-main: #475569;
    --text-heading: #1e293b;
    --border: rgba(0, 0, 0, 0.05);
    --card-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

/* Dark Mode Overrides */
body.dark-mode {
    --light: #0f172a;
    --dark: #f8fafc;
    --text-main: #94a3b8;
    --text-heading: #f8fafc;
    --border: #1e293b;
    --card-bg: #1e293b;
    background-color: var(--light);
    color: var(--text-main);
}

body.dark-mode .site-header {
    background-color: #1e293b;
}

body.dark-mode .widget, 
body.dark-mode .post-card {
    background-color: #1e293b;
    border-color: #334155;
}

body.dark-mode .post-card-title a {
    color: #f1f5f9;
}

body.dark-mode .site-title {
    background: linear-gradient(90deg, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .icon-sun { opacity: 1; }
body.dark-mode .icon-moon { opacity: 0.5; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--light);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    overflow-x: hidden;
    width: 100%;
}
html { overflow-x: hidden; }

/* Mobile Safari Overflow Fix Handler */
#page.site {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    max-width: 100vw;
}


h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-heading);
    font-weight: 700;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: color 0.2s;
}

a:hover {
    color: var(--secondary);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header Layout */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.site-branding {
    flex: 1;
    display: flex;
    justify-content: center;
    text-align: center;
}

.site-title {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 800;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-logo img {
    max-height: 40px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10;
}

.main-navigation {
    display: none;
}

/* Mobile Controls */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-heading);
    border-radius: 2px;
    transition: 0.3s;
}

.btn-toggle-dark {
    background: var(--border);
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-heading);
}

.desktop-only {
    display: none;
}

@media (min-width: 1024px) {
    .desktop-only {
        display: block !important;
    }
    
    .header-left {
        display: none !important;
    }

    .site-branding {
        flex: 0 0 250px;
        order: 1;
        justify-content: flex-start;
        text-align: left;
    }
    
    .main-navigation {
        flex: 1;
        order: 2;
        display: flex;
        justify-content: center;
    }

    .header-actions {
        flex: 0 0 250px;
        order: 3;
        justify-content: flex-end;
    }
    
    .nav-menu {
        display: flex;
        list-style: none;
        padding: 0;
        margin: 0;
        gap: 25px;
        font-family: 'Outfit', sans-serif;
        font-weight: 600;
    }

    .nav-menu a {
        color: var(--text-heading);
    }

    .nav-menu a:hover {
        color: var(--primary);
    }
}

/* Mobile Nav Tray */
.mobile-nav-tray {
    position: fixed;
    top: 0;
    right: 0;
    transform: translateX(100%);
    width: 280px;
    height: 100vh;
    background: var(--light);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
}

.mobile-nav-tray.active {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 30px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-heading);
    cursor: pointer;
}

.mobile-menu-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu-items li {
    margin-bottom: 20px;
}

.mobile-menu-items a {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-heading);
}

/* Layout */
.main-content-area {
    padding: 60px 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 48px;
    width: 100%;
}

@media (max-width: 1024px) {
    .main-content-area {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}


/* Hero Section */
.featured-hero {
    margin-bottom: 60px;
}

.hero-card {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 21 / 9;
    background: #000;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    transition: transform 0.5s;
}

.hero-card:hover .hero-img {
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
}

.hero-overlay h2 {
    color: #fff;
    font-size: 2.5rem;
    margin: 0 0 10px 0;
}

/* Grid Layout */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 32px;
}

.post-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
    border-color: var(--border);
}

.post-thumb-wrapper {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.post-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-card:hover .post-thumb {
    transform: scale(1.05);
}

.post-card-body {
    padding: 24px;
}

.post-card-cat {
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    display: inline-block;
}

.post-card-title {
    font-size: 1.25rem;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.post-card-title a {
    color: var(--text-heading);
}

.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Sidebar */
.sidebar h3 {
    font-size: 1.2rem;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary);
    display: inline-block;
}

.widget {
    background: #fff;
    padding: 30px;
    border-radius: 16px;
    margin-bottom: 40px;
    border: 1px solid var(--border);
}

/* Newsletter Widget Redesign */
.ainap-newsletter-form-wrapper {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 30px;
    border-radius: 16px;
    color: #fff;
}

.ainap-newsletter-form-wrapper h3 {
    color: #fff;
    border: none;
    margin: 0 0 10px 0;
}

.ainap-newsletter-form input {
    width: 100%;
    border: none;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.ainap-newsletter-form button {
    width: 100%;
    background: #fff;
    color: var(--primary);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

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

/* Newsletter Dark Mode & Modern Styling */
.ainap-newsletter-container {
    padding: 10px 0;
}

.ainap-modern-form .ainap-form-group {
    margin-bottom: 12px;
}

.ainap-modern-form input,
.ainap-modern-form select,
.ainap-btn-primary {
    display: block;
    width: 100% !important;
    height: 50px !important; /* Forced shared height */
    padding: 0 15px !important; /* Unified padding */
    border-radius: 10px !important;
    font-family: inherit;
    font-size: 15px;
    box-sizing: border-box !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ainap-modern-form input,
.ainap-modern-form select {
    background-color: var(--card-bg);
    color: var(--text-heading);
    border: 1px solid var(--border) !important;
}

.ainap-modern-form input:focus,
.ainap-modern-form select:focus {
    border-color: var(--primary) !important;
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.ainap-btn-primary {
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    color: #fff;
    border: none !important;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    margin-top: 5px; /* Tiny gap from the groups above */
}

.ainap-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

/* Floating Side Navigation - Premium Teardrop Style */
.side-nav-btn {
    position: fixed;
    top: 75%; /* Moved down from 50% as requested */
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px; /* Slim when not touched */
    height: 45px;
    background: rgba(255, 255, 255, 0.8); /* Much more visible in light mode */
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b; /* Dark text/arrow for light mode */
    text-decoration: none !important;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    white-space: nowrap;
    opacity: 0.9; /* High visibility */
}

[data-theme="dark"] .side-nav-btn {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}

/* Teardrop Shapes */
.side-nav-btn.prev { 
    left: 15px; 
    border-radius: 5px 50% 50% 50%; /* Pointy top-left */
}
.side-nav-btn.next { 
    right: 15px; 
    flex-direction: row-reverse;
    border-radius: 50% 50% 5px 50%; /* Pointy bottom-right */
}

.side-nav-btn:hover {
    width: 280px; /* Expand on hover */
    background: linear-gradient(135deg, #6366f1, #ec4899) !important;
    color: #ffffff !important;
    opacity: 1;
    border-radius: 50px; /* Becomes a pill on hover */
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.4);
}

.nav-arrow {
    font-size: 1.4rem;
    font-weight: 700; /* Bolder arrow */
    min-width: 45px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.nav-label {
    opacity: 0;
    margin: 0 10px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: opacity 0.3s;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.prev .nav-label { align-items: flex-start; }
.next .nav-label { align-items: flex-end; text-align: right; }

.nav-label-type {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
    display: block;
}

.side-nav-btn:not(:hover) .nav-label {
    display: none;
}

.side-nav-btn:hover .nav-label {
    opacity: 1;
}

/* Responsive Support */
@media (max-width: 1024px) {
    .side-nav-btn {
        width: 40px;
        height: 40px;
    }
    .side-nav-btn.prev { 
        left: 10px; 
        border-radius: 5px 40% 40% 40%; 
    }
    .side-nav-btn.next { 
        right: 10px; 
        border-radius: 40% 40% 5px 40%; 
    }
    
    .side-nav-btn:hover,
    .side-nav-btn:active {
        width: 220px; /* Enable expansion on mobile touch/hover */
        opacity: 1;
        border-radius: 50px !important; /* Force symmetric pill shape when open */
    }
}

@media (max-width: 480px) {
    .side-nav-btn {
        top: 75%; /* Match desktop/tablet 75% height */
        opacity: 0.95;
    }
}

/* Related News Styling */
.related-news-section h2 {
    position: relative;
    padding-left: 20px;
}

.related-news-section h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 30px;
    background: var(--primary-grad);
    border-radius: 3px;
}

.ainap-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

.ainap-btn-primary:active {
    transform: translateY(0);
}

.ainap-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: none;
}

.post-card, .hero-card, .widget {
    animation: fadeInUp 0.6s ease-out forwards;
}

/* SURGICAL MOBILE-ONLY PREMIUM OVERRIDES */
@media (max-width: 1023px) {
    .container { padding: 0 16px; }

    .site-header {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    body.dark-mode .site-header {
        background: rgba(15, 23, 42, 0.85);
    }

    .header-container {
        display: flex;
        justify-content: space-between !important;
        align-items: center;
    }

    .header-left {
        flex: 1;
        display: block !important;
        visibility: visible !important;
        width: 40px;
    }

    .site-branding {
        flex: 2;
        justify-content: center !important;
        text-align: center !important;
    }

    .header-actions {
        flex: 1;
        justify-content: flex-end !important;
        order: 3;
    }

    /* Redefine Header for Mobile */
    .header-left { order: 1; }
    .site-branding { order: 2; }
    .header-actions { order: 3; }

    .site-title { font-size: 1.25rem !important; }

    .hero-card { aspect-ratio: 1/1 !important; border-radius: 16px; }
    .hero-overlay { padding: 25px; }
    .hero-overlay h2 { font-size: 1.75rem !important; }


    .news-grid { grid-template-columns: 1fr !important; gap: 20px; }
    
    .sidebar { display: none !important; }
}

