*,
*:before,
*:after {
    box-sizing: border-box;
}


body.no-scroll {
    overflow: hidden !important;
}

.secIn {
    width: 100%;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: row;
    margin: 0 auto;
    max-width: 1280px;
}

.mainIN {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    /* Prevent double borders if children have them, but user requested explicitly */
}

.contentM {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex: 1;
    position: relative;
    /* Container for sticky children */
}

.contentBody {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-width: 0;
    /* Important for flex children container nested content */
}

.secIn.full-width {
    max-width: 100%;
    width: 100%;
    border-left: none;
    border-right: none;
}


main {
    flex: 1;
    color: var(--text-primary);
    line-height: var(--line-height-extra-relaxed);
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    width: 100%;
}

main.has-right-sidebar {
    max-width: 613.6px;
}


main.main-no-sidebar {
    max-width: 100%;
}

.main-header {

    background-color: rgba(var(--bg-primary-rgb), 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    height: 53px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.headCn {
    width: 100%;
}

.headIn {
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
    max-width: 1280px;
    /* News sites usually use more horizontal space */
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.headL,
.headM,
.headR {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 8px;
}

.headL {
    flex: 1;
    margin-right: 20px;
}

.header-container-2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}



.second-header {
    background-color: rgba(var(--bg-primary-rgb), 0.85);
    border-bottom: 1px solid var(--border-color);
    padding: 0 15px;
    height: 50px;
    display: flex;

}

/* Add mobile-only class to show elements only on mobile */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* Hide second header on mobile when there's a search query */
@media (max-width: 1150px) {
    .second-header.mobile-hidden {
        display: none;
    }
}

/* New header structure */
.header-left,
.header-right {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 8px;
}

.header-left {
    flex: 0 0 auto;
    margin-right: 20px;
}

.header-right {
    flex: 0 0 auto;
    margin-left: 20px;
}

/* Search form styles */
.search-form-header {
    display: flex;
    align-items: center;
    background-color: var(--bg-hover);
    /* Slightly darker than secondary for contrast */
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0 6px 0 14px;
    height: 38px;
    margin: 0;
    width: 100%;
    max-width: 350px;
    transition: all 0.2s ease;
    position: relative;
}

.search-form-header:hover {
    background-color: var(--bg-secondary);
    border-color: var(--text-secondary);
}

.search-form-header:focus-within {
    background-color: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 1px var(--primary-color);
}

.search-icon-wrapper {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-actions-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 6px;
}

.clear-search-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.clear-search-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.clear-search-btn svg {
    width: 18px;
    height: 18px;
}

.search-shortcut {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 4px;
    width: 20px;
    height: 20px;
    font-size: var(--font-11);
    font-family: var(--font-mono, monospace);
    font-weight: var(--font-weight-semibold);
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.search-form-header:focus-within .search-shortcut {
    opacity: 0;
}

.search-input-header {
    border: none;
    background: transparent;
    outline: none;
    font-size: var(--font-14);
    color: var(--text-primary);
    width: 100%;
    margin-left: 10px;
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-extra-relaxed);
}

.search-input-header::placeholder {
    color: var(--text-secondary);
}

.search-button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-button svg {
    width: var(--font-20);
    height: var(--font-20);
}

.website-brand-mobile {
    display: none;
}

.website-brand-header {
    display: block;
}

.website-brand-header h2 {
    color: var(--text-primary);
    margin: 0;
    font-size: var(--font-22);
    font-weight: var(--font-weight-normal);
    font-family: var(--fontO);
    line-height: var(--line-height-normal);
}

.header-brand-container {
    display: flex;
    align-items: center;
    gap: 11px;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background-color: var(--bg-secondary);
}

.sidebar-toggle-btn svg {
    width: 26px;
    height: 26px;
}

@media (max-width: 1150px) {
    .desktop-only {
        display: none !important;
    }
}

.website-brand {
    display: none !important;
}

/* Profile image styles */
.profile-image-container {
    width: 39px;
    height: 39px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
    padding: 2px;
}

.profile-image-container.active {
    border-color: var(--text-primary);
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Small profile image styles for settings header */
.profile-image-container-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
    padding: 2px;
}

.profile-image-small {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Notification icon container */
.notification-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-link {
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.notification-link:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.notification-link svg {
    width: var(--font-22);
    height: var(--font-22);
}

/* ============================================
   Theme Toggle Styles
   ============================================ */

.theme-toggle {
    position: relative;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.theme-icons {
    position: relative;
    width: var(--font-22);
    height: var(--font-22);
}

.light-theme-icon,
.dark-theme-icon,
.dim-theme-icon {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--font-22);
    height: var(--font-22);
    display: none;
}

.light-theme-icon svg,
.dark-theme-icon svg,
.dim-theme-icon svg {
    width: var(--font-22);
    height: var(--font-22);
}

.theme-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    font-size: var(--font-11);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-normal);
    display: none;
    font-family: var(--fontB);
    line-height: var(--line-height-normal);
}

.theme-option-icon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.system-option {
    position: relative;
}

/* Login button styles */
.login-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 9999px;
    padding: 8px 16px;
    font-size: var(--font-14);
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    cursor: pointer;
}

.login-button:hover {
    background-color: var(--primary-hover);
}

.main-header::-webkit-scrollbar {
    display: none;
}

.main-header {
    scrollbar-width: none;
}

/* tab header */
.tab-header {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    background-color: rgba(var(--bg-primary-rgb), 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: 50px;
    position: sticky;
    top: 53px;
    z-index: 10;
}

.tab-header::-webkit-scrollbar {
    display: none;
}

.tab-header .nav-tabs {
    border-bottom: none;
    overflow-x: visible;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scrollbar-width: none;
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--fontH);
}

.bookmarks-tab-header .nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tabs .nav-item {
    background: transparent;
    padding-left: 16px;
    padding-right: 16px;
}

.tab-header .nav-link {
    color: var(--text-secondary);
    font-size: var(--font-16);
    /* Slightly smaller than base */
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    padding: 14px 0;
    border: none;
    border-radius: 0;
    white-space: nowrap;
    transition: color 0.2s;
    text-decoration: none;
    display: block;
    flex-shrink: 0;
    box-sizing: border-box;
    position: relative;
    font-family: var(--fontB);
}

.tab-header .nav-link:hover {
    color: var(--text-primary);
}

.tab-header .nav-link.active {
    color: var(--text-primary);
    font-weight: var(--font-weight-bold);
}

.tab-header .nav-link.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 99px;
    width: 60%;
    /* Concentrated indicator */
    min-width: 40px;
}

.header-page-content {
    display: flex;
    align-items: center;
    width: 100%;
    font-family: var(--fontH);
}

.back-page-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    color: var(--text-primary);
}

.back-page-button:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.back-page-button svg {
    width: var(--font-20);
    height: var(--font-20);
}

.page-header-title {
    font-size: var(--font-16);
    /* Scalable large heading */
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    margin: 0;
    color: var(--text-primary);
    font-family: var(--fontH);
}

.header-page-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.icon-button:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.icon-button svg {
    width: var(--font-20);
    height: var(--font-20);
}

/* Scrollable Topics Container */
.scrollable-topics-container {
    position: sticky;
    top: 53px;
    z-index: 99;
    background-color: rgba(var(--bg-primary-rgb), 0.85);
    backdrop-filter: blur(12px);
}

.scrollable-topics {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 10px 15px 10px 15px;
    scroll-behavior: smooth;
    scroll-padding: 20px;
}

.scrollable-topics::-webkit-scrollbar {
    display: none;
}

.topic-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--bg-secondary);
    color: var(--text-secondary);
    font-size: var(--font-15);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    border-radius: 20px;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.topic-item:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.topic-item.active {
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
}

.topic-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.topic-icon svg {
    width: 20px;
    height: 20px;
}

.topic-toggle {
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.topic-toggle svg {
    width: 20px;
    height: 20px;
}

.topics-view {
    display: flex;
    gap: 10px;
}

.search-scroll-topics,
.tab-header-second {
    top: 0;
}

/* Second Heading */
.second-header {
    background-color: rgba(var(--bg-primary-rgb), 0.85);
    backdrop-filter: blur(12px);
    height: 53px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0 15px;
    /* Removed padding-top: 12.8px to center vertically */
}

/* flash Feed Header */
.flash-feed-header {
    background-color: var(--bg-primary);
    height: 50px;
    display: none;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 99;
    padding-top: 12.8px;
}

.flash-feed-header .header-content {
    width: 100%;
    margin: 0 auto;
    display: flex;
}

.flash-feed-header .header-nav {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-left: 15px;
    padding-right: 15px;
    scroll-behavior: smooth;
    /* Add smooth scrolling behavior */
}

.flash-feed-header .header-nav::-webkit-scrollbar {
    display: none;
}

.flash-feed-header .nav-link {
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 12px;
    border: 1px solid var(--bg-secondary);
    color: var(--text-secondary);
    font-size: var(--font-15);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    border-radius: 20px;
    transition: all 0.2s ease;
    background: var(--bg-secondary);

}

.flash-feed-header .nav-link:hover {
    color: var(--text-primary);
}

.flash-feed-header .nav-link.active {
    color: var(--text-primary);
    border: 1px solid var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 1150px) {
    #right-sidebar {
        display: none;
    }

    .flash-feed-header {
        display: flex;
    }

    /* Hide second header on mobile when there's a search query */
    .second-header.mobile-hidden {
        display: none;
    }
}

@media (max-width: 768px) {
    .left-sidebar {
        display: none;
    }

    .main-content {
        border-left: none;
        max-width: 100%;
        margin: 0 auto;
    }

    .secIn {
        border-right: none;
        border-left: none;
        max-width: 100%;
        width: 100%;
    }
}

/* News Portal Elements */
.header-brand-container {
    display: none;
    align-items: center;
    gap: 11px;
}

.search-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon-wrapper::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 6px;
    height: 6px;
    background-color: #ff4b4b;
    border-radius: 50%;
    animation: pulse-red 2s infinite;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--bg-hover);
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 4px rgba(255, 75, 75, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0);
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .flash-feed-header {
        padding-top: 6.4px;
        padding-bottom: 6.4px;
        border-bottom: 1px solid var(--border-color);
    }

    .flash-feed-header .nav-link {
        font-size: var(--font-14);
    }

    .main-header {
        height: 50px;
        position: sticky;
        top: 0;
        z-index: 100;
        border-bottom: 1px solid var(--border-color);
    }

    .second-header {
        height: 50px;
    }

    .no-border {
        border: none !important;
    }

    .tab-header {
        height: 50px;
        top: 50px;
    }

    .back-page-button {
        margin-right: 12px;
    }

    /* Mobile header adjustments */
    .header-left,
    .header-right {
        height: 100%;
    }



    .headM {
        display: none;
    }

    .search-form-header {
        padding: 6px 12px;
        height: 36px;
    }

    .search-input-header {
        width: 150px;
        font-size: var(--font-12);
    }

    .login-button {
        padding: 6px 12px;
        font-size: var(--font-12);
    }

    /* Hide search bar and show website brand on mobile */
    .search-form-header {
        display: none;
    }

    .website-brand-header {
        display: block;
        margin-right: 15px;
    }

    .header-brand-container {
        display: flex;
    }

    /* Hide main header on all pages except homepage for mobile */
    .main-header.mobile-hidden {
        display: none;
    }

    .tab-header .nav-link {
        padding: 13px 0;
        font-size: var(--font-14);
    }

    .tab-header {
        padding: 0;
        /* top: 50px is already set above, ensuring it sticks below main-header */
    }

    .secIn,
    .contentM,
    .contentBody {
        flex-direction: column;
    }

    .mainIN {
        border-left: none;
        border-right: none;
    }

    main.has-right-sidebar {
        max-width: 100%;
    }

    /* Scrollable topics mobile styles */
    .scrollable-topics-container {
        top: 50px;
    }

    /* Scrollable topics mobile styles */
    .scrollable-topics {
        padding-top: 5.4px;
        padding-bottom: 5.4px;
        padding-left: 15px;
        padding-right: 15px;
        scroll-behavior: smooth;
        scroll-padding: 20px;
    }

    .topic-item {
        font-size: var(--font-14);
        padding: 6px 12px;
    }
}

/* Fallback utilities if not present */
.btn-text {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
    display: inline-flex;
    align-items: center;
    vertical-align: baseline;
}

.menu-item {
    cursor: pointer;
}