/**
 * Breaking News Widget Stylesheet
 *
 * @package NationalRajasthan
 */

:root {
    --nr-breaking-height: 52px;
    --nr-breaking-radius: 10px;
    --nr-breaking-bg: #ffffff;
    --nr-breaking-border: #ECECEC;
    --nr-breaking-label-bg: #C8102E;
    --nr-breaking-label-color: #ffffff;
    --nr-breaking-gap: 24px;
    --nr-breaking-speed: 30s;
}

/* Outer frame layout */
.nr-breaking {
    display: flex;
    align-items: center;
    border: 1px solid var(--nr-breaking-border);
    background-color: var(--nr-breaking-bg);
    border-radius: var(--nr-breaking-radius);
    height: var(--nr-breaking-height);
    overflow: hidden;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 15px 0;
}

/* Left side sticky red label */
.nr-breaking__label-wrapper {
    flex-shrink: 0;
    background-color: var(--nr-breaking-label-bg);
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
    position: relative;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.05);
}

.nr-breaking__label {
    color: var(--nr-breaking-label-color);
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    line-height: 1;
}

.nr-breaking__icon {
    margin-right: 6px;
    font-size: 14px;
}

/* Scrolling/Snap Track */
.nr-breaking-ticker__track {
    flex-grow: 1;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    position: relative;
    background-color: var(--nr-breaking-bg);
}

.nr-breaking-ticker__wrapper {
    display: flex;
    width: max-content;
    will-change: transform;
    animation: nrMarquee var(--nr-breaking-speed) linear infinite;
}

.nr-breaking-ticker__list {
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding-left: var(--nr-breaking-gap);
}

/* Keyframes for seamless loops */
@keyframes nrMarquee {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0); /* Shift exactly by half of the wrapper's width */
    }
}

/* Pause on Hover */
.nr-breaking:hover .nr-breaking-ticker__wrapper {
    animation-play-state: paused;
}

/* Individual Ticker Items */
.nr-breaking-item {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nr-breaking-item__link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #333333;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nr-breaking-item__link:hover {
    color: var(--nr-breaking-label-bg);
}

.nr-breaking-item__time {
    font-size: 11px;
    font-weight: 600;
    background-color: #f5f5f5;
    color: #666666;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 10px;
    text-transform: uppercase;
}

.nr-breaking-item__separator {
    color: var(--nr-breaking-label-bg);
    margin: 0 var(--nr-breaking-gap);
    font-size: 8px;
    opacity: 0.6;
}

/* Highlighting custom alerts */
.nr-breaking-item--highlight .nr-breaking-item__title {
    color: var(--nr-breaking-label-bg);
    font-weight: 700;
}

/* Right Badge Capsule */
.nr-breaking__badge-wrapper {
    flex-shrink: 0;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 10;
    background-color: var(--nr-breaking-bg);
    box-shadow: -6px 0 10px rgba(0, 0, 0, 0.02);
}

.nr-breaking__badge {
    font-size: 10px;
    font-weight: 700;
    background-color: #222222;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.nr-breaking__badge--breaking {
    background-color: var(--nr-breaking-label-bg);
}

.nr-breaking__badge--live {
    background-color: #28a745; /* Green live dot color */
    animation: nrLiveIndicator 1.5s infinite alternate;
}

.nr-breaking__badge--flash {
    background-color: #ffc107;
    color: #222222;
}

.nr-breaking__badge--top-story {
    background-color: #007bff;
}

@keyframes nrLiveIndicator {
    0% {
        opacity: 0.8;
    }
    100% {
        opacity: 1;
        box-shadow: 0 0 6px rgba(40, 167, 69, 0.6);
    }
}

/* Mobile Scroll Snap layout rules */
@media (max-width: 768px) {
    .nr-breaking {
        height: auto;
        min-height: 52px;
    }

    .nr-breaking__label-wrapper {
        padding: 0 12px;
    }

    .nr-breaking__badge-wrapper {
        display: none; /* Hide secondary badges on mobile to conserve viewport space */
    }

    .nr-breaking-ticker__list--clone {
        display: none !important;
    }

    .nr-breaking-ticker__track {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nr-breaking-ticker__track::-webkit-scrollbar {
        display: none;
    }

    .nr-breaking-ticker__wrapper {
        animation: none !important;
        display: flex;
        width: 100%;
    }

    .nr-breaking-ticker__list {
        animation: none !important;
        padding-left: 0;
        width: 100%;
    }

    .nr-breaking-item {
        scroll-snap-align: start;
        flex: 0 0 100%;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 15px;
        white-space: normal;
        text-align: center;
    }

    .nr-breaking-item__separator {
        display: none !important;
    }
}
