/**
 * TheQA Theme - مطابق لتصميم theqa.reviews
 * Primary: #007bff | Hover: #0d3155 | Yellow: #fbbf0d
 */
html {
    color-scheme: light;
}
html[data-bs-theme="dark"] {
    color-scheme: dark;
}

:root {
    --theqa-primary: #007bff;
    --theqa-primary-hover: #0d3155;
    --theqa-secondary: #e1e8ef;
    --theqa-yellow: #fbbf0d;
    --theqa-text: #1f2123;
    --theqa-muted: #7b8895;
    /* خلفية الصفحة كالمرجع theqa.reviews (أبيض) */
    --theqa-bg: #ffffff;
    --theqa-border: rgba(0, 0, 0, 0.125);
    --theqa-surface: #ffffff;
    --theqa-footer-bg: #1f2123;
    /* شريط التنقل — نفس المرآة */
    --theqa-nav-bg: #033878;
    --theqa-nav-hover: #007bff;
    --theqa-row-muted: #f7f9fa;
    --theqa-row-muted-hover: #eff3f5;
}

/* الوضع الداكن — متغيرات + تباين (Bootstrap data-bs-theme) */
html[data-bs-theme="dark"] {
    --theqa-primary: #5c9eff;
    --theqa-primary-hover: #82b4ff;
    --theqa-secondary: #2a3440;
    --theqa-yellow: #f5c84c;
    --theqa-text: #e8eaed;
    --theqa-muted: #9aa0a6;
    --theqa-bg: #12171d;
    --theqa-border: rgba(255, 255, 255, 0.12);
    --theqa-surface: #1a1f26;
    --theqa-footer-bg: #0d1014;
    --theqa-row-muted: #1e252e;
    --theqa-row-muted-hover: #252d38;
}

body.theqa-theme {
    font-family: 'Almarai', 'Cairo', sans-serif;
    color: var(--theqa-text);
    background-color: var(--theqa-bg);
    /* تذييل دائماً أسفل الصفحة حتى مع محتوى قصير */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* الشريط العلوي لا ينضغط مع تخطيط العمود */
.theqa-theme .navbar-theqa {
    flex-shrink: 0;
    width: 100%;
}

/* حاوية كعرض المرجع (حتى ~80rem) */
.theqa-theme .theqa-main .container {
    max-width: min(80rem, 100%);
}

/* المحتوى الرئيسي يمتد ليملأ المساحة فوق التذييل */
.theqa-theme .theqa-main {
    flex: 1 0 auto;
    width: 100%;
}
.theqa-theme .theqa-section {
    padding-top: 2rem;
    padding-bottom: 2rem;
}
@media (min-width: 768px) {
    .theqa-theme .theqa-section {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }
}

/* رأس صفحة داخلية (موحّد مع الهيرو بالألوان) */
.theqa-theme .theqa-page-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--theqa-text);
    margin-bottom: 0.5rem;
    line-height: 1.25;
}
.theqa-theme .theqa-page-subtitle {
    font-size: 1rem;
    color: var(--theqa-muted);
    font-weight: 500;
    max-width: 42rem;
}
.theqa-theme .theqa-breadcrumb .breadcrumb {
    --bs-breadcrumb-divider: '›';
    font-size: 0.9rem;
}
.theqa-theme .theqa-breadcrumb .breadcrumb-item a {
    color: var(--theqa-primary);
    text-decoration: none;
    font-weight: 600;
}
.theqa-theme .theqa-breadcrumb .breadcrumb-item a:hover {
    text-decoration: underline;
}
.theqa-theme .theqa-breadcrumb .breadcrumb-item.active {
    color: var(--theqa-muted);
}

/* محتوى نصي (صفحات CMS) */
.theqa-theme .theqa-prose {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--theqa-text);
}
.theqa-theme .theqa-prose p {
    margin-bottom: 1rem;
}

/* ترقيم الصفحات — مرحلة 2: تمرير أفقي على الجوال، أهداف لمس أوضح */
.theqa-theme .theqa-pagination {
    display: flex;
    justify-content: center;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
}
.theqa-theme .theqa-pagination .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    margin-bottom: 0;
}
.theqa-theme .theqa-pagination .page-link {
    color: var(--theqa-primary);
    border-radius: 0.5rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.5rem;
}
.theqa-theme .theqa-pagination .page-item.active .page-link {
    background-color: var(--theqa-primary);
    border-color: var(--theqa-primary);
    color: #fff;
}
.theqa-theme .theqa-pagination .page-item.disabled .page-link {
    color: var(--theqa-muted);
    opacity: 0.65;
}
.theqa-theme .pagination .page-link {
    color: var(--theqa-primary);
    border-radius: 0.5rem;
}
.theqa-theme .pagination .page-item.active .page-link {
    background-color: var(--theqa-primary);
    border-color: var(--theqa-primary);
}

/* حالة فارغة */
.theqa-theme .theqa-empty-state-icon {
    width: 4rem;
    height: 4rem;
}

/* شريط تنقل — أيقونة واضحة على خلفية فاتحة */
.theqa-theme .navbar-theqa.navbar-light .navbar-toggler {
    border-color: var(--theqa-secondary);
}

.theqa-theme .btn-theqa-primary {
    color: #fff;
    background-color: var(--theqa-primary);
    border-color: var(--theqa-primary);
    border-radius: 99em;
    font-weight: 700;
    padding: 0.5rem 1.5rem;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}
.theqa-theme .btn-theqa-primary.btn-sm {
    padding: 0.35rem 1rem;
    font-size: 0.875rem;
}
.theqa-theme .btn-theqa-secondary.btn-sm {
    padding: 0.35rem 1rem;
    font-size: 0.875rem;
}
.theqa-theme .btn-theqa-primary:hover {
    background-color: var(--theqa-primary-hover);
    border-color: var(--theqa-primary-hover);
    color: #fff;
}

.theqa-theme .btn-theqa-secondary {
    color: var(--theqa-primary);
    background-color: transparent;
    border-color: transparent;
    border-radius: 99em;
    font-weight: 700;
    padding: 0.5rem 1.5rem;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}
.theqa-theme .btn-theqa-secondary:hover {
    background-color: var(--theqa-secondary);
    border-color: var(--theqa-secondary);
    color: var(--theqa-primary);
}

.theqa-theme .btn-theqa-yellow {
    color: #212529;
    background-color: var(--theqa-yellow);
    border-color: var(--theqa-yellow);
    border-radius: 99em;
    font-weight: 700;
    padding: 0.5rem 1.5rem;
}
.theqa-theme .btn-theqa-yellow:hover {
    opacity: 0.9;
    color: #212529;
}

/* Hero */
.theqa-theme .hero-title {
    font-size: clamp(2rem, 5vw, 3.15rem);
    font-weight: 800;
    color: var(--theqa-text);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.theqa-theme .hero-title .theqa-home-hero__brand {
    color: var(--theqa-primary);
}
.theqa-theme .hero-title2 {
    font-size: clamp(1.125rem, 2.5vw, 1.5rem);
    color: var(--theqa-muted);
    font-weight: 500;
    margin-bottom: 2rem;
}
@media (min-width: 992px) {
    .theqa-theme .hero-title2 {
        text-align: start;
    }
}

/* الصفحة الرئيسية — هيرو داخل إطار بزوايا 11px وخلفية من ألوان الهوية + شعار شفاف */
.theqa-theme .theqa-home-hero__shell {
    position: relative;
    z-index: 0;
    border-radius: 11px;
    overflow: hidden;
    padding: 1.5rem 1.25rem 1.75rem;
    background-color: var(--theqa-surface);
    background-image: linear-gradient(
        145deg,
        color-mix(in srgb, var(--theqa-primary) 16%, var(--theqa-surface)),
        color-mix(in srgb, var(--theqa-secondary) 32%, var(--theqa-surface))
    );
    border: 1px solid var(--theqa-border);
    box-shadow: 0 0.35rem 1.25rem color-mix(in srgb, var(--theqa-primary) 14%, transparent);
}
html[data-bs-theme="dark"] .theqa-theme .theqa-home-hero__shell {
    background-image: linear-gradient(
        145deg,
        color-mix(in srgb, var(--theqa-primary) 22%, var(--theqa-surface)),
        color-mix(in srgb, var(--theqa-secondary) 28%, var(--theqa-bg))
    );
    box-shadow: 0 0.35rem 1.5rem rgba(0, 0, 0, 0.35);
}
.theqa-theme .theqa-home-hero__shell--has-logo::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: var(--theqa-hero-logo-url);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: min(52%, 17rem);
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}
html[data-bs-theme="dark"] .theqa-theme .theqa-home-hero__shell--has-logo::before {
    opacity: 0.12;
}
.theqa-theme .theqa-home-hero__shell .theqa-home-hero__grid {
    position: relative;
    z-index: 1;
}
.theqa-theme .theqa-home-hero__pitch {
    font-size: clamp(1rem, 2.2vw, 1.125rem);
    line-height: 1.75;
    font-weight: 500;
    color: var(--theqa-text);
    max-width: 42rem;
    margin-inline: auto;
    opacity: 0.95;
}
@media (min-width: 992px) {
    .theqa-theme .theqa-home-hero__pitch {
        margin-inline: 0;
        text-align: start;
    }
}
@media (min-width: 42rem) {
    .theqa-theme .theqa-home-hero__shell {
        padding: 2rem 1.75rem 2.25rem;
    }
}

/* الصفحة الرئيسية — تخطيط كـ theqa.reviews (index.html) */
.theqa-theme .theqa-home-hero__grid {
    display: grid;
    gap: 2rem;
    align-items: center;
    padding-top: 0;
}
@media (min-width: 42rem) {
    .theqa-theme .theqa-home-hero__grid {
        grid-template-columns: 7fr 5fr;
        gap: 0 2rem;
        padding-top: 2.5rem;
    }
    .theqa-theme .theqa-home-hero__intro .hero-title {
        text-align: start;
    }
}
.theqa-theme .theqa-home-broker-list {
    display: grid;
    gap: 0.25rem;
}
@media (min-width: 42rem) {
    .theqa-theme .theqa-home-broker-list {
        grid-row: 1 / -1;
        grid-column: 2 / 3;
    }
}
.theqa-theme .theqa-home-broker-list__item {
    list-style: none;
    padding: 0;
    margin: 0;
}
.theqa-theme .theqa-home-broker-list__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background-color: var(--theqa-row-muted);
    border-radius: 0.25rem;
    padding: 0.5rem;
    transition: background-color 0.3s ease, padding-inline-start 0.3s ease;
    min-height: 3.25rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--theqa-text);
    text-decoration: none;
}
.theqa-theme .theqa-home-broker-list__link:hover {
    background-color: var(--theqa-row-muted-hover);
    padding-inline-start: 1rem;
    color: var(--theqa-primary);
}
.theqa-theme .theqa-home-broker-list__name {
    flex: 1 1 auto;
    min-width: 0;
    text-align: start;
}
.theqa-theme .theqa-home-broker-list__img {
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    object-fit: contain;
    border-radius: 0.25rem;
    background: #fff;
}
.theqa-theme .theqa-home-broker-list__placeholder {
    width: 3rem;
    height: 3rem;
    min-width: 3rem;
    border-radius: 0.25rem;
    background: var(--theqa-secondary);
}
.theqa-theme .theqa-home-broker-list__arrow {
    font-size: 1rem;
    color: var(--theqa-text);
    opacity: 0.85;
    flex-shrink: 0;
}
.theqa-theme .hero-caption {
    color: var(--theqa-primary);
    font-size: 1rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.5rem;
}

/* Cards - review style */
.theqa-theme .theqa-card {
    position: relative;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid var(--theqa-border);
    background-color: var(--theqa-surface);
    transition: box-shadow 0.2s ease;
}
.theqa-theme .theqa-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
html[data-bs-theme="dark"] .theqa-theme .theqa-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.theqa-theme .theqa-card a {
    color: inherit;
    text-decoration: none;
}
.theqa-theme .theqa-card a:hover {
    color: var(--theqa-primary);
}

/* بطاقة مع صورة مميزة (المرحلة 3) */
.theqa-theme .theqa-card--has-media {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.theqa-theme .theqa-card__media {
    aspect-ratio: 16 / 9;
    background-color: var(--theqa-secondary);
    flex-shrink: 0;
}
.theqa-theme .theqa-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.theqa-theme .theqa-card__body {
    padding: 1rem;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* غلاف صفحة / صورة علوية (صفحة وسيط أو CMS) */
.theqa-theme .theqa-page-cover {
    border-radius: 1rem;
    overflow: hidden;
    background-color: var(--theqa-secondary);
}
.theqa-theme .theqa-page-cover__img {
    width: 100%;
    max-height: 20rem;
    object-fit: cover;
    display: block;
}

/* Content cards */
.theqa-theme .theqa-content-card {
    padding: 2rem;
    border-radius: 1rem;
    border: 2px solid var(--theqa-secondary);
    background: var(--theqa-surface);
}

/* Banner */
.theqa-theme .theqa-banner {
    background: linear-gradient(135deg, var(--theqa-primary) 0%, var(--theqa-primary-hover) 100%);
    padding: 2rem;
    border-radius: 1rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
@media (min-width: 768px) {
    .theqa-theme .theqa-banner {
        padding: 3rem 4rem;
    }
}

/* شريط التنقل — مطابق لـ theqa.reviews (خلفية #033878، نص أبيض) */
.theqa-theme .navbar-theqa.navbar-theqa--reference {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: 4.5rem;
    background-color: var(--theqa-nav-bg) !important;
    border-bottom: none;
    box-shadow: none;
}
.theqa-theme .navbar-theqa--reference .navbar-brand {
    color: #fff !important;
    font-weight: 800;
    font-size: 1.5rem;
    padding-block: 0.75rem;
}
.theqa-theme .navbar-theqa--reference .nav-link {
    color: rgba(255, 255, 255, 0.92) !important;
    font-weight: 700;
    font-size: 0.75rem;
    border-bottom: 0.25rem solid transparent;
}
@media (min-width: 992px) {
    .theqa-theme .navbar-theqa--reference .nav-link {
        font-size: 0.8125rem;
    }
}
.theqa-theme .navbar-theqa--reference .nav-link:hover,
.theqa-theme .navbar-theqa--reference .nav-link:focus,
.theqa-theme .navbar-theqa--reference .nav-link.active {
    color: #fff !important;
    border-bottom-color: var(--theqa-nav-hover);
    background: rgba(0, 123, 255, 0.2);
}
.theqa-theme .navbar-theqa--reference .navbar-toggler {
    filter: none;
}
.theqa-theme .navbar-theqa--reference .navbar-toggler-icon {
    filter: brightness(0) invert(1);
}
.theqa-theme .form-control-theqa-nav {
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
}
.theqa-theme .form-control-theqa-nav::placeholder {
    color: rgba(255, 255, 255, 0.65);
}
.theqa-theme .form-control-theqa-nav:focus {
    background-color: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.12);
}
.theqa-theme .btn-theqa-nav-icon {
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    background: transparent;
}
.theqa-theme .btn-theqa-nav-icon:hover {
    background: var(--theqa-nav-hover);
    border-color: var(--theqa-nav-hover);
    color: #fff;
}

/* شريط التنقل — الوضع الداكن */
html[data-bs-theme="dark"] .theqa-theme .navbar-theqa.navbar-theqa--reference {
    background-color: #0a1628 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
html[data-bs-theme="dark"] .theqa-theme .navbar-theqa--reference .nav-link:hover,
html[data-bs-theme="dark"] .theqa-theme .navbar-theqa--reference .nav-link.active {
    background: rgba(92, 158, 255, 0.15);
}
html[data-bs-theme="dark"] .theqa-theme .navbar-theqa--reference .form-control-theqa-nav {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
}
html[data-bs-theme="dark"] .theqa-theme .navbar-theqa--reference .form-control-theqa-nav::placeholder {
    color: rgba(255, 255, 255, 0.6);
}
html[data-bs-theme="dark"] .theqa-theme .navbar-theqa--reference .form-control-theqa-nav:focus {
    background-color: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

/* Footer — آخر الصفحة (مع تخطيط flex على body) */
.theqa-theme .footer-theqa {
    flex-shrink: 0;
    width: 100%;
    background-color: var(--theqa-footer-bg);
    color: #fff;
}
.theqa-theme .footer-theqa a {
    color: rgba(255, 255, 255, 0.8);
}
.theqa-theme .footer-theqa a:hover {
    color: #fff;
}

/* Override Bootstrap primary for consistency */
.theqa-theme .btn-primary {
    background-color: var(--theqa-primary);
    border-color: var(--theqa-primary);
    border-radius: 99em;
    font-weight: 700;
}
.theqa-theme .btn-primary:hover {
    background-color: var(--theqa-primary-hover);
    border-color: var(--theqa-primary-hover);
}
.theqa-theme .btn-outline-primary {
    color: var(--theqa-primary);
    border-color: var(--theqa-primary);
    border-radius: 99em;
}
.theqa-theme .btn-outline-primary:hover {
    background-color: var(--theqa-secondary);
    border-color: var(--theqa-secondary);
    color: var(--theqa-primary);
}
.theqa-theme .badge.bg-primary {
    background-color: var(--theqa-primary) !important;
}
.theqa-theme .text-primary {
    color: var(--theqa-primary) !important;
}
.theqa-theme .link-primary {
    color: var(--theqa-primary) !important;
}
.theqa-theme .link-primary:hover {
    color: var(--theqa-primary-hover) !important;
}

/* أيقونة حالة الفراغ — بدل bg-light الثابت */
.theqa-theme .theqa-empty-state-icon-wrap {
    background-color: var(--theqa-secondary) !important;
    color: var(--theqa-primary) !important;
}

html[data-bs-theme="dark"] .theqa-theme .btn-theqa-yellow {
    color: #1a1a1a;
}

/* ——— الصفحة الرئيسية: أقسام إضافية (تنبيهات، مقالات، توصيات، فريق) ——— */
.theqa-theme .theqa-home-scam-item {
    display: grid;
    grid-template-columns: 2.5rem 1fr;
    gap: 0.75rem 1rem;
    align-items: start;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background-color: var(--theqa-row-muted);
    border: 2px solid transparent;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
.theqa-theme .theqa-home-scam-item:hover {
    border-color: rgba(190, 18, 60, 0.28);
    background-color: var(--theqa-row-muted-hover);
}
.theqa-theme .theqa-home-scam-item__icon {
    grid-row: 1 / 3;
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.35rem;
    background: #fecdd3;
    flex-shrink: 0;
}
.theqa-theme .theqa-home-scam-item__title {
    color: inherit;
}
.theqa-theme .theqa-home-scam-item__title:hover {
    color: var(--theqa-primary);
}
.theqa-theme .theqa-home-signals {
    background: linear-gradient(135deg, #0d3155 0%, var(--theqa-primary) 55%, #1a5fb4 100%);
    box-shadow: 0 8px 32px rgba(13, 49, 85, 0.25);
}
.theqa-theme .theqa-home-author-card {
    border: 1px solid var(--theqa-secondary);
    background: var(--theqa-surface);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    color: inherit;
}
.theqa-theme .theqa-home-author-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    border-color: var(--theqa-primary);
}
.theqa-theme .theqa-home-author-avatar {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.25rem;
}
.theqa-theme .theqa-home-review-card__logo {
    object-fit: contain;
    background: #fff;
}
.theqa-theme .theqa-home-review-card__logo-placeholder {
    width: 64px;
    height: 64px;
    background: var(--theqa-secondary);
}
.theqa-theme .theqa-home-user-comment {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.theqa-theme .theqa-home-comparisons .list-group-item {
    background: var(--theqa-surface);
}
.theqa-theme .theqa-home-comparisons a {
    color: var(--theqa-text);
}
.theqa-theme .theqa-home-comparisons a:hover {
    color: var(--theqa-primary);
}
html[data-bs-theme="dark"] .theqa-theme .theqa-home-scam-item {
    background-color: var(--theqa-row-muted);
}
html[data-bs-theme="dark"] .theqa-theme .theqa-home-scam-item__icon {
    background: rgba(254, 205, 211, 0.15);
}
html[data-bs-theme="dark"] .theqa-theme .theqa-home-user-comment {
    box-shadow: none;
    border: 1px solid var(--theqa-border);
}

