/*
Theme Name: Ultra News - تصميم إخباري
Description: قالب فرعي بتصميم إخباري حديث متوافق مع الموبايل (شريط أقسام، عاجل، خبر رئيسي، آخر الأخبار، صفحة مقال، وضع ليلي)
Template: ultranews
Version: 1.2.0
Text Domain: ultranews-news
*/

:root { --af-red: #b91c1c; --af-red-dark: #961616; --af-bg: #fafafa; --af-card: #fff; --af-text: #18181b; --af-muted: #71717a; --af-line: #e4e4e7; --af-soft: #f4f4f5; --af-radius: 16px; }
html.af-dark { --af-bg: #0f0f11; --af-card: #19191c; --af-text: #ececee; --af-muted: #a1a1aa; --af-line: #2c2c31; --af-soft: #232327; }

body.af-body { margin: 0; background: var(--af-bg); color: var(--af-text); font-family: var(--site-font); font-size: 16px; line-height: 1.6; overflow-x: clip; }
.af-body #site { overflow: visible; }
.af-body #site a:not(.btn) { color: inherit; text-decoration: none; word-break: normal; }
.af-body #site a:hover { color: var(--af-red); }
.af-body h1, .af-body h2, .af-body h3 { font-weight: 700; margin: 0; }
.af-wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }
.af-body #site-main { min-height: 60vh; overflow: visible; padding-bottom: 32px; }

/* ===== الهيدر ===== */
.af-head { background: var(--af-card); }
.af-head .af-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.af-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.af-mark { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 14px; background: var(--af-red); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; }
.af-body #site .af-brand:hover { color: inherit; }
.af-brand-name { display: block; font-size: 24px; font-weight: 700; line-height: 1.3; }
.af-brand-desc { display: block; font-size: 13px; color: var(--af-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-brand img.af-logo { max-height: 56px; width: auto; }
.af-actions { display: flex; gap: 4px; flex-shrink: 0; }
.af-body .af-actions a, .af-body .af-actions button { width: 42px; height: 42px; border: 0; background: transparent; color: var(--af-text); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; margin: 0; padding: 0; }
.af-actions a:hover, .af-actions button:hover { background: var(--af-soft); }

/* ===== شريط الأقسام ===== */
.af-nav { position: sticky; top: var(--wp-admin--admin-bar--height, 0px); z-index: 95; background: var(--af-red); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.af-nav .af-wrap { padding: 0; }
.af-nav ul { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.af-nav ul::-webkit-scrollbar { display: none; }
.af-nav li { flex: 0 0 auto; }
.af-body #site .af-nav a { display: block; position: relative; padding: 14px 20px; color: #fff; font-weight: 600; white-space: nowrap; }
.af-body #site .af-nav a:hover, .af-body #site .af-nav .current-menu-item > a, .af-body #site .af-nav .current-post-ancestor > a, .af-body #site .af-nav .current-category-ancestor > a { background: var(--af-red-dark); color: #fff; }
.af-nav .current-menu-item > a::after { content: ""; position: absolute; bottom: 0; right: 20px; left: 20px; height: 4px; background: #fff; border-radius: 4px 4px 0 0; }
.af-nav .sub-menu { display: none; }

/* ===== شريط عاجل ===== */
.af-ticker { background: var(--af-card); border-bottom: 1px solid var(--af-line); }
.af-ticker .af-wrap { display: flex; align-items: center; gap: 12px; padding-top: 9px; padding-bottom: 9px; }
.af-ticker-label { flex-shrink: 0; display: flex; align-items: center; gap: 8px; background: #18181b; color: #fff; border-radius: 30px; padding: 3px 14px; font-size: 14px; font-weight: 600; }
.af-ticker-label::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--af-red); animation: af-blink 1.2s infinite; }
@keyframes af-blink { 50% { opacity: .35; } }
.af-ticker-view { flex: 1; overflow: hidden; white-space: nowrap; direction: ltr; }
.af-ticker-track { display: inline-flex; animation: af-marquee var(--af-speed, 40s) linear infinite; }
.af-ticker-view:hover .af-ticker-track { animation-play-state: paused; }
.af-ticker-group { display: flex; flex-direction: row-reverse; }
.af-ticker-group a { direction: rtl; padding: 0 28px; font-size: 15px; font-weight: 500; }
@keyframes af-marquee { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .af-ticker-track, .af-ticker-label::before { animation: none; } .af-ticker-view { overflow-x: auto; } }

/* ===== الرئيسية ===== */
.af-grid-top { display: grid; gap: 24px; margin-top: 28px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .af-grid-top { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; } }
.af-hero { position: relative; display: block; border-radius: var(--af-radius); overflow: hidden; background: #27272a; aspect-ratio: 16 / 10; }
.af-hero img { position: absolute; inset: 0; width: 100%; height: 100% !important; object-fit: cover; }
.af-hero-body { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 10px; padding: 20px; background: linear-gradient(to top, rgba(0,0,0,.9) 0%, rgba(0,0,0,.45) 55%, rgba(0,0,0,.05) 100%); color: #fff; }
.af-hero-title { font-size: clamp(21px, 4.6vw, 34px); font-weight: 700; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.af-hero .af-meta { color: #e4e4e7; }
.af-badge { display: inline-block; background: var(--cat, #15803d); color: #fff; border-radius: 30px; padding: 1px 14px; font-size: 13px; font-weight: 600; }
.af-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--af-muted); font-size: 13px; }
.af-meta > span + span::before { content: "•"; margin-inline-end: 10px; }

.af-box { background: var(--af-card); border: 1px solid var(--af-line); border-radius: var(--af-radius); padding: 18px; }
.af-box-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.af-box-head h2 { display: flex; align-items: center; gap: 10px; font-size: 21px; }
.af-dot { width: 12px; height: 12px; border-radius: 50%; background: #dc2626; box-shadow: 0 0 0 5px rgba(220,38,38,.12); }
.af-body #site .af-more { color: var(--af-muted); font-size: 14px; }
.af-timeline { list-style: none; margin: 0; padding: 0; }
.af-timeline li { position: relative; padding-inline-start: 18px; margin-bottom: 18px; border-inline-start: 2px solid var(--af-line); margin-inline-start: 5px; }
.af-timeline li:last-child { margin-bottom: 0; }
.af-timeline li::before { content: ""; position: absolute; top: 2px; right: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--af-red); }
.af-timeline .af-time { display: block; color: var(--af-red); font-size: 13px; font-weight: 700; }
.af-timeline a { display: block; font-weight: 600; line-height: 1.7; }

.af-section { margin-top: 36px; }
.af-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.af-title h1, .af-title h2 { font-size: 22px; border-inline-start: 5px solid var(--cat, var(--af-red)); padding-inline-start: 10px; line-height: 1.3; }
.af-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.af-card { display: flex; flex-direction: column; background: var(--af-card); border: 1px solid var(--af-line); border-radius: var(--af-radius); overflow: hidden; }
.af-card-img { display: block; aspect-ratio: 16 / 10; background: var(--af-soft); }
.af-card-img img { width: 100%; height: 100% !important; object-fit: cover; }
.af-card-body { display: flex; flex-direction: column; gap: 8px; padding: 18px; flex: 1; }
.af-body #site a.af-cat { color: var(--cat, #15803d); font-size: 14px; font-weight: 700; align-self: flex-start; }
.af-card h3 { font-size: 18px; line-height: 1.6; flex: 1; }

.af-most { list-style: none; margin: 0; padding: 0; counter-reset: af; }
.af-most li { counter-increment: af; display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--af-line); }
.af-most li:first-child { border-top: 0; padding-top: 0; }
.af-most li::before { content: counter(af); font-size: 28px; font-weight: 700; color: var(--af-red); line-height: 1.2; min-width: 24px; }
.af-most h3 { font-size: 16px; line-height: 1.6; margin-bottom: 4px; }

.af-pagination { margin-top: 28px; }
.af-pagination .nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.af-pagination .page-numbers { min-width: 42px; padding: 8px 12px; text-align: center; background: var(--af-card); border: 1px solid var(--af-line); border-radius: 10px; }
.af-body #site .af-pagination .page-numbers.current { background: var(--af-red); border-color: var(--af-red); color: #fff; }
.af-pagination .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== صفحة المقال ===== */
.af-body #site .af-single { margin-top: 22px; }
.af-crumbs { display: flex; flex-wrap: wrap; gap: 8px; color: var(--af-muted); font-size: 14px; margin-bottom: 16px; }
.af-crumbs a::after { content: "‹"; margin-inline-start: 8px; }
/* الحاويات الأصلية للقالب (محتفظين بها علشان إعلانات وسط المقال) */
.af-single .primary-content, .af-body.design-normal .af-single .primary-content { background: transparent; }
.af-single .primary-content > .container { max-width: none; padding: 0 !important; margin: 0; }
.af-single .primary-content-inner { display: block; }
.af-single .primary-content-inner-3 > *, .af-single .entry-content > * { max-width: 100%; }
.af-single h1 { font-size: clamp(25px, 4.5vw, 36px) !important; line-height: 1.6; margin-bottom: 16px; }
.af-lead { color: var(--af-muted); font-size: 19px; line-height: 2; margin: 0 0 20px; }
.af-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; border-top: 1px solid var(--af-line); border-bottom: 1px solid var(--af-line); padding: 14px 0; margin-bottom: 24px; color: var(--af-muted); font-size: 14px; }
.af-byline strong { color: var(--af-text); font-size: 15px; }
.af-single .entry-image { margin: 0 0 24px; }
.af-single .entry-image-inner { border-radius: var(--af-radius); margin: 0; }
.af-single .entry-caption { background: var(--af-soft); color: var(--af-muted); }
.af-single .entry-content { font-size: 18px; line-height: 2.1; }
.af-single .entry-content > * { margin-bottom: 22px; }
.af-body #site .af-single .entry-content a:not(.btn) { color: var(--af-red); text-decoration: underline; text-decoration-color: rgba(185,28,28,.35); text-underline-offset: 7px; }
.af-body #site .af-single .entry-content h2:not(.unstyled), .af-body #site .af-single .entry-content h3:not(.unstyled), .af-body #site .af-single .entry-content h4:not(.unstyled) { margin: 32px 0 18px; padding: 12px 18px; background: rgba(185,28,28,.06); border: 1px solid rgba(185,28,28,.18); border-inline-start: 4px solid var(--af-red); border-radius: 12px; font-size: 22px; line-height: 1.6; }
.af-body #site .af-single .entry-content h3:not(.unstyled) { font-size: 20px; }
.af-body #site .af-single .entry-content h4:not(.unstyled) { font-size: 18px; }
html.af-dark .af-body #site .af-single .entry-content h2:not(.unstyled), html.af-dark .af-body #site .af-single .entry-content h3:not(.unstyled), html.af-dark .af-body #site .af-single .entry-content h4:not(.unstyled) { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.25); border-inline-start-color: #f87171; }
.af-single .entry-content blockquote { background: var(--af-soft); border-inline-start: 4px solid var(--af-red); border-radius: var(--af-radius); padding: 18px 20px; }
.af-readalso { background: var(--af-soft); border-inline-start: 4px solid var(--af-red); border-radius: 14px; padding: 14px 18px; line-height: 1.9; }
.af-readalso strong { margin-inline-end: 6px; }
.af-body #site .af-single .entry-content .af-readalso a { text-decoration: none; }
.af-pages { display: flex; gap: 8px; margin: 16px 0; }
.af-tags { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 0 20px; border-bottom: 1px solid var(--af-line); }
.af-tags a { background: var(--af-soft); border-radius: 30px; padding: 7px 16px; font-size: 14px; font-weight: 500; }

.af-below { display: flex; flex-direction: column; gap: 32px; margin-top: 16px; }
.af-credit { margin-top: 8px; direction: ltr; }
.af-body .comments { background: transparent !important; }
.af-body .comments .container { padding: 0 16px; max-width: 1200px; }
.af-body .comments .glob-container { background: var(--af-card); color: var(--af-text); border-radius: var(--af-radius); }
.af-body.af-body .comments-list .comment-body { background: var(--af-soft); border-color: var(--af-line); }

/* ===== الفوتر ===== */
.af-foot { background: #18181b; color: #d4d4d8; padding: 36px 0 20px; }
.af-body #site .af-foot a:hover { color: #fff; }
.af-foot-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.af-foot-about { grid-column: 1 / -1; }
@media (min-width: 768px) { .af-foot-about { grid-column: auto; } }
.af-foot h2 { color: #fff; font-size: 18px; margin-bottom: 12px; }
.af-foot p { margin: 0; color: #a1a1aa; }
.af-foot ul { list-style: none; margin: 0; padding: 0; }
.af-foot li { margin-bottom: 8px; }
.af-foot .sub-menu { display: none; }
.af-foot .social-links { justify-content: flex-start; }
.af-foot-copy { border-top: 1px solid #3f3f46; margin-top: 24px; padding-top: 16px; text-align: center; font-size: 13px; color: #a1a1aa; }
.af-body .theme-copyrights { background: #18181b; color: #a1a1aa; }
.af-body #search-overlay { border-bottom: 3px solid var(--af-red); background: var(--af-card); color: var(--af-text); }
.af-body #scroll-top { background: var(--af-card); color: var(--af-text); }
.af-body img { max-width: 100%; }

/* وضوح الأحمر في الوضع الليلي */
html.af-dark .af-body #site .af-single .entry-content a:not(.btn), html.af-dark .af-body #site .af-timeline .af-time, html.af-dark .af-body #site a:hover { color: #f87171; }
html.af-dark .af-timeline .af-time { color: #f87171; }
html.af-dark .af-body #site .af-nav a:hover { color: #fff; }

/* المقال بعرض الصفحة كله (القالب الأب بيحصره في 800px) */
.af-body #site .af-single .primary-content-inner-3 > *:not(.ad), .af-body #site .af-single .primary-content-inner-4 > *:not(.ad), .af-body #site .comments-inner-2 { max-width: 100% !important; }
.af-body #site .af-single .primary-content-inner-4 > p, .af-body #site .af-single .primary-content-inner-4 > div:not(.ad) { margin-left: 0; margin-right: 0; }
.af-body .comments .container { max-width: 1200px; }
.af-body .btn-primary { --bs-btn-bg: var(--af-red); --bs-btn-border-color: var(--af-red); --bs-btn-hover-bg: var(--af-red-dark); --bs-btn-active-bg: var(--af-red-dark); }

/* ===== بوكس المشاركة وبوكس الكاتب ===== */
.af-panel { background: var(--af-card); border: 1px solid var(--af-line); border-radius: 18px; box-shadow: 0 4px 18px rgba(0,0,0,.05); margin: 22px 0; }
.af-share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 18px; }
.af-share-title { color: var(--af-red); font-weight: 700; font-size: 17px; margin-inline-end: 6px; }
.af-body #site .af-share a, .af-share button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 30px; padding: 7px 18px; color: #fff; font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1.5; cursor: pointer; }
.af-body #site .af-share a:hover { color: #fff; filter: brightness(1.1); }
.af-body #site .af-share a.af-s-whatsapp { background: #25d366; }
.af-body #site .af-share a.af-s-twitter-x { background: #111827; }
.af-body #site .af-share a.af-s-facebook { background: #1877f2; }
.af-body #site .af-share a.af-s-telegram { background: #229ed9; }
.af-share button { background: var(--af-card); color: var(--af-red); border-color: var(--af-line); }

.af-author { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 26px 22px; border-top: 4px solid var(--af-red); }
.af-avatar { flex-shrink: 0; width: 78px; height: 78px; border-radius: 50%; border: 3px solid var(--af-red); overflow: hidden; }
.af-avatar img { width: 100%; height: 100% !important; object-fit: cover; }
.af-author-info { flex: 1 1 220px; min-width: 0; }
.af-author-label { display: block; color: var(--af-red); font-size: 13px; font-weight: 700; }
.af-author h2, .af-author h1 { font-size: 22px !important; margin: 2px 0 6px; }
.af-body #site .af-author h2 a { color: var(--af-red); }
.af-author p { color: var(--af-muted); margin: 0; font-size: 15px; line-height: 1.9; }
.af-body #site a.af-author-all { background: var(--af-red); color: #fff; border-radius: 30px; padding: 9px 22px; font-weight: 700; font-size: 14px; }
.af-body #site a.af-author-all:hover { background: var(--af-red-dark); color: #fff; }
@media (max-width: 575px) { .af-author { flex-direction: column; text-align: center; } .af-author-info { flex-basis: auto; } }

/* ===== صفحة الكاتب ===== */
.af-author-count { display: inline-flex; flex-direction: column; align-items: center; background: var(--af-soft); border-radius: 14px; padding: 8px 22px; color: var(--af-muted); font-size: 13px; }
.af-author-count strong { color: var(--af-red); font-size: 24px; line-height: 1.3; }
.af-body #site .af-author-links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--af-red); font-size: 14px; font-weight: 700; }
.af-list { display: flex; flex-direction: column; gap: 14px; }
.af-row { display: flex; gap: 16px; background: var(--af-card); border: 1px solid var(--af-line); border-radius: var(--af-radius); padding: 12px; }
.af-row-img { flex: 0 0 220px; aspect-ratio: 16 / 10; align-self: center; border-radius: 12px; overflow: hidden; background: var(--af-soft); }
.af-row-img img { width: 100%; height: 100% !important; object-fit: cover; }
.af-row-body { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.af-row h3 { font-size: 19px; line-height: 1.6; }
@media (max-width: 575px) { .af-row { gap: 12px; padding: 10px; } .af-row-img { flex-basis: 110px; } .af-row h3 { font-size: 15px; } }
