
/* Global Reset & Layout Protection */
html {
    overflow-x: hidden; /* Prevent horizontal scrolling at root */
    width: 100%;
    -webkit-text-size-adjust: 100%;
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    overflow-x: hidden; /* Double protection */
    width: 100%;
    margin: 0;
    padding: 0;
    position: relative;
    min-height: 100vh;
}

/* --- TICKER / MARQUEE FIX (Specific Request) --- */
/* Ensure ticker content NEVER wraps to a new line */
#ticker-content, 
#ticker-content span, 
#ticker-content a,
.animate-marquee {
    white-space: nowrap !important;
    overflow: visible !important;
    display: inline-flex !important;
    align-items: center;
}

/* --- TYPOGRAPHY & CONTENT SAFETY --- */

/* 
   General Content: Force wrapping to stay inside screen 
   This fixes the "cut off content" issue on small mobile screens.
*/
article, .prose, main, .tab-content {
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: break-word !important; 
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Headers: Allow natural wrapping for long titles */
h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word !important;
    word-wrap: break-word !important;
    word-break: normal !important; /* Don't break mid-word unless necessary */
    line-height: 1.4 !important;
    white-space: normal !important;
}

/* Paragraphs & Spans: Standard wrapping */
p, li, blockquote {
    white-space: normal !important;
    overflow-wrap: break-word !important;
}

/* Navigation: Keep single line where needed */
nav a, nav span {
    white-space: nowrap !important;
}
nav span.truncate {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* --- MEDIA & EMBEDS SAFETY --- */

img, video, embed, object, canvas {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 0.75rem;
    display: block;
}

/* Iframe Safety: Crucial for Ads and YouTube */
iframe {
    max-width: 100% !important;
    width: 100% !important;
    border: none;
    display: block;
}

/* --- AD WIDGET ISOLATION --- */
.ad-widget-container {
    display: block;
    position: relative !important;
    width: 100%;
    max-width: 100%;
    overflow: hidden !important; 
    min-height: 250px;
    margin: 2rem 0;
    border-radius: 1rem;
    background-color: #f9fafb;
    border: 1px dashed #e5e7eb;
    isolation: isolate; 
    z-index: 1 !important; 
}

.dark .ad-widget-container {
    background-color: #111827;
    border-color: #374151;
}

.ad-widget-container::before {
    content: 'إعلان';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #9ca3af;
    font-size: 0.75rem;
    pointer-events: none;
    z-index: -1; 
}

.ad-widget-container div, 
.ad-widget-container iframe, 
.ad-widget-container ins {
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
}

/* --- COMPONENTS --- */

.video-container {
    position: relative;
    padding-bottom: 56.25%; 
    height: 0;
    overflow: hidden;
    border-radius: 1rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    background-color: #000;
    width: 100% !important;
    z-index: 2;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.btn-wrapped-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9) 0%, rgba(29, 78, 216, 0.9) 100%);
    color: white !important; 
    font-weight: 700;
    padding: 1rem;
    border-radius: 1rem;
    text-decoration: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal !important;
    text-align: center;
    line-height: 1.4;
    overflow-wrap: break-word;
}

.btn-wrapped-link span {
    white-space: normal !important;
}

.btn-wrapped-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.5);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* Animations */
@keyframes marquee { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.animate-marquee { animation: marquee 30s linear infinite; }
@keyframes fadeIn { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: translateY(0); } }
.animate-fade-in { animation: fadeIn 0.5s ease-out; }
