:root {
    --bg-color: #f8fafc; 
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    
    /* The Cyber/Analytical Palette */
    --brand-dark: #020617;  
    --brand-accent: #00d8ff;   /* True Neon Cyan */
    --brand-accent-glow: rgba(0, 216, 255, 0.3);
    --brand-blue: #0a84ff;     
    --border-color: #e2e8f0;
    
    --bento-radius: 24px;
    --inner-radius: 14px;
    --bento-shadow: 0 10px 40px -10px rgba(15, 23, 42, 0.08); 
    --hover-shadow: 0 20px 40px -10px rgba(0, 216, 255, 0.15); 
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* =========================================
   1. THE UNIFIED APP HEADER (GLASSMORPHISM)
   ========================================= */
.app-header {
    background: rgba(2, 6, 23, 0.95); /* Made darker & more opaque to hide the PNG's black box */
    backdrop-filter: blur(12px); 
    -webkit-backdrop-filter: blur(12px);
    color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 216, 255, 0.15); 
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 80px; 
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

/* Restructured Logo Zone */
.brand-zone { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.brand-crest-img { 
    height: 48px; 
    width: 48px; 
    object-fit: cover; 
    border-radius: 50%;
    mix-blend-mode: screen; /* THIS hides the black background of the image! */
    filter: drop-shadow(0 0 12px rgba(0, 216, 255, 0.5)); 
}

.brand-text { display: flex; flex-direction: column; justify-content: center; gap: 6px; }

.logo-row { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 1.8rem; color: #ffffff; margin: 0; line-height: 1; text-transform: uppercase; } /* Forced uppercase to prevent 'Galam' */

.publisher-badge-modern {
    font-size: 0.55rem;
    color: var(--brand-accent);
    background: rgba(0, 216, 255, 0.08);
    border: 1px solid rgba(0, 216, 255, 0.25);
    padding: 4px 8px;
    border-radius: 20px; 
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
    box-shadow: 0 0 10px rgba(0, 216, 255, 0.1);
}

.tagline-modern {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

/* Glassy Navigation Links */
.main-nav { flex-grow: 1; display: flex; justify-content: center; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 12px; }
.main-nav a { 
    color: rgba(255,255,255,0.7); 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 0.9rem; 
    transition: all 0.3s ease; 
    padding: 8px 18px; 
    border-radius: 20px; 
    background: rgba(255,255,255,0.03); 
    border: 1px solid rgba(255,255,255,0.05); 
}
.main-nav a:hover { color: #ffffff; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }

/* The Active Tab Glow */
.main-nav a.active { 
    color: var(--brand-accent); 
    background: rgba(0, 216, 255, 0.1); 
    border: 1px solid rgba(0, 216, 255, 0.3); 
    box-shadow: 0 0 15px rgba(0, 216, 255, 0.15), inset 0 0 10px rgba(0, 216, 255, 0.05); 
    font-weight: 700;
}

/* Glassy Action Buttons */
.action-zone { flex-shrink: 0; display: flex; align-items: center; gap: 12px;}
.lang-btn { 
    background: rgba(255,255,255,0.05); 
    color: #ffffff; 
    border: 1px solid rgba(255,255,255,0.15); 
    padding: 8px 16px; 
    border-radius: 12px; 
    font-weight: 700; 
    cursor: pointer; 
    font-size: 0.85rem; 
    transition: all 0.3s ease; 
}
.lang-btn:hover { 
    background: rgba(0, 216, 255, 0.15); 
    color: var(--brand-accent); 
    border-color: rgba(0, 216, 255, 0.4); 
    box-shadow: 0 0 12px rgba(0, 216, 255, 0.2);
}

/* =========================================
   2. SUB-HEADER FILTER STRIP
   ========================================= */
.filter-strip {
    background: rgba(248, 250, 252, 0.98);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 80px; z-index: 990; padding: 14px 0;
}

.channel-container { max-width: 1400px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 12px; overflow-x: auto; white-space: nowrap; }
.channel-container::-webkit-scrollbar { display: none; }

.filter-label { font-weight: 800; font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; margin-right: 8px; letter-spacing: 0.5px;}
.channel-btn { display: flex; align-items: center; gap: 8px; background: #ffffff; border: 1px solid var(--border-color); padding: 8px 16px; border-radius: 20px; cursor: pointer; font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); transition: all 0.2s ease; flex-shrink: 0; }
.channel-btn img { height: 18px; width: 18px; object-fit: contain; border-radius: 50%; }
.channel-btn:hover { border-color: #cbd5e1; color: var(--text-primary); background: #f8fafc;}

.channel-btn.active { background: #0f172a; color: #ffffff; border-color: #0f172a; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15); }

/* =========================================
   3. BENTO MAIN LAYOUT
   ========================================= */
.bento-wrapper { max-width: 1400px; margin: 40px auto; padding: 0 24px; }
.portal-container { display: grid; grid-template-columns: 2.8fr 1fr; gap: 32px; }

.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding: 0 8px; }
.section-title h2 { margin: 0; font-size: 1.5rem; color: var(--text-primary); text-transform: uppercase; font-weight: 900; letter-spacing: -0.5px;}
.live-indicator { display: flex; align-items: center; gap: 8px; color: var(--brand-blue); font-weight: 800; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px;}
.pulse { width: 8px; height: 8px; background-color: var(--brand-blue); border-radius: 50%; box-shadow: 0 0 8px var(--brand-blue); animation: pulse 1.5s infinite; }

.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }

.bento-widget { background: var(--card-bg); border-radius: var(--bento-radius); box-shadow: var(--bento-shadow); padding: 24px; transition: background-color 0.3s ease, border-color 0.3s ease;}
.bento-card { background: var(--card-bg); border-radius: var(--bento-radius); box-shadow: var(--bento-shadow); border: 1px solid transparent; padding: 24px; display: flex; flex-direction: column; transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease, background-color 0.3s ease; }
.bento-card:hover { transform: translateY(-4px); box-shadow: var(--hover-shadow); border-color: rgba(0, 216, 255, 0.4); }

.bento-image-wrapper { position: relative; width: 100%; height: 200px; border-radius: var(--inner-radius); overflow: hidden; margin-bottom: 20px; background-color: #f1f5f9; }
.bento-image { width: 100%; height: 100%; object-fit: cover; }
.bento-badge { position: absolute; top: 12px; right: 12px; background: rgba(2, 6, 23, 0.8); backdrop-filter: blur(8px); color: var(--brand-accent); padding: 6px 12px; border-radius: 8px; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; border: 1px solid rgba(0, 216, 255, 0.2); }

.bento-content { display: flex; flex-direction: column; flex-grow: 1; }
.bento-title { margin: 0 0 16px 0; font-size: 1.25rem; font-weight: 800; line-height: 1.4; letter-spacing: -0.02em;}
.bento-title a { color: var(--text-primary); text-decoration: none; transition: color 0.3s ease;}
.bento-title a:hover { color: var(--brand-blue); }

.publisher-info { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 24px;}
.publisher-logo { height: 24px; width: 24px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border-color); }
.bento-date { margin-left: auto; font-weight: 600; font-size: 0.75rem; color: #94a3b8; }

.ai-bento-section { background: linear-gradient(145deg, #f8fafc, #f1f5f9); border-radius: 16px; padding: 18px; margin-top: auto; border: 1px solid #e2e8f0; box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.8); transition: background 0.3s ease, border-color 0.3s ease; }
.ai-label-row { margin-bottom: 12px; }
.ai-label { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; padding: 5px 12px; border-radius: 8px; display: inline-block; }
.ai-label-row:first-child .ai-label { color: var(--brand-blue); background: rgba(10, 132, 255, 0.08); border: 1px solid rgba(10, 132, 255, 0.2); }
.ai-divider + .ai-label-row .ai-label { color: var(--brand-dark); background: rgba(2, 6, 23, 0.08); border: 1px solid rgba(2, 6, 23, 0.2); }

.ai-text { font-size: 0.9rem; line-height: 1.6; color: var(--text-primary); font-weight: 600;}
.perspective-text { color: var(--text-secondary); font-style: normal; font-weight: 500;}
.ai-divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border-color), transparent); margin: 20px 0; }

.sidebar-box h3 { margin-top: 0; color: var(--text-primary); border-bottom: 1px solid var(--border-color); padding-bottom: 16px; font-weight: 900; text-transform: uppercase; font-size: 1.1rem; letter-spacing: 0.5px;}
.sidebar-item { padding: 16px 0; border-bottom: 1px solid var(--border-color); }
.sidebar-item:last-child { border-bottom: none; padding-bottom: 0;}
.sidebar-item a { color: var(--text-primary); text-decoration: none; font-weight: 700; font-size: 0.95rem; line-height: 1.4; display: block; margin-bottom: 8px; transition: color 0.3s ease;}
.sidebar-item a:hover { color: var(--brand-blue); }
.sidebar-meta { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600;}

/* =========================================
   4. TRUE DARK MODE
   ========================================= */
body[data-theme="dark"] {
    --bg-color: #020617; 
    --card-bg: #0f172a;  
    --text-primary: #f8fafc; 
    --text-secondary: #94a3b8;
    --border-color: #1e293b;
    --bento-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.8); 
    --hover-shadow: 0 20px 40px -10px rgba(0, 216, 255, 0.2);
}

body[data-theme="dark"] .ai-bento-section { background: linear-gradient(145deg, #0b1426, #020617); border: 1px solid #1e293b; box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.02); }
body[data-theme="dark"] .filter-strip { background: rgba(2, 6, 23, 0.95); border-bottom-color: #1e293b; }
body[data-theme="dark"] .channel-btn { background: #0f172a; border-color: #1e293b; color: #94a3b8; }
body[data-theme="dark"] .channel-btn:hover { border-color: #334155; color: #f8fafc; background: #1e293b;}
body[data-theme="dark"] .channel-btn.active { background: var(--brand-accent); color: #020617; border-color: var(--brand-accent); box-shadow: 0 0 10px rgba(0, 216, 255, 0.3); }
body[data-theme="dark"] .bento-image-wrapper { background-color: #1e293b; }
body[data-theme="dark"] .ai-label-row:first-child .ai-label { color: #3b82f6; background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.3); }
body[data-theme="dark"] .ai-divider + .ai-label-row .ai-label { color: var(--brand-accent); background: rgba(0, 216, 255, 0.1); border-color: rgba(0, 216, 255, 0.3); }

.theme-btn { background: transparent; border: none; font-size: 1.2rem; cursor: pointer; padding: 4px 8px; transition: transform 0.2s; }
.theme-btn:hover { transform: scale(1.1); }

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(10, 132, 255, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(10, 132, 255, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(10, 132, 255, 0); }
}

/* =========================================
   5. SKELETON LOADERS
   ========================================= */
.skeleton-card { background: var(--card-bg); border-radius: var(--bento-radius); padding: 24px; display: flex; flex-direction: column; gap: 16px; border: 1px solid var(--border-color); }
.skeleton-img { width: 100%; height: 200px; border-radius: var(--inner-radius); }
.skeleton-title { height: 24px; width: 80%; border-radius: 6px; margin-bottom: 8px;}
.skeleton-text { height: 14px; width: 100%; border-radius: 4px; }
.skeleton-text.short { width: 60%; }

.shimmer {
    background: #f1f5f9;
    background-image: linear-gradient(to right, #f1f5f9 0%, #e2e8f0 20%, #f1f5f9 40%, #f1f5f9 100%);
    background-repeat: no-repeat;
    background-size: 800px 100%; 
    animation: placeholderShimmer 1.5s linear infinite forwards;
}
body[data-theme="dark"] .shimmer {
    background: #1e293b;
    background-image: linear-gradient(to right, #1e293b 0%, #334155 20%, #1e293b 40%, #1e293b 100%);
}
@keyframes placeholderShimmer { 0% { background-position: -468px 0; } 100% { background-position: 468px 0; } }

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 1000px) {
    .portal-container { display: flex; flex-direction: column; gap: 24px; }
    
    /* 🚨 CHANGED: order: 2 forces the sidebar below the main feed on mobile */
    .sidebar { display: block; order: 2; } 
}

@media (max-width: 768px) {
    .app-header { height: auto; padding: 0; }
    
    /* Removed flex-wrap so the container stops generating empty rows */
    .header-container { 
        height: auto; 
        display: block; 
        position: relative; /* Anchors the floating buttons */
        padding: 16px 0 0 0; 
    }
    
    /* 1. Top Left: Logo Zone */
    .brand-zone { 
        display: flex; 
        align-items: flex-start; 
        padding-left: 16px;
        padding-right: 140px; /* 🚨 Increased from 100px to 140px to protect the Moon! */
        width: 100%; 
        box-sizing: border-box;
    }
    .brand-crest-img { width: 36px; height: 36px; margin-top: 2px; }
    
    /* Allow the badge to drop below the logo cleanly on very small screens */
    .logo-row { flex-wrap: wrap; gap: 6px; align-items: center; }
    .logo { font-size: 1.3rem; }
    .publisher-badge-modern { display: inline-block; font-size: 0.45rem; padding: 2px 6px; }
    .tagline-modern { display: block; font-size: 0.5rem; letter-spacing: 0.5px; margin-top: 4px; }
    
    /* 2. Top Right: Action Buttons (Locked in place) */
    .action-zone { 
        position: absolute; 
        right: 16px; 
        top: 16px; 
        display: flex; 
        align-items: center; 
        margin: 0;
    }
    .theme-btn { font-size: 1.1rem; margin-right: 8px; padding: 4px; }
    .lang-btn { padding: 6px 12px; font-size: 0.8rem; }
    
    /* 3. Bottom Row: Sleek Swipable Menu */
    .main-nav { width: 100%; margin-top: 16px; display: block; }
    .main-nav ul { 
        display: flex; 
        flex-wrap: nowrap; 
        overflow-x: auto; 
        gap: 12px; 
        padding: 0 16px 16px 16px; 
        margin: 0; 
        -webkit-overflow-scrolling: touch; 
    }
    
    .main-nav ul::-webkit-scrollbar { display: none; }
    .main-nav a { display: inline-block; white-space: nowrap; padding: 8px 16px; font-size: 0.85rem; }
    
    /* Filter strip adjustment */
    .filter-strip { top: 110px; padding: 10px 0;} 
    .channel-container { padding: 0 16px; gap: 8px; }
    .bento-wrapper { margin: 20px auto; padding: 0 16px;}
    .news-grid { grid-template-columns: 1fr; gap: 16px; }
}