/* Explain: General page styling, dark mode, rich text formatting, and marquee animation. - */
* {
    box-sizing: border-box;
}

html {
    background: var(--background-color);
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

[x-cloak] {
    display: none !important;
}

/* Breaking News Marquee */
.ticker-wrap {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    display: flex;
    align-items: center;
}

.ticker-content {
    display: inline-block;
    white-space: nowrap;
    animation: ticker 120s linear infinite;
    padding-inline-start: 100%;
}

.ticker-wrap:hover .ticker-content {
    animation-play-state: paused;
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(100%); /* Right to left for RTL */
    }
}

/* Rich Text Content Formatting */
#custom-editor:empty:before {
    content: attr(placeholder);
    color: #9ca3af;
    pointer-events: none;
    display: block; /* For Firefox */
}
.prose {
    color: var(--text-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}
.prose * {
    font-family: var(--font-body) !important;
    max-width: 100%;
}
.prose p {
    margin-bottom: 1.25em;
    line-height: 1.8;
    font-size: 1.125rem;
    color: inherit;
}

/* معالجة النصوص القديمة المنسوخة بألوان ثابتة لتصبح مقروءة في الوضع الليلي */
html.dark .prose [style*="color"] {
    color: var(--text-color) !important;
}
html.dark .prose [style*="background-color: rgb(255, 255, 255)"],
html.dark .prose [style*="background-color: #ffffff"],
html.dark .prose [style*="background-color: #fff"],
html.dark .prose [style*="background-color: white"] {
    background-color: transparent !important;
}
.prose h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}
.prose img {
    border-radius: 0.5rem;
    margin-bottom: 1.5em;
    width: 100%;
    height: auto;
}
.prose a {
    color: var(--secondary-color);
    text-decoration: underline;
    font-weight: bold;
}
.prose a:hover {
    color: var(--primary-color);
}
.prose figcaption:empty,
.image-caption-placeholder:empty {
    display: none !important;
    border: none !important;
    padding: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
}
.image-caption-placeholder {
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    margin-top: 8px;
}

/* Live TV Pulse Animation */
@keyframes pulse-live {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; color: var(--accent-color); transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}
.blink-icon {
    animation: pulse-live 1.5s infinite;
}

/* Universal Smart Embed Override (Fix for X/Twitter/Facebook iframes) */
.smart-embed iframe, 
.smart-embed twitter-widget, 
.smart-embed blockquote,
.aspect-video iframe,
.aspect-video twitter-widget,
.aspect-video blockquote {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border: none !important;
    margin: auto !important;
}