/* ============================================================
   Tharri CMS — Theme (مستوحى من قالب Seoplus الأصلي)
   الألوان الذهبية + خط Tajawal + الوضع الليلي + RTL
   ============================================================ */

:root {
  --maxWidth: 1200px;
  --minColor: #f4a900;       /* اللون الأساسي الذهبي */
  --minColorTran: #f4a9007a;
  --hoverColor: #f4a900;
  --accentDark: #d69503;
  --BodyBG: #f7f7f7;
  --MinBgColor: #ffffff;     /* خلفية البطاقات/الأسطح */
  --secColor: #efefef;
  --whiteColor: #ffffff;
  --txtColor: #69583a;
  --TitColor: #444444;
  --SanColor: #666666;
  --Borderes: #f1f1f1;
  --Borderes3: #eeeeee;
  --PostTxtColor: #393939;
  --PostTitleColor: #41402e;
  --PostLinkColor: #886d07;
  --Hbg: #ffffff;            /* خلفية الهيدر */
  --HColor: #4d4d4d;
  --shadow: 0 6px 18px rgba(9, 32, 76, .06);
  --shadowHover: 0 10px 26px rgba(9, 32, 76, .12);
  --radius: 10px;
  --gap: 30px;
  --sidebarW: 330px;
  --headFont: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;
}

body.dark-mode {
  --BodyBG: #081B33;
  --MinBgColor: #142d4e;
  --secColor: #242950;
  --whiteColor: #ffffff;
  --txtColor: #ffffff;
  --TitColor: #ffffff;
  --SanColor: #d8def0;
  --Borderes: #2c466b;
  --Borderes3: #2c466b;
  --PostTxtColor: #e8ecf5;
  --PostTitleColor: #ffffff;
  --PostLinkColor: #6fa8ff;
  --Hbg: #14325c;
  --HColor: #ffffff;
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--headFont);
  background: var(--BodyBG);
  color: var(--TitColor);
  font-size: 15px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; }

.container { width: 100%; max-width: var(--maxWidth); margin: 0 auto; padding: 0 20px; }
.clearfix::after { content: ""; display: block; clear: both; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--Hbg);
  box-shadow: var(--shadow);
}
.header-top {
  background: var(--minColor);
  color: #fff;
  font-size: 13px;
}
.header-top .container { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.header-top a { color: #fff; opacity: .92; }
.header-top a:hover { opacity: 1; }
.header-top .ht-pages { display: flex; gap: 14px; }
.header-top .ht-social { display: flex; gap: 12px; align-items: center; }
.header-top .ht-social a { display: inline-flex; }
.header-top .ht-social svg { width: 16px; height: 16px; fill: #fff; }

.header-main .container { display: flex; align-items: center; justify-content: space-between; height: 74px; gap: 20px; }
.site-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.site-logo .logo-text { font-size: 26px; font-weight: 800; color: var(--minColor); }
.site-logo .logo-text span { color: var(--TitColor); }
.site-logo img { max-height: 60px; width: auto; }

.main-nav { flex: 1; min-width: 0; }
.main-nav > ul { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; justify-content: flex-start; }
.main-nav > ul > li { flex-shrink: 0; }
.main-nav > ul > li > a {
  display: block; padding: 8px 10px; border-radius: 8px;
  color: var(--HColor); font-weight: 600; font-size: 14.5px; white-space: nowrap;
  transition: color .2s, background .2s;
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li.active > a { color: var(--minColor); background: rgba(244,169,0,.08); }

.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid var(--Borderes3); background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--HColor); transition: all .2s;
}
.icon-btn:hover { background: var(--minColor); color: #fff; border-color: var(--minColor); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.menu-toggle { display: none; }

/* ---------- Layout ---------- */
.layout { display: flex; align-items: flex-start; gap: var(--gap); margin: var(--gap) auto; }
.main-col { width: calc(100% - var(--sidebarW) - var(--gap)); min-width: 0; }
.sidebar { width: var(--sidebarW); position: sticky; top: 130px; flex-shrink: 0; }

/* عنوان قسم */
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.section-head .title {
  font-size: 22px; font-weight: 800; color: var(--TitColor);
  display: flex; align-items: center; white-space: nowrap;
}
.section-head .title::before {
  content: ""; height: 24px; width: 4px; border-radius: 4px;
  background: var(--minColor); margin-left: 10px;
}
.section-head .line { flex: 1; height: 1px; background: var(--Borderes3); }

/* ---------- Posts grid + cards ---------- */
.posts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.post-card {
  background: var(--MinBgColor); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .25s, box-shadow .25s; display: flex; flex-direction: column;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadowHover); }
.post-card .thumb { position: relative; display: block; padding-top: 56.25%; overflow: hidden; background: var(--secColor); }
.post-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.post-card:hover .thumb img { transform: scale(1.06); }
.post-card .cat-badge {
  position: absolute; top: 12px; inset-inline-start: 12px;
  background: var(--minColor); color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 30px; box-shadow: 0 3px 10px rgba(0,0,0,.2);
}
.post-card .card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card .card-title { font-size: 18px; font-weight: 700; color: var(--TitColor); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card:hover .card-title { color: var(--minColor); }
.post-card .card-excerpt { color: var(--SanColor); font-size: 14px; line-height: 1.8;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .card-meta { margin-top: auto; display: flex; align-items: center; gap: 14px;
  color: var(--SanColor); font-size: 12.5px; padding-top: 10px; border-top: 1px solid var(--Borderes3); }
.post-card .card-meta .mi { display: inline-flex; align-items: center; gap: 5px; }
.post-card .card-meta svg { width: 13px; height: 13px; fill: var(--minColor); }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 40px; }
.pagination a, .pagination span {
  min-width: 42px; height: 42px; padding: 0 12px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--MinBgColor); color: var(--TitColor); box-shadow: var(--shadow); font-weight: 700;
  transition: all .2s;
}
.pagination a:hover { background: var(--minColor); color: #fff; }
.pagination .current { background: var(--minColor); color: #fff; }
.pagination .disabled { opacity: .45; pointer-events: none; }

/* ---------- Sidebar widgets ---------- */
.widget { background: var(--MinBgColor); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: var(--gap); }
.widget:last-child { margin-bottom: 0; }
.widget-title { font-size: 17px; font-weight: 800; color: var(--TitColor); margin-bottom: 16px;
  border-right: 3px solid var(--minColor); padding-right: 10px; }
.widget .cat-list li { border-bottom: 1px solid var(--Borderes3); }
.widget .cat-list li:last-child { border-bottom: 0; }
.widget .cat-list a { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; color: var(--TitColor); font-weight: 600; transition: color .2s; }
.widget .cat-list a:hover { color: var(--minColor); }
.widget .cat-list .count { background: var(--minColor); color: #fff; font-size: 12px; min-width: 26px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; padding: 0 6px; }
.widget .pp-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--Borderes3); }
.widget .pp-item:last-child { border-bottom: 0; }
.widget .pp-item .pp-thumb { width: 80px; height: 60px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--secColor); }
.widget .pp-item .pp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.widget .pp-item .pp-title { font-size: 14px; font-weight: 600; line-height: 1.6; color: var(--TitColor);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.widget .pp-item:hover .pp-title { color: var(--minColor); }

/* ---------- Single post ---------- */
.post-single { background: var(--MinBgColor); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.post-single .post-hero { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--secColor); }
.post-single .post-inner { padding: 26px 30px 34px; }
.post-top-tag { display: inline-block; background: var(--minColor); color: #fff; font-size: 13px; font-weight: 700;
  padding: 4px 14px; border-radius: 30px; margin-bottom: 16px; }
.post-title { font-size: 32px; line-height: 1.5; font-weight: 800; color: var(--PostTitleColor); margin-bottom: 16px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; color: var(--SanColor); font-size: 13.5px;
  padding-bottom: 18px; border-bottom: 1px solid var(--Borderes3); margin-bottom: 24px; }
.post-meta .mi { display: inline-flex; align-items: center; gap: 6px; }
.post-meta .author { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--TitColor); }
.post-meta .author img { width: 30px; height: 30px; border-radius: 50%; }
.post-meta svg { width: 15px; height: 15px; fill: var(--minColor); }

/* محتوى المقال */
.post-body { color: var(--PostTxtColor); font-size: 18px; line-height: 2.1; }
.post-body p { margin: 0 0 1.1em; }
.post-body a { color: var(--PostLinkColor); text-decoration: underline; }
.post-body h2 { font-size: 26px; font-weight: 800; color: var(--PostTitleColor); margin: 1.4em 0 .6em; }
.post-body h3 { font-size: 22px; font-weight: 700; color: var(--PostTitleColor); margin: 1.3em 0 .5em; }
.post-body h4 { font-size: 19px; font-weight: 700; color: var(--PostTitleColor); margin: 1.2em 0 .5em; }
.post-body img { border-radius: var(--radius); margin: 1em auto; }
.post-body ul, .post-body ol { margin: 0 0 1.1em; padding-inline-start: 1.5em; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li { margin-bottom: .4em; }
.post-body blockquote {
  border-inline-start: 4px solid var(--minColor); background: var(--secColor);
  padding: 14px 18px; border-radius: 8px; margin: 1.2em 0; color: var(--TitColor);
}
.post-body table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: 15px; overflow: hidden; border-radius: 8px; }
.post-body table th, .post-body table td { padding: 14px; border: 1px solid var(--Borderes3); text-align: inherit; }
.post-body table th { background: var(--secColor); font-weight: 700; }
.post-body table tr:nth-child(2n) td { background: rgba(0,0,0,.015); }
.post-body .table-wrap { overflow-x: auto; }
.post-body iframe { max-width: 100%; border-radius: 8px; margin: 1em 0; }

/* وسوم المقال */
.post-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--Borderes3); }
.post-tags .tag { background: var(--secColor); color: var(--TitColor); font-size: 13px; padding: 6px 14px; border-radius: 30px; transition: all .2s; }
.post-tags .tag:hover { background: var(--minColor); color: #fff; }

/* فهرس المحتويات */
.toc { background: var(--secColor); border-radius: var(--radius); padding: 14px 20px; margin: 0 0 24px; }
.toc .toc-title { font-weight: 800; color: var(--TitColor); cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; user-select: none; }
.toc .toc-title::after { content: '▾'; font-size: 14px; transition: transform .25s; opacity: .7; }
.toc.collapsed .toc-title::after { transform: rotate(-90deg); }
.toc ol { padding-inline-start: 1.4em; margin-top: 10px; max-height: 300px; overflow-y: auto; }
.toc.collapsed ol { display: none; }
.toc a { color: var(--PostLinkColor); }
.toc a:hover { color: var(--minColor); }

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

/* ---------- Comments ---------- */
.comments-section { background: var(--MinBgColor); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 30px; margin-top: var(--gap); }
.comment { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--Borderes3); }
.comment:last-child { border-bottom: 0; }
.comment.reply { margin-inline-start: 54px; }
.comment .c-avatar { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--minColor); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; }
.comment .c-body { flex: 1; }
.comment .c-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.comment .c-name { font-weight: 700; color: var(--TitColor); }
.comment .c-date { font-size: 12px; color: var(--SanColor); }
.comment .c-text { color: var(--PostTxtColor); font-size: 15px; }
.comment .c-reply { font-size: 12.5px; color: var(--minColor); cursor: pointer; margin-top: 4px; display: inline-block; }

.comment-form { margin-top: 24px; }
.comment-form .form-row { display: flex; gap: 14px; }
.comment-form .form-row > * { flex: 1; }
.form-control { width: 100%; padding: 12px 14px; border: 1px solid var(--Borderes3); border-radius: 8px;
  background: var(--BodyBG); color: var(--TitColor); font-family: inherit; font-size: 15px; margin-bottom: 14px; transition: border .2s; }
.form-control:focus { outline: none; border-color: var(--minColor); }
textarea.form-control { min-height: 130px; resize: vertical; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--minColor); color: #fff; border: 0;
  padding: 12px 26px; border-radius: 30px; font-weight: 700; font-size: 15px; box-shadow: 0 4px 14px rgba(244,169,0,.35); transition: transform .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(244,169,0,.45); }
.btn.btn-block { width: 100%; justify-content: center; }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e6f7ee; color: #1a7f4f; }
.alert-error { background: #fdeaea; color: #c0392b; }

/* ---------- Ads ---------- */
.ad-zone { margin: 24px 0; text-align: center; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.ad-zone::before { content: "إعلان"; position: absolute; font-size: 10px; color: var(--SanColor); opacity: .6; transform: translateY(-26px); }
.ad-zone.empty { background: repeating-linear-gradient(45deg, var(--secColor), var(--secColor) 10px, transparent 10px, transparent 20px); border-radius: 8px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--MinBgColor); border-top: 3px solid var(--minColor); margin-top: 50px; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--gap); padding: 44px 0; }
.footer-col .f-title { font-size: 17px; font-weight: 800; color: var(--TitColor); margin-bottom: 16px; }
.footer-col p, .footer-col a { color: var(--SanColor); font-size: 14px; line-height: 2; }
.footer-col a:hover { color: var(--minColor); }
.footer-col li { margin-bottom: 6px; }
.footer-bottom { border-top: 1px solid var(--Borderes3); padding: 18px 0; text-align: center; color: var(--SanColor); font-size: 13px; }
.footer-bottom a { color: var(--minColor); }

/* ---------- Floating buttons ---------- */
.fab { position: fixed; inset-inline-end: 22px; width: 50px; height: 50px; border-radius: 50%;
  background: var(--MinBgColor); box-shadow: var(--shadowHover); display: flex; align-items: center; justify-content: center;
  color: var(--minColor); z-index: 40; border: 1px solid var(--Borderes3); transition: all .25s; }
.fab svg { width: 22px; height: 22px; fill: currentColor; }
.fab.dark-toggle { bottom: 20px; }
.fab.to-top { bottom: 82px; opacity: 0; visibility: hidden; transform: scale(.6); }
.fab.to-top.show { opacity: 1; visibility: visible; transform: scale(1); }
.fab:hover { background: var(--minColor); color: #fff; }

/* ---------- Search overlay ---------- */
.search-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
  z-index: 100; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.search-overlay.open { display: flex; }
.search-box { width: 92%; max-width: 620px; background: var(--MinBgColor); border-radius: 14px; padding: 26px; box-shadow: var(--shadowHover); }
.search-box form { display: flex; gap: 10px; }
.search-box input { flex: 1; margin: 0; }
.search-box .search-close { text-align: center; margin-top: 14px; color: var(--SanColor); cursor: pointer; font-size: 13px; }

/* ---------- Mobile sidenav ---------- */
.sidenav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 110; opacity: 0; visibility: hidden; transition: .25s; }
.sidenav-backdrop.open { opacity: 1; visibility: visible; }
.sidenav { position: fixed; top: 0; inset-inline-end: -320px; width: 300px; max-width: 85%; height: 100%;
  background: var(--MinBgColor); z-index: 120; transition: inset-inline-end .3s; padding: 24px 20px; overflow-y: auto; box-shadow: var(--shadowHover); }
.sidenav.open { inset-inline-end: 0; }
.sidenav .sn-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.sidenav .sn-close { font-size: 22px; cursor: pointer; color: var(--TitColor); }
.sidenav ul li a { display: block; padding: 13px 0; border-bottom: 1px solid var(--Borderes3); color: var(--TitColor); font-weight: 600; }
.sidenav ul li a:hover { color: var(--minColor); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--SanColor); margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--minColor); }
.breadcrumb .sep { opacity: .6; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--SanColor); }
.empty-state svg { width: 70px; height: 70px; fill: var(--minColor); opacity: .5; margin: 0 auto 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .header-top { display: none; }
  .main-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .layout { flex-direction: column; }
  .main-col, .sidebar { width: 100%; }
  .sidebar { position: static; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .posts-grid { grid-template-columns: 1fr; }
  .post-single .post-inner { padding: 20px 18px 26px; }
  .post-title { font-size: 25px; }
  .post-body { font-size: 16.5px; }
  .comments-section { padding: 20px 18px; }
  .comment-form .form-row { flex-direction: column; gap: 0; }
  .footer-cols { grid-template-columns: 1fr; }
  .container { padding: 0 14px; }
}
