/**
 * News Category Tabs Component - Performance Optimized Layout
 * UI/UX Pro Max Edition: Balanced Typography, Fixed Mobile Title & Scrollable Tabs
 */

.news-category-tabs-wrapper {
    margin-bottom: 1.25rem;
    position: relative;
}

/* Header: Title on Left, Tabs on Right - Balanced Vertical Alignment */
.news-tabs-header {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    /* Perfectly balanced vertical centering */
    margin-bottom: 20px;
    padding-bottom: 10px;
    gap: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

/* Fixed Title on the Left */
.news-tabs-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    /* Ensures Title never gets squeezed */
}

.news-tabs-title-bar {
    display: inline-block;
    width: 4px;
    height: 20px;
    background-color: var(--news-tabs-accent, var(--fs-color-primary, #446084));
    border-radius: 2px;
    flex-shrink: 0;
}

.news-tabs-title {
    margin: 0 !important;
    font-size: 1.3rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    line-height: 1.15 !important;
    letter-spacing: 0.4px !important;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.news-tabs-title a {
    color: var(--news-tabs-accent, var(--fs-color-primary, #446084)) !important;
    text-decoration: none !important;
    transition: opacity 0.2s ease !important;
}

.news-tabs-title a:hover {
    opacity: 0.85 !important;
}

/* Tab Navigation Wrap */
.news-tabs-nav-wrap {
    flex: 1 1 auto;
    min-width: 0;
    /* Crucial for horizontal scroll on flex child */
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.news-tabs-nav {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    line-height: 1 !important;
}

.news-tab-item {
    display: inline-flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0;
}

.news-tab-btn {
    background: none !important;
    border: none !important;
    padding: 6px 8px !important;
    margin: 0 !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    text-transform: inherit !important;
    color: #666 !important;
    cursor: pointer !important;
    transition: color 0.2s ease, font-weight 0.2s ease !important;
    outline: none !important;
    box-shadow: none !important;
    white-space: nowrap !important;
    border-radius: 3px !important;
}

.news-tab-btn:hover {
    color: var(--news-tabs-active-color, var(--fs-color-primary, #446084)) !important;
}

.news-tab-btn.active {
    color: var(--news-tabs-active-color, var(--fs-color-primary, #446084)) !important;
    font-weight: 700 !important;
    cursor: default !important;
}

.news-tab-separator {
    color: #ccc !important;
    margin: 0px !important;
    font-weight: 300 !important;
    user-select: none !important;
    flex-shrink: 0 !important;
    font-size: 12px !important;
}

/* Mobile Dropdown Wrap - Hidden on Desktop */
.news-tabs-mobile-wrap {
    display: none !important;
}

/* Body & Panels */
.news-tabs-body {
    position: relative;
    min-height: 220px;
}

.news-tab-panel {
    display: none;
}

.news-tab-panel.active {
    display: block;
    animation: newsTabFadeIn 0.25s ease;
}

@keyframes newsTabFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading State (AJAX spinner) */
.news-tabs-body.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.news-tabs-body.is-loading::after {
    content: "";
    position: absolute;
    top: 40%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--news-tabs-accent, var(--fs-color-primary, #446084));
    border-radius: 50%;
    animation: newsTabSpin 0.65s infinite linear;
    z-index: 10;
}

@keyframes newsTabSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Category Label Badge */
.news-post-cat-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--news-tabs-accent, var(--fs-color-primary, #446084));
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

/* Left Column: Big Featured Post */
.news-big-post {
    display: flex;
    flex-direction: column;
}

.news-big-post-thumb {
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 14px;
    background-color: #f7f7f7;
}

.news-big-post-thumb .image-cover {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.news-big-post-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    transition: transform 0.4s ease !important;
}

.news-big-post:hover .news-big-post-thumb img {
    transform: scale(1.04) !important;
}

.news-big-post-title {
    margin: 0 0 8px 0 !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

.news-big-post-title a {
    color: #1e1e1e !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.news-big-post-title a:hover {
    color: var(--news-tabs-accent, var(--fs-color-primary, #446084)) !important;
}

.news-big-post-meta {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.news-big-post-excerpt {
    font-size: 14px;
    color: #555;
    line-height: 1.55;
    margin-top: 6px;
}

/* Right Column: List Posts */
.news-list-posts {
    display: flex;
    flex-direction: column;
}

.news-list-item {
    padding-bottom: var(--news-list-item-spacing, 14px);
    margin-bottom: var(--news-list-item-spacing, 14px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.news-list-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.news-list-item-thumb {
    flex: 0 0 var(--news-list-thumb-w, 115px);
    width: var(--news-list-thumb-w, 115px);
    height: var(--news-list-thumb-h, 75px);
    overflow: hidden;
    border-radius: var(--news-list-thumb-r, 4px);
    flex-shrink: 0;
}

.news-list-item-thumb a {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
}

.news-list-item-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: inherit !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

.news-list-item:hover .news-list-item-thumb img {
    transform: scale(1.05) !important;
}

.news-list-item-thumb .no-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: #f2f2f2;
    border-radius: inherit;
    display: block;
    border: 1px dashed #ddd;
}

.news-list-item-content {
    flex: 1;
    min-width: 0;
}

.news-list-item-title {
    margin: 0 0 6px 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

.news-list-item-title a {
    color: #222 !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
}

.news-list-item-title a:hover {
    color: var(--news-tabs-accent, var(--fs-color-primary, #446084)) !important;
}

.news-list-item-meta {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.news-list-item-excerpt {
    font-size: 13px;
    color: #666;
    line-height: 1.45;
    margin: 0;
}

/* UX Builder Editor Placeholder */
.news-category-tabs-placeholder {
    padding: 30px 20px;
    border: 2px dashed #ccc;
    border-radius: 6px;
    text-align: center;
    color: #666;
    background-color: #fafafa;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 768px) {

    /* Header: Title on Left, Dropdown Toggle on Right */
    .news-tabs-header {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        position: relative !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
        padding-bottom: 8px !important;
    }

    /* Fixed Left Title */
    .news-tabs-title-wrap {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        gap: 8px !important;
    }

    .news-tabs-title-bar {
        width: 3.5px !important;
        height: 18px !important;
    }

    .news-tabs-title {
        font-size: 1.05rem !important;
        letter-spacing: 0.2px !important;
        line-height: 1.25 !important;
        white-space: normal !important;
    }

    /* Hide desktop horizontal tabs on mobile */
    .news-tabs-nav-wrap {
        display: none !important;
    }

    /* Show mobile dropdown toggle wrap */
    .news-tabs-mobile-wrap {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        position: relative !important;
        flex-shrink: 0 !important;
    }

    .news-tabs-mobile-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
        border-radius: 6px !important;
        color: var(--news-tabs-accent, var(--fs-color-primary, #446084)) !important;
        cursor: pointer !important;
        outline: none !important;
        box-shadow: none !important;
        -webkit-tap-highlight-color: transparent !important;
        transition: background-color 0.2s ease !important;
    }

    .news-tabs-mobile-toggle:hover,
    .news-tabs-mobile-toggle:active {
        background-color: rgba(0, 0, 0, 0.05) !important;
    }

    .news-tabs-chevron {
        width: 20px !important;
        height: 20px !important;
        display: block !important;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
        transform-origin: center center !important;
    }

    /* Open state: Chevron rotates 180 degrees (points upwards) */
    .news-tabs-mobile-wrap.is-open .news-tabs-chevron {
        transform: rotate(180deg) !important;
    }

    /* Floating Dropdown Card */
    .news-tabs-mobile-dropdown {
        display: none;
        position: absolute !important;
        top: calc(100% + 6px) !important;
        right: 0 !important;
        min-width: 200px !important;
        max-width: 280px !important;
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        border-radius: 8px !important;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
        padding: 6px 0 !important;
        margin: 0 !important;
        z-index: 100 !important;
        list-style: none !important;
        overflow: hidden !important;
    }

    .news-tabs-mobile-wrap.is-open .news-tabs-mobile-dropdown {
        display: block !important;
        animation: newsDropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    @keyframes newsDropdownFadeIn {
        from {
            opacity: 0;
            transform: translateY(-6px) scale(0.98);
        }

        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    /* Mobile Dropdown Items */
    .news-tabs-mobile-item {
        display: block !important;
        width: 100% !important;
        padding: 10px 18px !important;
        font-family: inherit !important;
        font-size: 13.5px !important;
        line-height: 1.4 !important;
        text-align: left !important;
        text-transform: none !important;
        color: #334155 !important;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        cursor: pointer !important;
        white-space: nowrap !important;
        text-overflow: ellipsis !important;
        overflow: hidden !important;
        transition: background-color 0.15s ease, color 0.15s ease !important;
        outline: none !important;
        box-shadow: none !important;
        min-height: 40px !important;
    }

    .news-tabs-mobile-item:hover,
    .news-tabs-mobile-item:focus {
        background-color: #f8fafc !important;
        color: #0f172a !important;
    }

    .news-tabs-mobile-item.active {
        background-color: #f1f5f9 !important;
        color: var(--news-tabs-active-color, var(--fs-color-primary, #446084)) !important;
        font-weight: 700 !important;
    }

    .news-big-post {
        margin-bottom: 24px;
    }

    .news-list-item-thumb {
        flex: 0 0 95px;
        width: 95px;
    }

    .news-list-item-thumb img,
    .news-list-item-thumb .no-thumb-placeholder {
        height: 65px !important;
    }
}

/* Extra Small Screens (<= 480px) */
@media (max-width: 480px) {
    .news-tabs-header {
        gap: 8px !important;
    }

    .news-tabs-title-wrap {
        gap: 6px !important;
    }

    .news-tabs-title-bar {
        width: 3px !important;
        height: 16px !important;
    }

    .news-tabs-title {
        font-size: 0.95rem !important;
    }

    .news-tabs-mobile-dropdown {
        min-width: 190px !important;
    }
}