/*
 * Main Styling Sheet - Communist Political News Website
 * Premium Dark Red Theme, Clean Typographies, Glassmorphism & Micro-animations.
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
    --primary-red: #800000;
    --hover-red: #d90429;
    --accent-gold: #ffd166;
    
    /* Light Mode Variables */
    --bg-primary: #ffffff;
    --bg-secondary: #f4f4f5;
    --bg-ticker: #18181b;
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-ticker: #ffffff;
    --border-color: #e4e4e7;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --scrollbar-track: #f4f4f5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6, .display-font {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
}

/* Premium Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--hover-red);
}

/* Page Loader styling */
#page-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-primary);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sticky Header & Navigation */
header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.top-bar {
    background-color: var(--bg-ticker);
    color: var(--text-ticker);
    padding: 6px 0;
    font-size: 0.85rem;
}
.top-bar-nav a {
    color: var(--text-ticker);
    text-decoration: none;
    margin-left: 15px;
}
.top-bar-nav a:hover {
    color: var(--accent-gold);
}

/* Sticky Category Navigation below logo header */
.category-nav-bar {
    background-color: var(--primary-red);
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.category-nav-bar a:not(.dropdown-item) {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-weight: 500;
    padding: 12px 16px;
    display: inline-block;
    transition: all 0.2s ease;
}
.category-nav-bar a:not(.dropdown-item):hover, .category-nav-bar a:not(.dropdown-item).active {
    color: var(--accent-gold);
    background-color: rgba(0,0,0,0.15);
}

/* Dropdown Hover opening in navbar on desktop */
@media (min-width: 992px) {
    .category-nav-bar .dropdown:hover .dropdown-menu {
        display: block;
        margin-top: 0;
    }
}

/* Ticker Breaking News */
.ticker-wrap {
    display: flex;
    overflow: hidden;
    background-color: #111;
    color: #fff;
    padding: 8px 15px;
    font-size: 0.9rem;
    align-items: center;
}
.ticker-title {
    background: var(--primary-red);
    padding: 4px 12px;
    font-weight: bold;
    text-transform: uppercase;
    margin-right: 15px;
    border-radius: 3px;
    font-size: 0.8rem;
    white-space: nowrap;
    animation: pulse 1.5s infinite;
}
.ticker-content {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
}
.ticker-marquee {
    display: inline-block;
    animation: marquee 25s linear infinite;
    padding-left: 100%;
}
.ticker-item {
    display: inline-block;
    padding-right: 50px;
    color: #f4f4f5;
    text-decoration: none;
}
.ticker-item:hover {
    color: var(--accent-gold);
}
@keyframes marquee {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

/* Article & Blog Cards */
.premium-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.3s ease;
}
.premium-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}
.card-img-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16/9;
}
.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.premium-card:hover .card-img-wrapper img {
    transform: scale(1.05);
}
.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary-red);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Image hover zoom utility */
.img-hover-zoom {
    transition: transform 0.5s ease;
}
.img-hover-zoom:hover {
    transform: scale(1.05);
}

/* Hero Section Slider/Grids */
.hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    min-height: 0; /* prevent grid blowout */
}
.hero-slider-main {
    position: relative;
    height: 500px;
    border-radius: 15px;
    overflow: hidden;
    min-width: 0; /* prevent grid overflow */
}
.hero-slider-item {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: none;
}
.hero-slider-item.active {
    display: block;
}
.hero-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    color: #fff;
    padding: 30px;
}
.hero-side-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 500px;
}
.hero-side-item {
    flex: 1;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

/* Floating Elements */
.floating-whatsapp {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #25d366;
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    text-decoration: none;
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.floating-whatsapp:hover {
    transform: scale(1.1);
    background-color: #128c7e;
    color: white;
}
.back-to-top {
    position: fixed;
    bottom: 95px;
    right: 30px;
    background-color: var(--primary-red);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 1000;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* Reading Progress Bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 10000;
}
.progress-bar {
    height: 4px;
    background: var(--hover-red);
    width: 0%;
    transition: width 0.1s ease;
}

/* Membership Card print styling */
.membership-card-preview {
    background: linear-gradient(135deg, #800000 0%, #300000 100%);
    color: white;
    border-radius: 15px;
    padding: 25px;
    position: relative;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(128, 0, 0, 0.3);
    overflow: hidden;
}
.membership-card-preview::before {
    content: "";
    position: absolute;
    bottom: -40px;
    right: -20px;
    font-size: 200px;
    opacity: 0.1;
    pointer-events: none;
}

/* Footer Section */
footer {
    background-color: #0f0f11;
    color: #e1e1e6;
    border-top: 4px solid var(--primary-red);
}
footer h5 {
    color: #ffffff;
    margin-bottom: 20px;
    font-weight: 600;
}
footer p,
footer span,
footer li,
footer .small,
footer .form-control::placeholder,
footer .text-muted {
    color: #e6e6e6 !important;
    opacity: 1 !important;
}
footer a {
    color: #ffffff !important;
    text-decoration: none;
    transition: color 0.2s ease;
}
footer a:hover {
    color: var(--accent-gold) !important;
}
footer, footer * {
    color: #f4f4f5 !important;
}
footer .form-control {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
}
footer .form-control::placeholder {
    color: rgba(244, 244, 245, 0.75) !important;
}
footer .btn-link,
footer .btn-link:hover {
    color: #ffffff !important;
}

/* Floating Share Buttons */
.share-sidebar {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}
.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
}
.share-btn:hover {
    transform: scale(1.1);
    color: #fff;
}
.share-facebook { background-color: #3b5998; }
.share-twitter { background-color: #1da1f2; }
.share-whatsapp { background-color: #25d366; }
.share-telegram { background-color: #0088cc; }

/* Responsive adjustments */
@media(max-width: 991px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
    .hero-slider-main {
        height: 380px;
    }
    .hero-side-column {
        height: auto;
        flex-direction: row;
    }
    .hero-side-item {
        height: 180px;
    }
    .share-sidebar {
        display: none; /* Hide on mobile/tablet */
    }
}
@media(max-width: 576px) {
    .hero-slider-main {
        height: 280px;
    }
    .hero-side-column {
        flex-direction: column;
    }
    .hero-side-item {
        height: 150px;
    }
}

/* ---------------------------------------------------------------
   Utility Classes
--------------------------------------------------------------- */

/* Hover text colour (used in news card links) */
.hover-red:hover {
    color: var(--hover-red) !important;
}

/* Multi-line text truncation helpers */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------------------------------------------------------------
   Article Body Rich Text Styles
   Applied to the .article-content div that echoes sanitize_html()
--------------------------------------------------------------- */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}
.article-content p {
    margin-bottom: 1.2rem;
    color: var(--text-primary);
}
.article-content a {
    color: var(--hover-red);
    text-decoration: underline;
}
.article-content a:hover {
    color: var(--primary-red);
}
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}
.article-content blockquote {
    border-left: 4px solid var(--primary-red);
    padding: 12px 20px;
    margin: 1.5rem 0;
    background: var(--bg-secondary);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-secondary);
}
.article-content ul,
.article-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.2rem;
    color: var(--text-primary);
}
.article-content li {
    margin-bottom: 0.4rem;
}
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
.article-content table th,
.article-content table td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}
.article-content table th {
    background: var(--bg-secondary);
    font-weight: 600;
}
.article-content pre,
.article-content code {
    background: var(--bg-secondary);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.9em;
    color: var(--primary-red);
}
.article-content pre {
    padding: 16px;
    overflow-x: auto;
}
.article-content hr {
    border-color: var(--border-color);
    margin: 2rem 0;
}

/* ---------------------------------------------------------------
   Header scrolled shadow effect
--------------------------------------------------------------- */
header.header-scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
