:root {
    --primary: #c0392b;
    --primary-dark: #a93226;
    --secondary: #2c3e50;
    --accent: #f39c12;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #000000;
    --text-muted: #475569;
    --glass: rgba(0, 0, 0, 0.05);
    --border: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
}

.article-body {
    color: var(--text-main);
    font-size: 19px;
    letter-spacing: -0.01em;
}

.article-body p {
    margin-bottom: 25px;
    line-height: 1.8;
}

[data-theme="dark"] .article-body {
    color: #e2e8f0;
}

/* News Ticker */
.news-ticker {
    background: #f8fafc;
    color: #1e293b;
    height: 45px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .news-ticker {
    background: #1e293b;
    color: white;
}

.ticker-label {
    background: #e11d48;
    color: white;
    padding: 0 25px;
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    position: relative;
    z-index: 2;
}

.ticker-content {
    display: flex;
    white-space: nowrap;
    animation: ticker 40s linear infinite;
}

.ticker-item {
    padding: 0 30px;
    font-size: 14px;
}

.ticker-cat {
    color: #e11d48;
    font-weight: 700;
    margin-right: 5px;
}

/* Date Badge */
.date-badge {
    display: inline-block;
    background: #fef9c3;
    color: #854d0e;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 15px;
    text-transform: uppercase;
}

/* Hero Section Split */
.hero-split {
    display: grid;
    grid-template-columns: 1.8fr 1.2fr;
    gap: 30px;
    margin-top: 30px;
}

.hero-main {
    position: relative;
    height: 550px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.carousel-slide {
    display: none;
    height: 100%;
    width: 100%;
    position: relative;
}

.carousel-slide.active {
    display: block;
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 60px 40px 40px;
    background: linear-gradient(transparent, rgba(0,0,0,0.95));
    color: white;
    z-index: 10;
}

.hero-overlay h2 {
    font-size: 36px;
    line-height: 1.2;
    font-weight: 800;
}

.carousel-dots {
    position: absolute;
    bottom: 20px;
    right: 40px;
    display: flex;
    gap: 8px;
    z-index: 20;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    z-index: 25;
    transition: 0.3s;
    border: 1px solid rgba(255,255,255,0.1);
    opacity: 0;
}

.hero-main:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn:hover {
    background: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev { left: 20px; }
.carousel-btn.next { right: 20px; }

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: 0.3s;
}

.dot.active {
    background: #e11d48;
    width: 25px;
    border-radius: 10px;
}

/* Pagination Fix */
.pagination, nav[role="navigation"] {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 50px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
}

nav[role="navigation"] > div:last-child {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

nav[role="navigation"] .hidden.sm\:flex-1 {
    display: flex !important;
    justify-content: center;
    order: 2;
}

nav[role="navigation"] .relative.inline-flex {
    order: 1; /* Prev */
}

nav[role="navigation"] .relative.inline-flex:last-child {
    order: 3; /* Next */
}

nav[role="navigation"] svg {
    width: 20px !important;
    height: 20px !important;
}

nav[role="navigation"] .flex.justify-between {
    display: none !important; /* Hide the "Showing X to Y" text if redundant */
}

nav[role="navigation"] a, nav[role="navigation"] span {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 14px;
    text-decoration: none;
    transition: 0.3s;
}

nav[role="navigation"] a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

nav[role="navigation"] span[aria-current="page"] {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.hero-side-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.hero-side-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 20px;
}

.hero-side-item img {
    width: 100px;
    height: 100px;
    border-radius: 10px;
    object-fit: cover;
}

.hero-side-item .cat-tag {
    display: inline-block;
    background: #ff6b6b;
    color: white;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 3px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.hero-side-item h4 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.hero-side-item.highlight h4 {
    color: #f97316;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
nav {
    height: 80px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

.nav-hidden {
    transform: translateY(-100%);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

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

.nav-mag-highlight {
    background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%);
    color: white !important;
    padding: 8px 22px !important;
    border-radius: 50px;
    font-weight: 800 !important;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.nav-mag-highlight:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 8px 25px rgba(225, 29, 72, 0.6);
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

.nav-mag-highlight i {
    font-size: 14px;
    animation: pulseBook 2s infinite;
}

/* Search Bar Styling */
.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 2px 5px 2px 15px;
    transition: 0.3s;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(192, 57, 43, 0.2);
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 13px;
    width: 180px;
    padding: 8px 0;
}

.search-bar button {
    background: var(--primary);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.search-bar button:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

@keyframes pulseBook {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.btn-premium {
    background: linear-gradient(45deg, var(--accent), #e67e22);
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    color: white;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.main-featured {
    height: 500px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.main-featured img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
}

.tag {
    display: inline-block;
    padding: 5px 15px;
    background: var(--primary);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 15px;
}

.main-featured h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

/* Sidebar List */
.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.side-card {
    display: flex;
    gap: 15px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.side-card img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
}

.side-card h4 {
    font-size: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Section Titles */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 20px;
    border-left: 4px solid var(--primary);
    padding-left: 15px;
}

/* Grid Articles */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.article-card {
    background: var(--bg-card);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.article-card:hover {
    transform: translateY(-5px);
}

.card-img {
    height: 200px;
    overflow: hidden;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    padding: 20px;
}

.card-body h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.premium-badge {
    color: var(--accent);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Single Article */
.article-header {
    padding: 60px 0;
    text-align: center;
}

.article-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: var(--text-muted);
    margin-top: 15px;
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 18px;
}

.premium-locked {
    margin-top: 30px;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 20px;
    text-align: center;
    border: 1px dashed var(--accent);
}

.premium-blur {
    filter: blur(8px);
    user-select: none;
    pointer-events: none;
}

/* Footer */
footer {
    margin-top: 80px;
    padding: 60px 0;
    background: #000;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
}

@media (max-width: 992px) {
    /* Navbar structure */
    nav {
        height: auto !important;
        padding: 15px 0 !important;
    }
    .nav-content {
        flex-direction: column !important;
        gap: 15px !important;
        align-items: center !important;
        padding: 10px 0 !important;
    }
    .nav-auth {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 12px !important;
        margin-left: 0 !important;
        width: 100% !important;
    }
    #header-middle-ads {
        display: none !important; /* Hide next-to-logo ads on mobile */
    }
    
    /* Hero Carousel layout */
    .hero-split {
        grid-template-columns: 1fr !important;
        gap: 25px !important;
    }
    .hero-main {
        height: 380px !important;
    }
    .hero-overlay {
        padding: 30px 20px 20px !important;
    }
    .hero-overlay h2 {
        font-size: 24px !important;
    }
    
    /* Marketplace grid */
    .marketplace-split {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    /* Editorial & Magazines split */
    .editorial-mag-split {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    
    /* Main bottom feed */
    .latest-news-split {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    
    /* Footer layout */
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        text-align: center !important;
    }
    .footer-content form {
        max-width: 320px !important;
        margin: 0 auto !important;
    }
    .footer-content ul {
        align-items: center !important;
    }
    .nav-categories {
        justify-content: flex-start !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}

@media (max-width: 576px) {
    .hero-main {
        height: 280px !important;
    }
    .hero-overlay h2 {
        font-size: 18px !important;
    }
    .hero-side-item {
        grid-template-columns: 80px 1fr !important;
        gap: 12px !important;
    }
    .hero-side-item img {
        width: 80px !important;
        height: 80px !important;
    }
    .hero-side-item h4 {
        font-size: 14px !important;
    }
    
    /* Latest publication item column layout for small mobiles */
    .side-card {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .side-card > div:first-child {
        width: 100% !important;
        height: 180px !important;
    }
    
    .section-header h2 {
        font-size: 18px !important;
    }
}
