/**
 * Smart Breaking News Bar - Modern Professional Frontend Styles
 * Enhanced for RTL Arabic Support
 */

/* ===== CSS VARIABLES ===== */
:root {
    --sbnb-bg-color: #dc2626;
    --sbnb-label-bg: rgba(0, 0, 0, 0.25);
    --sbnb-label-color: #ffffff;
    --sbnb-text-color: #ffffff;
    --sbnb-bar-height: 48px;
    --sbnb-font-size: 15px;
    --sbnb-font-weight: 500;
    --sbnb-scroll-duration: 35s;
    --sbnb-separator-color: rgba(255, 255, 255, 0.6);
    --sbnb-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    --sbnb-hover-opacity: 0.9;
}

/* ===== MAIN BREAKING NEWS BAR ===== */
.sbnb-breaking-news-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999999;
    background: var(--sbnb-bg-color);
    min-height: var(--sbnb-bar-height);
    box-shadow: var(--sbnb-shadow);
    font-family: inherit;
    direction: rtl;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== CONTAINER ===== */
.sbnb-container {
    display: flex;
    align-items: stretch;
    height: 100%;
    max-width: 100vw;
    position: relative;
}

/* ===== LABEL STYLING ===== */
.sbnb-label {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    background: var(--sbnb-label-bg);
    color: var(--sbnb-label-color);
    padding: 0 25px;
    font-weight: 700;
    font-size: calc(var(--sbnb-font-size) * 0.92);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
    position: relative;
    z-index: 10;
}

.sbnb-label::after {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 10px solid var(--sbnb-label-bg);
}

/* ===== TICKER WRAPPER ===== */
.sbnb-ticker-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 5%,
        black 95%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 5%,
        black 95%,
        transparent 100%
    );
}

/* ===== TICKER CONTENT ===== */
.sbnb-ticker-content {
    display: flex;
    align-items: center;
    white-space: nowrap;
    will-change: transform;
    padding: 8px 0;
}

/* ===== RTL MARQUEE ANIMATION ===== */
.sbnb-breaking-news-bar.sbnb-animation-scroll .sbnb-ticker-content {
    animation: sbnb-scroll-rtl var(--sbnb-scroll-duration) linear infinite;
}

@keyframes sbnb-scroll-rtl {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(50%);
    }
}

/* ===== PAUSE ON HOVER ===== */
.sbnb-breaking-news-bar.sbnb-paused .sbnb-ticker-content,
.sbnb-breaking-news-bar:hover .sbnb-ticker-content {
    animation-play-state: paused;
}

/* ===== NEWS ITEM ===== */
.sbnb-news-item {
    display: inline-flex;
    align-items: center;
    padding: 0 35px;
    color: var(--sbnb-text-color);
    font-size: var(--sbnb-font-size);
    font-weight: var(--sbnb-font-weight);
    line-height: 1.5;
    flex-shrink: 0;
}

/* ===== NEWS LINK ===== */
.sbnb-news-link {
    color: var(--sbnb-text-color);
    text-decoration: none;
    transition: opacity 0.25s ease;
    display: inline;
}

.sbnb-news-link:hover,
.sbnb-news-link:focus,
.sbnb-news-link:active,
.sbnb-news-link:visited {
    color: var(--sbnb-text-color);
    text-decoration: none;
    opacity: var(--sbnb-hover-opacity);
    outline: none;
}

/* ===== NEWS TITLE ===== */
.sbnb-news-title {
    display: inline;
    white-space: nowrap;
    line-height: 1.4;
}

/* ===== SEPARATOR ===== */
.sbnb-separator {
    display: inline-flex;
    align-items: center;
    margin-left: 20px;
    opacity: 0.7;
    flex-shrink: 0;
}

.sbnb-separator img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
    filter: brightness(0) invert(1);
    border-radius: 2px;
}

.sbnb-separator svg,
.sbnb-separator i {
    color: var(--sbnb-separator-color);
    font-size: 14px;
}

/* Alternative separator style */
.sbnb-separator::before {
    content: '•';
    color: var(--sbnb-separator-color);
    font-size: 18px;
    line-height: 1;
}

/* ===== FADE ANIMATION MODE ===== */
.sbnb-breaking-news-bar.sbnb-animation-fade {
    overflow: visible;
}

.sbnb-breaking-news-bar.sbnb-animation-fade .sbnb-ticker-wrapper {
    mask-image: none;
    -webkit-mask-image: none;
}

.sbnb-breaking-news-bar.sbnb-animation-fade .sbnb-ticker-content {
    animation: none;
    width: 100%;
    justify-content: center;
}

.sbnb-breaking-news-bar.sbnb-animation-fade .sbnb-news-item {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: all 0.6s ease;
    padding: 0 50px;
}

.sbnb-breaking-news-bar.sbnb-animation-fade .sbnb-news-item.active {
    opacity: 1;
}

/* ===== CLOSE BUTTON ===== */
.sbnb-close-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--sbnb-text-color);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 100;
}

.sbnb-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* ===== MOBILE RESPONSIVE ===== */
@media screen and (max-width: 768px) {
    .sbnb-breaking-news-bar.sbnb-hide-mobile {
        display: none !important;
    }
    
    .sbnb-breaking-news-bar {
        min-height: calc(var(--sbnb-bar-height) * 0.85);
    }
    
    .sbnb-label {
        padding: 0 15px;
        font-size: calc(var(--sbnb-font-size) * 0.75);
        letter-spacing: 0.3px;
    }
    
    .sbnb-label::after {
        border-right-width: 6px;
        border-top-width: 6px;
        border-bottom-width: 6px;
        left: -6px;
    }
    
    .sbnb-news-item {
        padding: 0 20px;
        font-size: calc(var(--sbnb-font-size) * 0.88);
    }
    
    .sbnb-separator {
        margin-left: 12px;
    }
    
    .sbnb-separator img {
        width: 14px;
        height: 14px;
    }
    
    .sbnb-ticker-wrapper {
        mask-image: linear-gradient(
            to right,
            transparent 0%,
            black 8%,
            black 92%,
            transparent 100%
        );
        -webkit-mask-image: linear-gradient(
            to right,
            transparent 0%,
            black 8%,
            black 92%,
            transparent 100%
        );
    }
    
    .sbnb-close-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .sbnb-news-item {
        padding: 0 15px;
        font-size: calc(var(--sbnb-font-size) * 0.82);
    }
    
    .sbnb-label {
        padding: 0 12px;
        font-size: calc(var(--sbnb-font-size) * 0.7);
    }
}

/* ===== ADMIN BAR OFFSET ===== */
body.admin-bar .sbnb-breaking-news-bar {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .sbnb-breaking-news-bar {
        top: 46px;
    }
}

/* ===== BODY PADDING FOR STICKY BAR ===== */
body.sbnb-active {
    padding-top: var(--sbnb-bar-height);
}

@media screen and (max-width: 768px) {
    body.sbnb-active {
        padding-top: calc(var(--sbnb-bar-height) * 0.85);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .sbnb-breaking-news-bar {
        display: none !important;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .sbnb-breaking-news-bar.sbnb-animation-scroll .sbnb-ticker-content {
        animation: none;
    }
    
    .sbnb-breaking-news-bar.sbnb-animation-fade .sbnb-news-item {
        transition: opacity 0.1s ease;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .sbnb-breaking-news-bar {
        border-bottom: 2px solid currentColor;
    }
    
    .sbnb-label {
        border-left: 2px solid currentColor;
    }
}

/* ===== DATE BADGE (OPTIONAL) ===== */
.sbnb-date-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    margin-left: 10px;
    font-weight: 400;
}
