:root {
    /* Theme Variables */
    --bg-body: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;

    --accent-color: #0f172a; /* Executive Blue/Black */
    --accent-hover: #334155;
    --accent-light: #e2e8f0;

    --brand-blue: #2563eb; /* Brand Blue for Light Mode */

    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    --font-main: 'Outfit', sans-serif;
    --font-serif: 'Merriweather', serif;

    /* Status Colors */
    --read-bg: #f0fdf4;
    --read-text: #166534;
    --read-border: #bbf7d0;

    --saved-color: #f59e0b;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-body: #000000;
    --bg-sidebar: #18181b;
    --bg-card: #121212;

    --text-primary: #e5e5e5;
    --text-secondary: #a3a3a3;
    --text-tertiary: #52525b;

    --accent-color: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-light: #27272a;

    --brand-blue: #60a5fa; /* Lighter Blue for Dark Mode */

    --border-color: #27272a;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);

    --read-bg: #064e3b;
    --read-text: #a7f3d0;
    --read-border: #065f46;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: background 0.3s, color 0.3s;
}

/* --- SIDEBAR --- */
aside {
    width: 300px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
    overflow: hidden;
}

.side-brand {
    display: none; /* Hidden by default, shown on collapse */
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-blue);
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

@media (max-width: 1025px) {
    .side-brand {
        display: block !important;
    }
}

/* Desktop Collapse State */
@media (min-width: 1025px) {
    body.sidebar-closed aside {
        width: 0;
        border-right: none;
    }
}

.brand-area {
    /* padding: 24px; */
    border-bottom: 1px solid var(--border-color);
    height: 64px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    padding-left: 20px;
}

.brand-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    /* margin-bottom: 4px; */
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--brand-blue); /* Updated Blue */
    /* padding-left: 20px; */
}

.brand-date {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.progress-area {
    padding: 20px 24px;
    background: var(--bg-sidebar);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.progress-track {
    height: 6px;
    background: var(--accent-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-color);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.nav-item {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--accent-light);
}

.nav-item.active {
    background: var(--accent-light);
    border-left-color: var(--accent-color);
}

.nav-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.nav-headline {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.nav-item.read .nav-headline {
    text-decoration: line-through;
    opacity: 0.6;
}

/* --- MAIN CONTENT --- */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    width: 100%; /* Ensure full width on collapse */
}

header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-sidebar); /* Sticky effect */
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-titles {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.header-tagline {
    font-size: 20px;
    color: var(--text-primary); /* Changed to main font color as requested */
    font-weight: 400;
    text-align: center;
    padding: 20px 0;
    margin: 0 auto;
    border-bottom: 1px solid var(--border-color);
}

.header-title-mobile {
    font-weight: 700;
    font-size: 16px;
    display: none;
    color: var(--brand-blue);
}

/* New desktop brand text shown when sidebar is collapsed */
.desktop-brand {
    display: none; /* Hidden by default */
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-blue);
    margin-left: 12px;
    letter-spacing: -0.5px;
}

/* Desktop Collapse State: Show header brand */
@media (min-width: 1025px) {
    body.sidebar-closed .desktop-brand {
        display: block;
    }
}

.view-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    display: none; /* Shown via JS */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search Section */
.search-section {
    padding: 24px 24px 0 24px;
    display: none; /* Toggled via JS */
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-blue); /* Prominent Color */
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border-radius: 12px;
    border: 2px solid var(--brand-blue); /* Prominent Border */
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    box-shadow: 0 0 0 4px var(--accent-light);
}

/* Top Right Brand Logo */
.top-brand {
    font-family: var(--font-main);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    text-decoration: none;
    padding-left: 12px;
}
.top-brand span { color: var(--brand-blue); } /* Updated Blue */

.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    scroll-behavior: smooth;
}

.feed-container {
    max-width: 800px;
    margin: 0 auto;
}

/* --- ARTICLE CARD --- */
.article-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    margin-bottom: 40px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-img-wrapper {
    width: 100%;
    height: 300px;
    background: var(--accent-light);
    position: relative;
}

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

.card-meta-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    text-transform: uppercase;
}

.card-content {
    padding: 32px;
    position: relative;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 16px;
}

.article-headline {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: var(--text-primary);
    flex: 1;
}

.card-actions {
    display: flex;
    gap: 8px;
}

.mark-read-btn, .bookmark-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: all 0.2s;
}

.mark-read-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.mark-read-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--bg-card);
    transform: scale(1.1);
}

.bookmark-btn:hover {
    border-color: var(--saved-color);
    color: var(--saved-color);
}

.bookmark-btn.active {
    background: var(--saved-color);
    border-color: var(--saved-color);
    color: white;
}

/* Header Bookmark Button State */
.btn-icon.view-active {
    color: var(--saved-color);
    background: var(--accent-light);
}

.article-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.article-meta span::before {
    content: "•";
    margin-right: 8px;
    color: var(--text-tertiary);
}
.article-meta span:first-child::before { display: none; }

.article-body {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* Empty State */
.empty-saved {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}
.empty-icon {
    margin-bottom: 16px;
    color: var(--border-color);
}

/* --- UTILS --- */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover { background: var(--accent-light); }

/* Mobile Overlay */
.mobile-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5); z-index: 40;
    display: none;
    backdrop-filter: blur(2px);
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    aside {
        position: fixed;
        height: 100%;
        left: 0; top: 0;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }
    body.sidebar-open aside { transform: translateX(0); }
    body.sidebar-open .mobile-overlay { display: block; }

    .header-titles {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }
    .header-title-mobile { display: block; line-height: 2; }
    .header-tagline { font-size: 18px; line-height: 1.2; }


    .header-actions { display: flex; }
    /* .top-brand { display: none; }  */

    .scroll-container { padding: 16px; }
    .article-card { border-radius: 12px; margin-bottom: 24px; }
    .card-img-wrapper { height: 200px; }
    .card-content { padding: 20px; }
    .article-headline { font-size: 20px; }
    .article-body { font-size: 15px; }
}

@media (max-width: 480px) {
    .top-brand { display: none; }
}

/* ==========================================
   LANGUAGE SELECTOR & GOOGLE OVERRIDES
========================================== */

/* 1. Custom Language Dropdown */
.lang-dropdown-wrapper { position: relative; display: inline-block; }

.lang-dropdown-btn {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.lang-dropdown-btn:hover { background: var(--accent-light); }
.lang-dropdown-btn .chevron { transition: transform 0.3s ease; }
.lang-dropdown-wrapper.show-menu .chevron { transform: rotate(180deg); }

.lang-dropdown-list {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    width: 200px;
    max-height: 350px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    gap: 4px;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.lang-dropdown-wrapper.show-menu .lang-dropdown-list {
    display: flex;
    flex-direction: column;
}

.lang-dropdown-list .mode-btn {
    width: 100%;
    text-align: left;
    padding: 10px 16px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

.lang-dropdown-list .mode-btn:hover { background: var(--accent-light); color: var(--text-primary); }
.lang-dropdown-list .mode-btn.active { background: var(--accent-light); color: var(--brand-blue); font-weight: 600; }

.lang-dropdown-list::-webkit-scrollbar { width: 6px; }
.lang-dropdown-list::-webkit-scrollbar-track { background: transparent; }
.lang-dropdown-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }

/* 2. Sidebar Restore Language Button */
.restore-lang-btn {
    background: var(--accent-light);
    color: var(--brand-blue);
    border: 1px solid rgba(37, 99, 235, 0.2);
    margin: 0 24px 12px 24px;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.restore-lang-btn:hover {
    background: var(--brand-blue);
    color: white;
    border-color: var(--brand-blue);
}

.restore-lang-btn:hover svg { stroke: white; }

/* 3. AGGRESSIVELY NUKE GOOGLE TRANSLATE BANNER */
.skiptranslate > iframe.skiptranslate,
iframe.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

html, body {
    top: 0px !important;
    margin-top: 0px !important;
    position: static !important;
}

#goog-gt-tt, .goog-te-balloon-frame { display: none !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }

/* --- EXCEL-STYLE TAB BAR --- */
.tab-bar-wrapper {
    position: sticky;
    top: 60px; /* Below the 60px header */
    z-index: 9;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
}
.tab-bar-wrapper::before, .tab-bar-wrapper::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 40px;
    pointer-events: none; z-index: 10; opacity: 0; transition: opacity 0.3s ease;
}
.tab-bar-wrapper::before { left: 0; background: linear-gradient(to right, var(--bg-sidebar) 0%, transparent 100%); }
.tab-bar-wrapper::after { right: 0; background: linear-gradient(to left, var(--bg-sidebar) 0%, transparent 100%); }
.tab-bar-wrapper.can-scroll-left::before { opacity: 1; }
.tab-bar-wrapper.can-scroll-right::after { opacity: 1; }

.excel-tab-bar {
    display: flex; overflow-x: auto; scrollbar-width: none;
}
.excel-tab-bar::-webkit-scrollbar { display: none; }
.tab-link {
    padding: 14px 20px; white-space: nowrap; color: var(--text-secondary);
    font-size: 14px; font-weight: 600; border-bottom: 3px solid transparent;
    cursor: pointer; transition: all 0.2s ease; display: flex;
    align-items: center; gap: 6px; background: transparent; border-top: none;
    border-left: none; border-right: none; font-family: var(--font-main); text-decoration: none;
}
.tab-link:hover { background: var(--accent-light); color: var(--text-primary); }
.tab-link.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); background: rgba(37, 99, 235, 0.05); }

/* --- QUICK READS DROPDOWN --- */
.tab-dropdown { position: relative; display: inline-block; }
.tab-dropdown-menu {
    display: none; position: fixed; transform: translateX(-50%);
    background: var(--bg-card); min-width: 250px;
    box-shadow: var(--shadow-md, 0 10px 25px rgba(0,0,0,0.2));
    border: 1px solid var(--border-color); border-radius: 12px; z-index: 1000;
    flex-direction: column; overflow: hidden;
}
.tab-dropdown-menu.show { display: flex; animation: fadeIn 0.2s ease-in-out; }
.tab-dropdown-menu a { padding: 12px 16px; color: var(--text-secondary); font-size: 13px; font-weight: 500; border-bottom: 1px solid var(--border-color); transition: 0.2s; text-decoration: none; }
.tab-dropdown-menu a:hover { background: var(--accent-light); color: var(--brand-blue); }
.tab-dropdown-menu a:last-child { border-bottom: none; }
.dropdown-toggle.open svg { transform: rotate(180deg); }
.dropdown-toggle svg { transition: transform 0.3s ease; }

/* --- MODAL STYLES --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); z-index: 100;
    display: flex; justify-content: center; align-items: center;
    opacity: 0; pointer-events: none; transition: opacity 0.2s; backdrop-filter: blur(4px);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background: var(--bg-card); width: 90%; max-width: 500px;
    border-radius: 20px; display: flex; flex-direction: column;
    transform: translateY(20px); transition: transform 0.3s;
    border: 1px solid var(--border-color);
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 18px; margin: 0; color: var(--text-primary); font-family: var(--font-main); }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-secondary); line-height: 1; }
.modal-body { padding: 20px; font-size: 14px; line-height: 1.6; }
