/*
Theme Name: Meyar Broker
Theme URI: https://meyarbroker.reviews
Description: Arabic (RTL) theme for a broker review site: review pages, popular and recently updated reviews, FAQ and newsletter.
Version: 2.0.3
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: meyarbroker
*/

:root {
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #f59e0b;
  --bg: #ffffff;
  --bg-alt: #f4f7f6;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --good: #16a34a;
  --mid: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 10px 28px rgba(15, 23, 42, .1);
  --surface: #ffffff;
  --header-bg: rgba(255, 255, 255, .95);
  --primary-text: #0f766e;
  --badge-bg: #ecfdf5;
  --soft-bg: #f1f5f9;
  --primary-soft: #ecfdf5;
  --bad-text: #dc2626;
  --bad-bg: #fef2f2;
  --bad-border: #fecaca;
  --thumb-bg: linear-gradient(135deg, #ccfbf1, #f0fdfa);
  --stars-off: #cbd5e1;
  --stats-bg: #0f172a;
  --footer-bg: #0b1220;
  color-scheme: light;
}

/* Dark theme: set on <html data-theme="dark"> by the toggle in the header. */
html[data-theme="dark"] {
  --primary: #0f8a80;
  --primary-dark: #0f766e;
  --bg: #0b1424;
  --bg-alt: #0f1b2e;
  --surface: #13213a;
  --header-bg: rgba(11, 20, 36, .92);
  --text: #e5ecf4;
  --muted: #9fb0c6;
  --border: #22324d;
  --primary-text: #5eead4;
  --badge-bg: rgba(45, 212, 191, .14);
  --soft-bg: #1a2a45;
  --primary-soft: rgba(45, 212, 191, .12);
  --bad-text: #fca5a5;
  --bad-bg: rgba(220, 38, 38, .14);
  --bad-border: rgba(248, 113, 113, .35);
  --thumb-bg: linear-gradient(135deg, #134e4a, #0f2a33);
  --stars-off: #3b4a63;
  --stats-bg: #07101d;
  --footer-bg: #060c17;
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
  --shadow-hover: 0 10px 28px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Tajawal", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
p { margin: 0 0 .8em; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 860px; }
.muted { color: var(--muted); font-size: .9em; }
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); opacity: 0; pointer-events: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s;
}
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: .9rem; }
.btn-ghost { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.btn-ghost:hover { background: var(--bad-bg); color: var(--bad); }
.btn-ghost-primary { background: transparent; color: var(--primary-text); border: 1px solid var(--primary-text); }
.btn-ghost-primary:hover { background: var(--primary-soft); color: var(--primary-text); }
.btn-accent { background: var(--accent); color: #1f2937; }
.btn-accent:hover { background: #fbbf24; color: #1f2937; }
.link { color: var(--primary-text); font-weight: 700; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.admin-bar .site-header { top: 32px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-size: 1.6rem; font-weight: 800; color: var(--primary-text); display: flex; align-items: center; gap: 8px; }
.logo-sub { color: var(--accent); }
.logo-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 1.2rem;
}
.custom-logo-link img { max-height: 48px; width: auto; display: block; }
.main-nav { display: flex; align-items: center; gap: 22px; font-weight: 500; }
.main-nav .menu { display: flex; align-items: center; gap: 22px; list-style: none; margin: 0; padding: 0; }
.main-nav .menu a:hover, .main-nav .current-menu-item > a { color: var(--primary-text); }
.menu-toggle { display: none; background: none; border: 0; font-size: 1.8rem; cursor: pointer; color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 10px; }

/* Theme toggle: crescent and star in light mode, sun in dark mode. */
.theme-toggle {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary-text);
  cursor: pointer;
  transition: background .2s, color .2s, transform .3s;
}
.theme-toggle:hover { background: var(--primary-soft); transform: rotate(-12deg); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 24px; height: 24px; display: block; }
.theme-toggle .icon-sun { display: none; color: var(--accent); }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
  color: #fff;
  padding: 80px 0 70px;
  text-align: center;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; }
.hero p { font-size: 1.15rem; opacity: .9; max-width: 620px; margin: 0 auto 28px; }
.inline-form { display: flex; gap: 8px; max-width: 560px; margin: 0 auto; }
.inline-form input {
  flex: 1; min-width: 0;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
.hero .btn { background: var(--accent); color: #1f2937; }
.hero .btn:hover { background: #fbbf24; }
.hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 24px; margin-top: 24px; opacity: .9; font-size: .95rem; }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 28px; }
.section-head { display: flex; flex-direction: column; gap: 4px; }
.section-head.row { flex-direction: row; justify-content: space-between; align-items: baseline; flex-wrap: wrap; }
.page-header { margin-bottom: 28px; }
.page-header .section-title { margin-bottom: 8px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card h2 { font-size: 1.25rem; }
.card h3 { font-size: 1.1rem; }

.category-card { display: block; }
.cat-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.category-card p { color: var(--muted); font-size: .92rem; margin: 0; }

.country { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.flag { font-size: 2rem; }

/* ---------- Filters ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 999px;
  font: inherit; font-size: .9rem;
  cursor: pointer;
}
.chip.active, .chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Broker list ---------- */
.broker-list { display: flex; flex-direction: column; gap: 14px; }
.broker-list.spaced { margin-top: 28px; }
.broker-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
}
.broker-row.is-warning { border-color: var(--bad-border); }
.rank { font-weight: 800; font-size: 1.3rem; color: var(--muted); text-align: center; }
.broker-logo {
  width: 64px; height: 64px; border-radius: 14px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 1.2rem;
  direction: ltr;
  overflow: hidden;
}
.broker-logo.has-img { background: #fff; border: 1px solid var(--border); } /* logos stay on white in both themes */
.broker-logo.has-img img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.broker-logo.lg { width: 96px; height: 96px; font-size: 1.8rem; }
.broker-info h3 { margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.broker-info h3 a:hover { color: var(--primary-text); }
.broker-info p { color: var(--muted); font-size: .95rem; margin-bottom: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: .78rem; font-weight: 700;
  background: var(--badge-bg); color: var(--primary-text);
  padding: 2px 10px; border-radius: 6px;
  direction: ltr;
}
.badge-soft { background: var(--soft-bg); color: var(--muted); direction: rtl; }
.badge-bad { background: var(--bad-bg); color: var(--bad-text); direction: rtl; }

.broker-action .btn { white-space: nowrap; }
.list-filter { margin-bottom: 20px; }
.list-filter input {
  width: 100%; max-width: 480px;
  padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 10px;
  font: inherit; background: var(--surface); color: var(--text);
}
.center-link { text-align: center; margin-top: 28px; }
.quick-facts { margin-bottom: 24px; }
.disclaimer p { margin: 0 0 8px; }
.broker-score { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.score {
  font-weight: 800; font-size: 1.5rem;
  color: #fff; border-radius: 10px;
  padding: 2px 14px;
}
.score.small { font-size: .85rem; padding: 1px 8px; border-radius: 6px; }
.score.big { font-size: 2.2rem; padding: 6px 20px; }
.score.good { background: var(--good); }
.score.mid { background: var(--mid); }
.score.bad { background: var(--bad); }
.stars { color: var(--accent); letter-spacing: 2px; font-size: .95rem; }
.stars .off { color: var(--stars-off); }
.empty { text-align: center; color: var(--muted); padding: 30px; }

/* ---------- Stats ---------- */
.stats { background: var(--stats-bg); color: #fff; padding: 48px 0; text-align: center; }
.stats strong { display: block; font-size: 2.6rem; font-weight: 800; color: var(--accent); }
.stats span { opacity: .85; }

/* ---------- Services ---------- */
.service-icon { font-size: 2.2rem; margin-bottom: 10px; }
.service p { color: var(--muted); }

/* ---------- Reviews ---------- */
.user-review { display: flex; flex-direction: column; }
.user-review p { flex: 1; font-size: .95rem; }
.ur-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
.ur-foot { display: flex; justify-content: space-between; align-items: center; font-size: .9rem; gap: 10px; }
.ur-foot a { color: var(--primary-text); font-weight: 700; }

/* ---------- Articles ---------- */
.article { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.article-thumb {
  height: 170px;
  display: grid; place-items: center;
  font-size: 3.5rem;
  background: var(--thumb-bg);
  overflow: hidden;
}
.article-thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.article-body h3 a:hover { color: var(--primary-text); }
.article-body p { color: var(--muted); font-size: .95rem; flex: 1; }

/* ---------- FAQ ---------- */
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  padding: 4px 20px;
}
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  padding: 14px 0;
  list-style: none;
  display: flex; justify-content: space-between; gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--primary-text); font-size: 1.4rem; line-height: 1; }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { color: var(--muted); padding-bottom: 10px; }

/* ---------- Newsletter ---------- */
.newsletter { background: var(--primary); color: #fff; padding: 56px 0; text-align: center; }
.newsletter p { opacity: .9; }
.newsletter .btn { background: var(--accent); color: #1f2937; }
.form-note { margin-top: 14px; font-weight: 700; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: #cbd5e1; padding-top: 52px; }
.site-footer .logo { color: #fff; margin-bottom: 12px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 30px; }
.footer-grid h4 { color: #fff; font-size: 1.05rem; }
.footer-grid .menu { list-style: none; margin: 0; padding: 0; }
.footer-grid .menu a { display: block; padding: 3px 0; }
.footer-grid a:hover { color: #fff; }
.disclaimer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid #1e293b;
  font-size: .85rem;
  color: #94a3b8;
}
.copyright { padding: 18px 16px 26px; font-size: .85rem; color: #64748b; }

.whatsapp {
  position: fixed; bottom: 20px; left: 20px; z-index: 60;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25d366; color: #fff;
  display: grid; place-items: center; font-size: 1.6rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
}

/* ---------- Broker review ---------- */
.breadcrumbs { color: var(--muted); font-size: .9rem; margin-bottom: 20px; }
.breadcrumbs a { color: var(--primary-text); }
.alert {
  background: var(--bad-bg); color: var(--bad-text);
  border: 1px solid var(--bad-border);
  border-radius: 12px;
  padding: 14px 18px;
  font-weight: 700;
  margin-bottom: 20px;
}
.review-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}
.review-hero h1 { font-size: 1.9rem; }
.review-hero p { color: var(--muted); margin: 0; }
.facts { width: 100%; border-collapse: collapse; }
.facts th, .facts td { padding: 10px 4px; border-bottom: 1px solid var(--border); text-align: right; }
.facts th { color: var(--muted); font-weight: 500; width: 45%; }
.facts .ltr-cell { text-align: right; }
.bad-text { color: var(--bad-text); font-weight: 700; }
.pros, .cons { list-style: none; padding: 0; margin: 0 0 14px; }
.pros li, .cons li { padding: 5px 0; }
.pros li::before { content: "✔ "; color: var(--good); font-weight: 800; }
.cons li::before { content: "✘ "; color: var(--bad); font-weight: 800; }
.review-body { margin-top: 24px; }
.back-link { margin-top: 30px; }
.related-brokers { margin-top: 48px; }
.related-brokers .section-title { font-size: 1.4rem; }

/* ---------- Article text (WordPress editor) ---------- */
.entry-header h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; }
.entry-thumb { margin: 10px 0 24px; border-radius: var(--radius); overflow: hidden; }
.entry-thumb img { display: block; width: 100%; }
.entry-content { font-size: 1.05rem; }
.entry-content h2 { font-size: 1.5rem; margin-top: 1.4em; }
.entry-content h3 { font-size: 1.25rem; margin-top: 1.2em; }
.entry-content a { color: var(--primary-text); text-decoration: underline; }
.entry-content ul, .entry-content ol { padding-right: 1.4em; padding-left: 0; }
.entry-content blockquote {
  margin: 1.2em 0; padding: 12px 20px;
  border-right: 4px solid var(--primary);
  background: var(--bg-alt); border-radius: 8px;
}
.entry-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: right; }
.entry-content img { border-radius: 10px; }
.entry-content > *:last-child { margin-bottom: 0; }
.alignleft { float: left; margin: 0 1.2em 1em 0; }
.alignright { float: right; margin: 0 0 1em 1.2em; }
.aligncenter { display: block; margin: 0 auto 1em; }
.wp-caption-text, figcaption { color: var(--muted); font-size: .85rem; text-align: center; }

/* ---------- Pagination ---------- */
.pagination, .comments-pagination { margin-top: 36px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.page-numbers {
  display: inline-block; min-width: 40px; text-align: center;
  padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
}
.page-numbers.current, a.page-numbers:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Comments ---------- */
.comments-area { margin-top: 48px; }
.comments-area .section-title { font-size: 1.4rem; }
.comment-list, .comment-list .children { list-style: none; margin: 0; padding: 0; }
.comment-list .children { margin-right: 24px; }
.comment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
}
.comment-card .children { margin-top: 12px; }
.comment-reply-link { color: var(--primary-text); font-weight: 700; }
.comment-form-card { margin-top: 24px; }
.comment-reply-title { font-size: 1.25rem; margin-top: 0; }
.comment-form label { display: block; font-weight: 700; margin-bottom: 4px; }
.comment-form input[type=text],
.comment-form input[type=email],
.comment-form textarea,
.comment-form select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
.comment-form .required { color: var(--bad-text); }
.comment-form .submit {
  background: var(--primary); color: #fff; border: 0; border-radius: 10px;
  padding: 12px 22px; font: inherit; font-weight: 700; cursor: pointer;
}
.comment-form .submit:hover { background: var(--primary-dark); }
.comment-notes { color: var(--muted); font-size: .9rem; }

.not-found { text-align: center; }
.not-found .btn { margin: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 782px) {
  .admin-bar .site-header { top: 46px; }
}

@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .main-nav {
    display: none;
    position: absolute; top: 68px; right: 0; left: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px;
  }
  .main-nav.open { display: flex; }
  .main-nav .menu { flex-direction: column; align-items: stretch; gap: 0; }
  .main-nav .menu a { display: block; padding: 10px 0; }
  .main-nav .btn { text-align: center; margin-top: 8px; }

  .hero { padding: 56px 0 48px; }
  .section { padding: 48px 0; }
  .section-title { font-size: 1.5rem; }
  .grid-2 { grid-template-columns: 1fr; }

  .broker-row {
    grid-template-columns: 52px 1fr;
    gap: 12px 14px;
    padding: 16px;
  }
  .broker-row .broker-logo { width: 52px; height: 52px; font-size: 1rem; }
  .broker-row .broker-action { grid-column: 1 / -1; }
  .broker-row .broker-action .btn { display: block; text-align: center; }

  .review-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}

@media (max-width: 600px) {
  .admin-bar .site-header { top: 0; }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; }
}
