/*
Theme Name: Kora Live
Theme URI: https://example.com/
Description: قالب رياضي عربي خفيف وسريع (وضع فاتح + داكن مع زر تبديل) لمواقع البث المباشر والمقالات — متوافق مع إضافات AlbaSport / Alba Live Matches. مبني للأداء 100% في PageSpeed مع دعم كامل للعربية (RTL) وقوائم ومناطق ودجت.
Author: مخصص لأحمد
Version: 1.1.0
Requires at least: 5.5
Tested up to: 6.6
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: kora-live
Tags: rtl-language-support, custom-menu, featured-images, threaded-comments, translation-ready, blog, news
*/

/* ============================================================
   1) المتغيّرات — يدعم الوضع الفاتح والداكن
   القاعدة: :root = فاتح (افتراضي). مع تفضيل النظام الداكن أو
   اختيار المستخدم [data-theme="dark"] → نبدّل للألوان الداكنة.
   والعكس [data-theme="light"] يفرض الفاتح حتى لو النظام داكن.
   ============================================================ */
:root{
	/* لوحة فاتحة (افتراضية) */
	--bg:#f4f6f9;
	--bg-2:#ffffff;
	--surface:#ffffff;
	--surface-2:#eef1f6;
	--border:#e4e8ee;
	--border-2:#d3d9e3;
	--text:#18202e;
	--muted:#586173;
	--muted-2:#8a93a3;
	--header-bg:rgba(255,255,255,.85);
	--shadow:0 8px 30px rgba(20,30,50,.10);
	--shadow-sm:0 2px 10px rgba(20,30,50,.07);

	/* مشتركة بين الوضعين */
	--accent:#ed1b24;
	--accent-2:#ff4d55;
	--accent-ink:#ffffff;
	--ok:#22c55e;
	--live:#ef4444;
	--radius:14px;
	--radius-sm:10px;
	--wrap:1200px;
	--gap:22px;
	--font:"Segoe UI",Tahoma,"Helvetica Neue",Arial,"Noto Sans Arabic",sans-serif;
	--head:"Segoe UI",Tahoma,Arial,sans-serif;
}

/* لوحة داكنة (مشتركة عبر mixin يدوي) */
@media (prefers-color-scheme: dark){
	:root:not([data-theme="light"]){
		--bg:#0e1015;
		--bg-2:#141821;
		--surface:#171c27;
		--surface-2:#1d2331;
		--border:#262d3b;
		--border-2:#323a4c;
		--text:#eaedf2;
		--muted:#98a2b3;
		--muted-2:#6b7486;
		--header-bg:rgba(14,16,21,.86);
		--shadow:0 8px 30px rgba(0,0,0,.35);
		--shadow-sm:0 2px 10px rgba(0,0,0,.25);
	}
}
:root[data-theme="dark"]{
	--bg:#0e1015;
	--bg-2:#141821;
	--surface:#171c27;
	--surface-2:#1d2331;
	--border:#262d3b;
	--border-2:#323a4c;
	--text:#eaedf2;
	--muted:#98a2b3;
	--muted-2:#6b7486;
	--header-bg:rgba(14,16,21,.86);
	--shadow:0 8px 30px rgba(0,0,0,.35);
	--shadow-sm:0 2px 10px rgba(0,0,0,.25);
}
html{background:var(--bg)}

/* ============================================================
   2) تصفير + أساسيات
   ============================================================ */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{
	margin:0;background:var(--bg);color:var(--text);
	font-family:var(--font);font-size:16px;line-height:1.75;
	-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;
	overflow-x:hidden;
}
img,svg,video{max-width:100%;height:auto;display:block}
a{color:inherit;text-decoration:none;transition:color .18s ease}
a:hover{color:var(--accent-2)}
h1,h2,h3,h4{font-family:var(--head);line-height:1.3;margin:0 0 .6em;font-weight:800}
p{margin:0 0 1em}
ul,ol{margin:0 0 1em;padding-inline-start:1.4em}
button,input,select,textarea{font:inherit;color:inherit}
:focus-visible{outline:2px solid var(--accent-2);outline-offset:2px}
.screen-reader-text{position:absolute!important;width:1px;height:1px;overflow:hidden;clip:rect(1px,1px,1px,1px);white-space:nowrap}
.skip-link{position:absolute;right:-9999px;top:0;z-index:1000;background:var(--accent);color:#fff;padding:10px 16px;border-radius:0 0 8px 0}
.skip-link:focus{right:0}

/* ============================================================
   3) التخطيط العام
   ============================================================ */
.wrap{max-width:var(--wrap);margin-inline:auto;padding-inline:16px}
.site-main{padding-block:26px}
.layout{display:grid;grid-template-columns:1fr 320px;gap:var(--gap);align-items:start}
.layout.no-sidebar{grid-template-columns:1fr}
@media(max-width:980px){.layout{grid-template-columns:1fr}}

.section{margin-bottom:34px}
.section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.section-title{position:relative;font-size:1.35rem;margin:0;padding-inline-start:14px}
.section-title::before{content:"";position:absolute;inset-inline-start:0;top:.15em;bottom:.15em;width:5px;border-radius:6px;background:linear-gradient(var(--accent),var(--accent-2))}
.section-more{font-size:.9rem;color:var(--muted);white-space:nowrap}
.section-more:hover{color:var(--accent-2)}

/* ============================================================
   4) الهيدر + القائمة
   ============================================================ */
.site-header{position:sticky;top:0;z-index:100;background:var(--header-bg);backdrop-filter:saturate(140%) blur(10px);border-bottom:1px solid var(--border)}
.header-inner{display:flex;align-items:center;gap:18px;min-height:64px}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:1.25rem;flex-shrink:0}
.brand img{max-height:40px;width:auto}
.brand .dot{color:var(--accent)}
.main-nav{margin-inline-start:auto}
.main-nav ul{list-style:none;display:flex;gap:4px;margin:0;padding:0}
.main-nav a{display:block;padding:10px 14px;border-radius:10px;font-weight:600;color:var(--text);font-size:.98rem}
.main-nav a:hover,.main-nav .current-menu-item>a{background:var(--surface-2);color:var(--accent-2)}
.main-nav .sub-menu{position:absolute;min-width:200px;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:8px;box-shadow:var(--shadow);display:none;flex-direction:column;gap:2px;z-index:120}
.main-nav li{position:relative}
.main-nav li:hover>.sub-menu{display:flex}
.nav-toggle,.search-toggle{display:none;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;width:44px;height:44px;cursor:pointer;align-items:center;justify-content:center}
.nav-toggle svg,.search-toggle svg{width:22px;height:22px;stroke:var(--text);fill:none;stroke-width:2}
.header-actions{display:flex;align-items:center;gap:8px}

/* زر تبديل الوضع (فاتح/داكن) */
.theme-toggle{background:var(--surface-2);border:1px solid var(--border);border-radius:10px;width:44px;height:44px;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.theme-toggle svg{width:20px;height:20px;stroke:var(--text);fill:none;stroke-width:2}
.theme-toggle .icon-moon{display:none}
.theme-toggle .icon-sun{display:block}
/* في الوضع الداكن نعرض القمر */
:root[data-theme="dark"] .theme-toggle .icon-sun{display:none}
:root[data-theme="dark"] .theme-toggle .icon-moon{display:block}
@media (prefers-color-scheme: dark){
	:root:not([data-theme="light"]) .theme-toggle .icon-sun{display:none}
	:root:not([data-theme="light"]) .theme-toggle .icon-moon{display:block}
}
.theme-toggle:hover{border-color:var(--border-2)}

/* بحث الهيدر */
.header-search{display:flex;align-items:center;gap:6px;background:var(--surface-2);border:1px solid var(--border);border-radius:10px;padding:4px 6px}
.header-search input{background:transparent;border:0;padding:6px 8px;width:170px;outline:none}
.header-search button{background:transparent;border:0;cursor:pointer;padding:4px;display:flex}
.header-search svg{width:18px;height:18px;stroke:var(--muted);fill:none;stroke-width:2}

@media(max-width:900px){
	.nav-toggle{display:flex}
	.header-search{display:none}
	.main-nav{position:fixed;inset:64px 0 auto 0;background:var(--bg-2);border-bottom:1px solid var(--border);margin:0;transform:translateY(-120%);transition:transform .25s ease;max-height:80vh;overflow:auto}
	.main-nav.open{transform:translateY(0)}
	.main-nav ul{flex-direction:column;gap:0;padding:10px}
	.main-nav a{padding:14px}
	.main-nav .sub-menu{position:static;display:flex;box-shadow:none;border:0;background:transparent;padding-inline-start:14px}
}

/* ============================================================
   5) البطاقات / شبكة المقالات
   ============================================================ */
.posts-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:var(--gap)}
@media(max-width:640px){.posts-grid{grid-template-columns:1fr}}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;transition:transform .2s ease,border-color .2s ease,box-shadow .2s ease;height:100%;display:flex;flex-direction:column}
.card:hover{transform:translateY(-4px);border-color:var(--border-2);box-shadow:var(--shadow)}
.card-thumb{position:relative;aspect-ratio:16/9;background:var(--surface-2);overflow:hidden}
.card-thumb img{width:100%;height:100%;object-fit:cover;transition:transform .35s ease}
.card:hover .card-thumb img{transform:scale(1.05)}
.card-cat{position:absolute;inset-inline-start:10px;top:10px;background:var(--accent);color:var(--accent-ink);font-size:.72rem;font-weight:700;padding:4px 10px;border-radius:20px}
.card-body{padding:14px 16px 16px;display:flex;flex-direction:column;flex:1}
.card-title{font-size:1.08rem;margin:0 0 8px;line-height:1.45}
.card-title a:hover{color:var(--accent-2)}
.card-excerpt{color:var(--muted);font-size:.92rem;margin:0 0 12px;flex:1}
.card-meta{display:flex;align-items:center;gap:12px;color:var(--muted-2);font-size:.82rem;margin-top:auto}
.card-meta .m{display:inline-flex;align-items:center;gap:5px}
.card-meta svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:1.8;opacity:.8}

/* قائمة مصغّرة (الشريط الجانبي) */
.mini-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:12px}
.mini-item{display:flex;gap:10px;align-items:center}
.mini-thumb{flex-shrink:0;width:74px;height:56px;border-radius:8px;overflow:hidden;background:var(--surface-2)}
.mini-thumb img{width:100%;height:100%;object-fit:cover}
.mini-title{font-size:.9rem;font-weight:600;line-height:1.4;margin:0}
.mini-meta{color:var(--muted-2);font-size:.76rem;margin-top:3px}

/* ============================================================
   6) الشريط الجانبي + الودجت
   ============================================================ */
.widget-area .widget,.widget{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 18px;margin-bottom:20px}
.widget-title{font-size:1.05rem;margin:0 0 14px;padding-bottom:10px;border-bottom:1px solid var(--border);position:relative}
.widget-title::after{content:"";position:absolute;bottom:-1px;inset-inline-start:0;width:46px;height:2px;background:var(--accent)}
.widget ul{list-style:none;margin:0;padding:0}
.widget ul li{padding:8px 0;border-bottom:1px solid var(--border);display:flex;gap:8px;align-items:center}
.widget ul li:last-child{border-bottom:0}
.widget ul li a{color:var(--text)}
.widget ul li a:hover{color:var(--accent-2)}
.widget a{word-wrap:break-word}
.below-table-widgets{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:var(--gap)}
.below-table-widgets .widget{margin-bottom:0}

/* ============================================================
   7) صفحة المقال المفردة
   ============================================================ */
.single-hero{position:relative;border-radius:var(--radius);overflow:hidden;margin-bottom:22px;background:var(--surface-2)}
.single-hero img{width:100%;max-height:440px;object-fit:cover}
.single-hero::after{content:"";position:absolute;inset:0;background:linear-gradient(to top,rgba(8,10,14,.9) 5%,rgba(8,10,14,.15) 55%)}
.single-hero .hero-cap{position:absolute;inset-inline:22px;bottom:20px;z-index:2}
.single-cat{display:inline-block;background:var(--accent);color:var(--accent-ink);font-size:.78rem;font-weight:700;padding:5px 14px;border-radius:20px;margin-bottom:12px}
.single-title{font-size:clamp(1.5rem,3.5vw,2.3rem);margin:0;text-shadow:0 2px 16px rgba(0,0,0,.6)}
.single-title.no-hero{color:var(--text);text-shadow:none;margin-bottom:14px}
.single-meta{display:flex;flex-wrap:wrap;align-items:center;gap:16px;color:var(--muted);font-size:.9rem;margin:0 0 20px;padding-bottom:16px;border-bottom:1px solid var(--border)}
.single-meta .m{display:inline-flex;align-items:center;gap:6px}
.single-meta svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.8;opacity:.85}
.single-meta .author-name{color:var(--text);font-weight:600}

.entry-content{font-size:1.06rem;line-height:1.95}
.entry-content>*{margin-bottom:1.15em}
.entry-content h2{font-size:1.5rem;margin:1.6em 0 .6em;padding-inline-start:14px;position:relative}
.entry-content h2::before{content:"";position:absolute;inset-inline-start:0;top:.2em;bottom:.2em;width:5px;border-radius:6px;background:linear-gradient(var(--accent),var(--accent-2))}
.entry-content h3{font-size:1.25rem;margin:1.4em 0 .5em}
.entry-content a{color:var(--accent-2);text-decoration:underline;text-underline-offset:3px}
.entry-content img,.entry-content figure{border-radius:var(--radius);overflow:hidden}
.entry-content blockquote{margin:1.5em 0;padding:14px 20px;background:var(--surface);border-inline-start:4px solid var(--accent);border-radius:0 var(--radius-sm) var(--radius-sm) 0;color:var(--muted)}
.entry-content code{background:var(--surface-2);padding:2px 7px;border-radius:6px;font-size:.9em}
.entry-content pre{background:var(--surface-2);padding:16px;border-radius:var(--radius-sm);overflow:auto}
.entry-content table{width:100%;border-collapse:collapse;margin:1.4em 0}
.entry-content th,.entry-content td{border:1px solid var(--border);padding:10px 12px;text-align:start}
.entry-content th{background:var(--surface-2)}
.entry-content ul li,.entry-content ol li{margin-bottom:.5em}

/* شريط تقدّم القراءة */
.read-progress{position:fixed;top:0;inset-inline:0;height:3px;background:linear-gradient(90deg,var(--accent),var(--accent-2));width:0;z-index:200;transition:width .1s linear}

/* مشاركة */
.share-row{display:flex;flex-wrap:wrap;gap:10px;margin:26px 0;padding:16px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
.share-row .lbl{font-weight:700;align-self:center;margin-inline-end:4px}
.share-btn{display:inline-flex;align-items:center;gap:7px;padding:8px 14px;border-radius:10px;background:var(--surface-2);border:1px solid var(--border);font-size:.86rem;font-weight:600}
.share-btn:hover{border-color:var(--border-2);color:var(--accent-2);transform:translateY(-2px)}
.share-btn svg{width:17px;height:17px;fill:currentColor}

.tags-row{display:flex;flex-wrap:wrap;gap:8px;margin:20px 0}
.tag-chip{font-size:.82rem;padding:5px 12px;border-radius:20px;background:var(--surface-2);border:1px solid var(--border);color:var(--muted)}
.tag-chip:hover{border-color:var(--accent);color:var(--accent-2)}

/* الكاتب */
.author-box{display:flex;gap:14px;align-items:center;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin:26px 0}
.author-box img{width:64px;height:64px;border-radius:50%;flex-shrink:0}
.author-box .a-name{font-weight:800;font-size:1.05rem;margin:0 0 4px}
.author-box .a-bio{color:var(--muted);font-size:.9rem;margin:0}

/* مقالات ذات صلة */
.related{margin-top:34px}

/* ============================================================
   8) التنقّل بين الصفحات (Pagination)
   ============================================================ */
.pagination{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:30px}
.pagination .page-numbers{display:inline-flex;align-items:center;justify-content:center;min-width:42px;height:42px;padding:0 12px;border-radius:10px;background:var(--surface);border:1px solid var(--border);font-weight:600}
.pagination .page-numbers.current{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}
.pagination .page-numbers:hover:not(.current){border-color:var(--border-2);color:var(--accent-2)}

/* ============================================================
   9) الفوتر
   ============================================================ */
.site-footer{background:var(--bg-2);border-top:1px solid var(--border);margin-top:40px}
.footer-widgets{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:var(--gap);padding-block:34px}
.footer-widgets .widget{background:transparent;border:0;padding:0;margin:0}
.footer-widgets .widget-title{border-color:var(--border)}
.footer-bottom{border-top:1px solid var(--border);padding-block:18px;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;color:var(--muted);font-size:.88rem}
.footer-nav ul{list-style:none;display:flex;flex-wrap:wrap;gap:16px;margin:0;padding:0}

/* زر لأعلى */
.to-top{position:fixed;inset-inline-end:18px;bottom:18px;width:46px;height:46px;border-radius:12px;background:var(--accent);color:#fff;border:0;cursor:pointer;display:flex;align-items:center;justify-content:center;opacity:0;visibility:hidden;transform:translateY(10px);transition:.25s;z-index:90;box-shadow:var(--shadow)}
.to-top.show{opacity:1;visibility:visible;transform:translateY(0)}
.to-top svg{width:22px;height:22px;stroke:#fff;fill:none;stroke-width:2.4}

/* ============================================================
   10) عناصر مساعدة + 404 + بحث
   ============================================================ */
.page-hero{background:var(--bg-2);border-bottom:1px solid var(--border);padding-block:28px;margin-bottom:26px}
.page-hero h1{margin:0;font-size:clamp(1.4rem,3vw,2rem)}
.breadcrumbs{color:var(--muted-2);font-size:.85rem;margin-top:8px}
.breadcrumbs a:hover{color:var(--accent-2)}
.notice-box{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:40px 24px;text-align:center}
.btn{display:inline-flex;align-items:center;gap:8px;background:var(--accent);color:var(--accent-ink);padding:11px 22px;border-radius:10px;font-weight:700;border:0;cursor:pointer}
.btn:hover{background:var(--accent-2);color:#fff}
.btn-ghost{background:var(--surface-2);border:1px solid var(--border);color:var(--text)}
.search-form{display:flex;gap:8px}
.search-form input[type=search]{flex:1;background:var(--surface);border:1px solid var(--border);border-radius:10px;padding:11px 14px;outline:none}
.search-form input[type=search]:focus{border-color:var(--accent)}

/* غلاف قسم الجدول في الرئيسية */
.matches-shell{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:6px;margin-bottom:20px}
@media(max-width:600px){.matches-shell{padding:2px;background:transparent;border:0}}

/* تحسينات RTL/LTR عامة للـ WP */
.alignright{float:right;margin:0 0 1em 1.5em}
.alignleft{float:left;margin:0 1.5em 1em 0}
.aligncenter{margin-inline:auto}
.wp-caption-text{color:var(--muted);font-size:.85rem;text-align:center;margin-top:6px}
.sticky,.gallery-caption,.bypostauthor{display:block}
.comment-list{list-style:none;padding:0}
