/* ============================================
   Financial News Flash Page - news.css
   Primary: #DC0000 | Dark: #1a1a1a
   Reuses: cal-hero, cal-nav, cal-articles, cta-section from calendar-new.css
   ============================================ */

/* ---- News page overrides for shared calendar styles ---- */

.news-main~.cal-articles+.cta-section,
.news-main~.cta-section {
    display: none;
}

.cal-articles{
    background: #FFFFFF;
    padding: 105px 0 87px;
}

.cal-article-card{
    background: #F7F9FD;
}

.cal-hero {
    display: flex;
    justify-content: center;
    align-items: center;
}

.cal-hero-btn {
    background: #b17374;
}

/* ---- Section 3: News Main ---- */

.news-main {
    background: #f3f4f8;
    padding: 81px 0 80px;
}

.news-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* === Left: Timeline === */

.news-timeline-wrap {
    flex: 1;
    min-width: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.news-timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 33px 32px 31px 32px;
    border-bottom: 1px solid #EEEEEE;
}

.news-timeline-title {
    font-size: 20px;
    font-weight: 700;
    color: #383838;
    margin: 0;
    flex-shrink: 0;
}

.news-timeline-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.news-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 17.81px;
    color: #666666;
    background: #FFF5F5;
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid #FFDDDD;
}

.news-date-icon {
    font-size: 19px;
    color: #DD0000;
    width: 19px;
    height: 19px;
    line-height: 1;
}

.news-only-important {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15.84px;
    color: #666666;
    cursor: pointer;
    user-select: none;
}

.news-only-important input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid #666666;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.news-only-important input[type="checkbox"]:checked {
    background: #DC0000;
    border-color: #DC0000;
}

.news-only-important input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: translate(-50%, -60%) rotate(45deg);
}

/* Timeline Items */
.news-timeline {
    padding: 0 32px 32px;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.news-timeline::-webkit-scrollbar {
    display: none;
}

.news-loading {
    text-align: center;
    padding: 60px 0;
    color: #999;
    font-size: 16px;
}

.news-item {
    position: relative;
    margin-left: 30px;
    padding-left: 20px;
    background-image: repeating-linear-gradient(to bottom,
            rgba(36, 40, 42, 0.2) 0,
            rgba(36, 40, 42, 0.2) 4px,
            transparent 4px,
            transparent 8px);
    background-size: 1px 100%;
    background-repeat: no-repeat;
    background-position: left top;
}

.news-item:first-child {
    background-position: left 36px;
    background-size: 1px calc(100% - 36px);
}

.news-item:last-child {
    background-size: 1px 36px;
}

.news-item:only-child {
    background: none;
}

.news-item::after {
    z-index: 1;
    content: '';
    position: absolute;
    left: -10px;
    top: 28px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(36, 40, 42, 0.2);
    box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 12px #24282A;
}

.news-item-time {
    width: 150px;
    padding: 25px 0 0;
    margin-bottom: 0;
    font-family: HarmonyOS_Sans;
    font-size: 14px;
    color: #24282A !important;
}

.news-item-title {
    font-size: 15px;
    color: #1E202B !important;
    line-height: 1.5;
    text-decoration: none;
    display: block;
    margin-bottom: 4px;
    padding: 16px 20px 0px 0;
}

.news-item-content {
    font-size: 15px;
    color: #666;
    line-height: 2;
    text-decoration: none;
    margin-bottom: 4px;
    padding: 16px 20px 16px 0;
}

.news-item-toggle {
    font-size: 13px;
    color: #999;
    cursor: pointer;
    margin-left: 4px;
}

.news-item-toggle:hover {
    color: #DC0000;
}

/* Important news item */
.news-item.important .news-item-title {
    color: #E32519 !important;
    font-weight: 600;
}

.news-item.important .news-item-content {
    color: #E32519;
}

.news-item.important::after {
    box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 12px #E32519;
}

/* Infinite Scroll Loading */
.news-scroll-loading {
    text-align: center;
    padding: 24px 0;
    color: #999;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.news-scroll-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #eee;
    border-top-color: #DC0000;
    border-radius: 50%;
    animation: news-spin 0.6s linear infinite;
}

@keyframes news-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Retry Button */
.news-retry-btn {
    text-align: center;
    padding: 20px 0;
    color: #999;
    font-size: 14px;
    cursor: pointer;
}

.news-retry-btn span {
    color: #DC0000;
    margin-left: 6px;
}

.news-retry-btn:hover span {
    text-decoration: underline;
}

/* End Indicator */
.news-end {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px 0;
}

.news-end-line {
    flex: 1;
    height: 1px;
    background: #EEEEEE;
}

.news-end-text {
    font-size: 13px;
    color: #CCCCCC;
    white-space: nowrap;
}

/* === Right: Sidebar === */

.news-sidebar {
    width: 450px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Sidebar: Academy Featured */
.news-sidebar-academy {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
}

.news-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 30px;
    margin-bottom: 27px;
    position: relative;
}

.news-sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: #EEEEEE;
}

.news-sidebar-header h4 {
    font-size: 20px;
    font-weight: bold;
    color: #383838;
    margin: 0;
}

.news-view-more {
    font-size: 13px;
    color: #999;
    text-decoration: none;
    transition: color 0.2s;
}

.news-view-more:hover {
    color: #DC0000;
}

.news-academy-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.news-academy-item {
    display: block;
    text-decoration: none;
    padding-bottom: 20px;
    background: #F8F9FA;
    transition: all 0.2s;
    padding: 15px 30px 19px 19px;
    border-radius: 6px;
}

.news-academy-item:hover h5 {
    color: #DC0000;
}

.news-academy-badge {
    display: inline-block;
    padding: 8px 11px;
    border-radius: 6px;
    font-size: 16px;
    color: #fff;
    margin-bottom: 23px;
}

.news-academy-item:nth-child(4n+1) .news-academy-badge {
    background: #667EEA;
}

.news-academy-item:nth-child(4n+2) .news-academy-badge {
    background: #52C41A;
}

.news-academy-item:nth-child(4n+3) .news-academy-badge {
    background: #FA8C16;
}

.news-academy-item:nth-child(4n+4) .news-academy-badge {
    background: #722ED1;
}

.news-academy-item h5 {
    font-size: 18px;
    font-weight: bold;
    color: #222222;
    margin-bottom: 18px;
    line-height: 1;
    transition: color 0.2s;
}

.news-academy-item p {
    font-size: 16px;
    color: #666666;
    line-height: 1.6;
    margin-bottom: 21px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-academy-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: #CCCCCC;
}

.news-academy-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Sidebar: Hot Tags */
.news-sidebar-tags {
    background: #fff;
    border-radius: 12px;
    padding: 34px 54px 34px 35px;
}

.news-sidebar-tags h4 {
    font-size: 20px;
    font-weight: bold;
    color: #383838;
    padding-bottom: 30px;
    margin-bottom: 27px;
    position: relative;
}

.news-sidebar-tags h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: #EEEEEE;
}

.news-tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 12px;
}

.news-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 16px;
    color: #666666;
    background: #FFFFFF;
    border: 1px solid #E5E5E5;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.news-tag:hover {
    color: #DC0000;
    border-color: #DC0000;
    background: #FFF5F5;
}

.news-tag.hot {
    color: #FF8400;
    border-color: #FFDDDD;
    background: #FFF2E8;
}

/* Sidebar: Demo CTA */
.news-sidebar-demo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    background: #fff;
    border-radius: 12px;
}

.news-demo-text {
    flex: 1;
    min-width: 0;
}

.news-demo-text h4 {
    font-size: 20px;
    font-weight: 700;
    color: #383838;
    margin-bottom: 8px;
}

.news-demo-text p {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
}

.news-demo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
    background: #DC0000;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.news-demo-btn:hover {
    background: #B30000;
    color: #fff;
}

.news-demo-icon {
    flex-shrink: 0;
    margin-left: 12px;
}

.news-demo-icon img {
    width: 120px;
    height: auto;
    display: block;
}

/* ============================================
   Responsive: max-width 1080px (Tablet + Mobile)
   ============================================ */

@media (max-width: 1080px) {

    /* Override shared calendar styles for mobile */
    .cal-articles {
        padding: 50px 0 40px;
    }

    /* News Main */
    .news-main {
        padding: 24px 0 32px;
    }

    .news-layout {
        flex-direction: column;
        gap: 20px;
    }

    /* Timeline: auto height on mobile (JS sync disabled) */
    .news-timeline-wrap {
        height: auto !important;
        max-height: none;
    }

    .news-sidebar {
        width: 100%;
    }

    /* Header: stack title and controls vertically */
    .news-timeline-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 20px 16px 16px;
    }

    .news-timeline-title {
        font-size: 18px;
    }

    .news-timeline-controls {
        gap: 16px;
        width: 100%;
    }

    .news-date-badge {
        font-size: 14px;
        padding: 5px 10px;
    }

    .news-date-icon {
        width: 16px;
        height: 16px;
    }

    .news-only-important {
        font-size: 13px;
    }

    /* Timeline items */
    .news-timeline {
        padding: 0 16px 24px;
        max-height: 70vh;
    }

    .news-item {
        margin-left: 24px;
        padding-left: 16px;
    }

    .news-item::after {
        left: -8px;
        top: 24px;
        width: 14px;
        height: 14px;
    }

    .news-item:first-child {
        background-position: left 31px;
        background-size: 1px calc(100% - 31px);
    }

    .news-item:last-child {
        background-size: 1px 31px;
    }

    .news-item-time {
        width: auto;
        padding: 18px 0 0;
        font-size: 13px;
    }

    .news-item-title {
        font-size: 14px;
        padding: 10px 10px 30px 0;
    }

    .news-item-content {
        font-size: 14px;
        padding: 10px 10px 30px 0;
    }

    .news-item-toggle {
        font-size: 12px;
    }

    /* End indicator */
    .news-end {
        padding: 20px 0;
        gap: 12px;
    }

    /* Sidebar: Academy */
    .news-sidebar-academy {
        padding: 20px 16px;
    }

    .news-sidebar-header {
        padding-bottom: 16px;
        margin-bottom: 16px;
    }

    .news-sidebar-header h4 {
        font-size: 18px;
    }

    .news-academy-list {
        gap: 16px;
    }

    .news-academy-item {
        padding: 14px 16px;
    }

    .news-academy-badge {
        font-size: 14px;
        padding: 6px 10px;
        margin-bottom: 16px;
    }

    .news-academy-item h5 {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .news-academy-item p {
        font-size: 14px;
        margin-bottom: 14px;
    }

    .news-academy-meta {
        font-size: 13px;
    }

    /* Sidebar: Tags */
    .news-sidebar-tags {
        padding: 20px 16px;
    }

    .news-sidebar-tags h4 {
        font-size: 18px;
        padding-bottom: 16px;
        margin-bottom: 16px;
    }

    .news-tags-grid {
        gap: 10px;
    }

    .news-tag {
        padding: 7px 16px;
        font-size: 14px;
    }

    /* Sidebar: Demo CTA */
    .news-sidebar-demo {
        padding: 20px 16px;
    }

    .news-demo-text h4 {
        font-size: 18px;
    }

    .news-demo-icon img {
        width: 100px;
    }
}

/* ============================================
   Responsive: max-width 480px (Small Phone)
   ============================================ */

@media (max-width: 480px) {

    .cal-articles {
        padding: 36px 0 30px;
    }

    .news-main {
        padding: 16px 0 24px;
    }

    .news-layout {
        gap: 16px;
    }

    /* Header */
    .news-timeline-header {
        padding: 16px 12px 12px;
        gap: 10px;
    }

    .news-timeline-title {
        font-size: 16px;
    }

    .news-timeline-controls {
        gap: 12px;
    }

    .news-date-badge {
        font-size: 12px;
        padding: 4px 8px;
    }

    .news-date-icon {
        width: 14px;
        height: 14px;
    }

    .news-only-important {
        font-size: 12px;
        gap: 6px;
    }

    .news-only-important input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }

    /* Timeline items */
    .news-timeline {
        padding: 0 12px 16px;
        max-height: 60vh;
    }

    .news-item {
        margin-left: 20px;
        padding-left: 14px;
    }

    .news-item::after {
        left: -7px;
        top: 20px;
        width: 12px;
        height: 12px;
        box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 10px #24282A;
    }

    .news-item.important::after {
        box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 10px #E32519;
    }

    .news-item:first-child {
        background-position: left 26px;
        background-size: 1px calc(100% - 26px);
    }

    .news-item:last-child {
        background-size: 1px 26px;
    }

    .news-item-time {
        padding: 14px 0 0;
        font-size: 12px;
    }

    .news-item-title {
        font-size: 13px;
        padding: 8px 6px 24px 0;
    }

    .news-item-content {
        font-size: 13px;
        padding: 8px 6px 24px 0;
    }

    .news-item-toggle {
        font-size: 11px;
    }

    /* End indicator */
    .news-end {
        padding: 16px 0;
        gap: 10px;
    }

    .news-end-text {
        font-size: 12px;
    }

    /* Sidebar: Academy */
    .news-sidebar-academy {
        padding: 16px 12px;
    }

    .news-sidebar-header {
        padding-bottom: 14px;
        margin-bottom: 14px;
    }

    .news-sidebar-header h4 {
        font-size: 16px;
    }

    .news-view-more {
        font-size: 12px;
    }

    .news-academy-list {
        gap: 12px;
    }

    .news-academy-item {
        padding: 12px;
    }

    .news-academy-badge {
        font-size: 12px;
        padding: 5px 8px;
        margin-bottom: 12px;
    }

    .news-academy-item h5 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .news-academy-item p {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .news-academy-meta {
        font-size: 12px;
    }

    .news-academy-meta svg {
        width: 14px;
        height: 8px;
    }

    /* Sidebar: Tags */
    .news-sidebar-tags {
        padding: 16px 12px;
    }

    .news-sidebar-tags h4 {
        font-size: 16px;
        padding-bottom: 14px;
        margin-bottom: 14px;
    }

    .news-tags-grid {
        gap: 8px;
    }

    .news-tag {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 16px;
    }

    /* Sidebar: Demo CTA */
    .news-sidebar-demo {
        padding: 16px 12px;
    }

    .news-demo-text h4 {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .news-demo-text p {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .news-demo-btn {
        padding: 7px 20px;
        font-size: 13px;
    }

    .news-demo-icon img {
        width: 80px;
    }

    /* Loading spinner */
    .news-scroll-loading {
        padding: 16px 0;
        font-size: 12px;
    }

    .news-scroll-loading::before {
        width: 14px;
        height: 14px;
    }
}