/* =========================================================
   Arabian Board Unified System — Local Fonts (v2.4.0)
   خط Cairo مستضاف محلياً بدل Google Fonts CDN.
   الملف هو نفس الخط المتغير الرسمي (Cairo v3.130) بعد تثبيت محور
   الميلان slnt عند 0 (النسخة المنتصبة التي تخدمها Google)، مع إبقاء
   محور الوزن 200–1000 كما هو — فالأوزان 400/600/700/900 المستخدمة
   في البطاقات والشهادات تُرسَم بنفس المسارات تماماً بلا أي فرق بصري.
   الترخيص: SIL Open Font License 1.1 (assets/fonts/OFL.txt)
   ========================================================= */
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 200 1000;
    font-display: swap;
    src: url('fonts/Cairo-variable.woff2') format('woff2-variations'),
         url('fonts/Cairo-variable.woff2') format('woff2');
}

/* =========================================================
   Arabian Board Unified System — Frontend Styles
   ========================================================= */

:root {
    --abu-primary: #8b201d;
    --abu-primary-dark: #6e1917;
    --abu-primary-light: #a52a2a;
    --abu-bg-soft: #f9f7f6;
    --abu-border: #eee;
    --abu-radius: 14px;
}

.abu-reg-wrap, .abu-search-container, .abu-card-viewer, .abu-cert-wrapper,
.abu-cert-canvas, .abu-capture-area, .abu-bulk-card-wrap {
    direction: rtl !important;
    font-family: 'Cairo', sans-serif !important;
}

/* حماية إضافية ضد تعارض قوالب ووردبريس/محررات الصفحات مع تنسيقنا */
.abu-reg-wrap *, .abu-search-container *, .abu-card-viewer *, .abu-cert-wrapper * {
    box-sizing: border-box;
}

/* ---------- Alerts ---------- */
.abu-alert {
    max-width: 640px;
    margin: 0 auto 20px;
    padding: 15px 20px;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
}
.abu-alert-success { background: #e6f6ec; color: #1e7e42; border: 1px solid #bfe6cc; }
.abu-alert-error   { background: #fff2f1; color: #b3261e; border: 1px solid #f3c8c5; }

/* ---------- شعار أعلى نموذج التسجيل ---------- */
.abu-reg-logo { text-align: center; margin-bottom: 18px; }
.abu-reg-logo img { max-height: 72px; width: auto; display: inline-block; }

/* ---------- Registration Card ---------- */
.abu-reg-wrap { display: flex !important; justify-content: center; padding: 20px 10px 60px; }
.abu-reg-card {
    width: 100%;
    max-width: 640px;
    background: #fff !important;
    border-radius: var(--abu-radius);
    box-shadow: 0 20px 45px rgba(139,32,29,0.10), 0 2px 8px rgba(0,0,0,0.04);
    padding: 36px 34px;
    border-top: 5px solid var(--abu-primary);
    position: relative;
    z-index: 1;
}
.abu-reg-title { text-align: center; margin: 0 0 6px; font-size: 26px; font-weight: 900; color: #222; }
.abu-reg-sub   { text-align: center; margin: 0 0 26px; color: #777; font-size: 14px; }

/* ---------- شاشة النجاح المخصصة (بعد إرسال الطلب بنجاح) ---------- */
.abu-reg-card-success {
    background: #101b3d !important;
    border-top: 5px solid #16b364;
}
.abu-reg-success { text-align: center; padding: 18px 6px 10px; }
.abu-reg-success-emoji { font-size: 54px; line-height: 1; margin-bottom: 14px; }
.abu-reg-success-title { margin: 0 0 12px; font-size: 24px; font-weight: 900; color: #2ecc71; }
.abu-reg-success-desc { margin: 0 auto 26px; max-width: 440px; color: #cfd6e6; font-size: 15px; line-height: 1.9; }
.abu-reg-success-btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 10px;
    background: #2ecc71;
    color: #0d1730 !important;
    font-weight: 800;
    font-size: 14px;
    text-decoration: none !important;
    transition: opacity .15s ease;
}
.abu-reg-success-btn:hover { opacity: .85; }

/* ---------- Segmented Tabs ---------- */
.abu-tabs {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    background: var(--abu-bg-soft);
    padding: 6px;
    border-radius: 12px;
    margin-bottom: 28px;
}
.abu-tab {
    display: flex !important; flex-direction: column; align-items: center; gap: 4px;
    background: transparent; border: none; cursor: pointer;
    padding: 12px 6px; border-radius: 9px;
    font-family: 'Cairo', sans-serif; font-weight: 700; font-size: 13px;
    color: #777; transition: all .2s ease;
}
.abu-tab-icon { font-size: 20px; line-height: 1; }
.abu-tab:hover { color: var(--abu-primary); }
.abu-tab.active {
    background: var(--abu-primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(139,32,29,.25);
}

/* ---------- Fields ---------- */
.abu-field { margin-bottom: 18px; position: relative; z-index: 1; }
.abu-field label { display: block !important; font-weight: 700; margin-bottom: 8px; font-size: 14px; color: #333; }
.abu-field input[type="text"],
.abu-field input[type="tel"],
.abu-field input[type="date"],
.abu-field input[type="file"],
.abu-field select {
    display: block !important;
    width: 100% !important; padding: 12px 14px; border: 1.5px solid #ececec; border-radius: 10px;
    background-color: var(--abu-bg-soft) !important; font-family: 'Cairo', sans-serif; font-size: 14px;
    color: #222 !important; box-sizing: border-box; transition: border-color .2s;
    position: relative; z-index: 2; opacity: 1 !important; visibility: visible !important;
    -webkit-appearance: auto; appearance: auto;
}
.abu-field input:focus, .abu-field select:focus {
    outline: none; border-color: var(--abu-primary); background-color: #fff !important;
}
.abu-hint { font-size: 12.5px; color: #888; margin-top: 6px; }
#abu-cropper-box { margin-top: 14px; display: none; }
#abu-cropper-box:has(.cr-boundary) { display: block; }

.abu-submit-btn {
    background: var(--abu-primary); color: #fff; width: 100%; border: none;
    padding: 15px; cursor: pointer; border-radius: 10px; font-weight: 800;
    font-family: 'Cairo', sans-serif; font-size: 15px; transition: .25s;
    box-shadow: 0 8px 18px rgba(139,32,29,.22);
}
.abu-submit-btn:hover { background: var(--abu-primary-light); transform: translateY(-2px); }
.abu-submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ---------- Search ---------- */
.abu-search-container { padding: 40px 15px; }
.abu-search-box {
    max-width: 640px; margin: 0 auto; background: #fff; padding: 34px;
    border-radius: var(--abu-radius); box-shadow: 0 18px 40px rgba(0,0,0,.06);
    text-align: center; border-top: 5px solid var(--abu-primary);
}
.abu-search-box h4 { margin: 0 0 8px; font-size: 21px; font-weight: 900; color: #222; }
.abu-search-hint { font-size: 13.5px; color: #777; margin-bottom: 22px; line-height: 1.7; }
.abu-search-row { display: flex; gap: 10px; }
.abu-search-row input {
    flex: 1; padding: 14px 18px; border-radius: 12px; border: 2px solid var(--abu-primary);
    font-family: 'Cairo', sans-serif; font-size: 14px; outline: none;
}
.abu-search-row button {
    background: var(--abu-primary); color: #fff; border: none; padding: 0 26px;
    border-radius: 12px; font-weight: 800; cursor: pointer; font-family: 'Cairo', sans-serif;
}
.abu-search-row button:hover { background: var(--abu-primary-light); }

.abu-result-block { max-width: 950px; margin: 30px auto 0; }
.abu-result-label {
    display: inline-block; background: #222; color: #fff; padding: 6px 18px;
    border-radius: 20px 20px 0 0; font-size: 13px; font-weight: 700;
}

/* ---------- ID Card ---------- */
.abu-card-viewer { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; margin-bottom: 40px; }
.abu-card-header { text-align: center; padding: 15px; }
.abu-card-header img { max-height: 90px; margin-bottom: 8px; }
.abu-card-header h3 { margin: 0; font-size: 21px; }

.abu-card-scale-wrapper {
    position: relative; width: 100%; max-width: 950px; aspect-ratio: 950 / 550;
    margin: 16px 0; border-radius: 12px; overflow: hidden; box-shadow: 0 14px 34px rgba(0,0,0,.16);
}
.abu-capture-area {
    width: 950px; height: 550px; position: absolute; top: 0; left: 0; transform-origin: top left;
    background: #fff; overflow: hidden;
}
.abu-card-bg { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.abu-card-photo { position: absolute; border-radius: 50%; background-position: center; background-size: cover; }
.abu-card-status, .abu-card-name, .abu-card-jobtitle {
    position: absolute; right: 30px; width: 550px; text-align: center; direction: rtl;
}
.abu-card-status span { display: inline-block; max-width: 100%; font-weight: bold; white-space: nowrap; line-height: 1.7; overflow: visible; }
.abu-card-name div { font-weight: 800; line-height: 1.2; }
.abu-card-jobtitle div { font-weight: 700; line-height: 1.4; }
.abu-card-code, .abu-card-nat, .abu-card-end { position: absolute; white-space: nowrap; line-height: 1.4; }

.abu-card-footer { width: 100%; max-width: 950px; text-align: center; padding: 24px; background: #f8f9fa; border-radius: 15px; margin-top: 16px; }
.abu-download-btn { width: auto; padding: 12px 50px; font-size: 16px; }
.abu-card-footer p { margin-top: 12px; color: #666; }

/* ---------- Certificate ---------- */
.abu-cert-wrapper { width: 100%; display: flex; flex-direction: column; align-items: center; }
.abu-cert-canvas { position: relative; width: 1123px; height: 794px; background: #fff; transform-origin: top center; overflow: hidden; box-shadow: 0 0 20px rgba(0,0,0,0.1); }
.abu-cert-scale { transform: scale(0.65); margin-bottom: -280px; }
@media (max-width: 768px) { .abu-cert-scale { transform: scale(0.35); margin-bottom: -520px; } }
.abu-cert-bg { width: 1123px; height: 794px; position: absolute; z-index: 1; top: 0; left: 0; }
.abu-cert-layer { position: relative; z-index: 50; width: 1123px; height: 794px; pointer-events: none; }
.abu-cert-student { position: absolute; top: 286px; width: 100%; font-size: 58px; font-weight: 900; color: #444; text-align: center; line-height: 1.25; }
.abu-cert-course  { position: absolute; top: 420px; width: 100%; font-size: 32px; font-weight: 700; color: #444; text-align: center; line-height: 1.3; }
.abu-cert-coop    { position: absolute; top: 468px; width: 100%; font-size: 25px; font-weight: 600; color: #666; text-align: center; line-height: 1.3; }
.abu-cert-meta    { position: absolute; top: 510px; width: 100%; font-size: 18px; font-weight: bold; color: #c15f55; text-align: center; line-height: 1.4; }
.abu-cert-trainer-box { position: absolute; bottom: 135px; right: 240px; width: 280px; text-align: center; }
.abu-cert-layer * { line-height: 1.35; }
.abu-cert-t-title { font-size: 16px; color: #9f7e55; font-weight: 500; margin-bottom: 5px; display: block; line-height: 1.4; }
.abu-cert-t-name  { font-size: 20px; font-weight: 700; color: #034070; line-height: 1.4; }
.abu-cert-verid   { position: absolute; bottom: 20px; left: 20px; font-size: 16px; color: #555; background: rgba(255,255,255,.7); padding: 5px 15px; border-radius: 5px; border: 1px solid #fff; }
.abu-cert-qr      { position: absolute; bottom: 60px; left: 76px; width: 100px; height: 100px; background: rgba(255,255,255,.7); padding: 5px; border-radius: 5px; border: 1px solid #fff; }
.abu-cert-qr img  { width: 100%; height: 100%; }
.abu-cert-dl-btn  { width: auto; padding: 12px 35px; margin: 30px 0; }

@media (max-width: 640px) {
    .abu-reg-card { padding: 26px 18px; }
    .abu-tabs { grid-template-columns: 1fr; }
    .abu-search-row { flex-direction: column; }
    .abu-search-row button { padding: 14px; }
}


/* =========================================================
   ABU v2.0.0 — SELECT fields fix (fully scoped)
   يصلح قص النص الرأسي داخل كل حقول select في نماذج الإضافة
   (الجنسية، اختيار الدورة، الدفعة، نموذج الشهادة، نموذج المدرب المحترف)
   محصور بالكامل داخل Namespace الإضافة — لا يؤثر على القالب أو
   WooCommerce أو Elementor أو أي إضافة أخرى.
   ========================================================= */
.abu-reg-wrap select,
.abu-search-container select,
.abu-verify-wrap select,
.abu-form select,
.abu-registration-wrapper select,
.abu-field select {
    display: block !important;
    width: 100% !important;
    height: 60px !important;
    min-height: 60px !important;
    max-height: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 16px !important;
    line-height: normal !important;
    font-size: 16px !important;
    font-family: 'Cairo', sans-serif !important;
    font-weight: 400 !important;
    color: #333 !important;
    background-color: #fff !important;
    overflow: visible !important;
    visibility: visible !important;
    opacity: 1 !important;
    vertical-align: middle !important;
    -webkit-appearance: auto !important;
    -moz-appearance: auto !important;
    appearance: auto !important;
}
.abu-reg-wrap select:focus,
.abu-field select:focus {
    outline: none;
    border-color: var(--abu-primary) !important;
}
.abu-reg-wrap select option,
.abu-search-container select option,
.abu-verify-wrap select option,
.abu-form select option,
.abu-field select option {
    color: #222 !important;
    background-color: #fff !important;
    font-size: 16px !important;
    line-height: normal !important;
}
html[dir="rtl"] .abu-reg-wrap select,
html[dir="rtl"] .abu-search-container select,
html[dir="rtl"] .abu-verify-wrap select,
html[dir="rtl"] .abu-form select,
html[dir="rtl"] .abu-field select,
.abu-reg-wrap[dir="rtl"] select {
    direction: rtl !important;
    text-align: right !important;
    text-align-last: right !important;
}

/* حقل الدفعة (Cohort) داخل نموذج التسجيل */
.abu-cohort-field label { display: block !important; font-weight: 700; margin-bottom: 8px; font-size: 14px; color: #333; }

/* =========================================================
   ABU v2.0.0 — إصلاح قص كلمة "العضو" في البطاقة
   ضمان مساحة رأسية كافية لحروف الخط العربي النازلة دون
   أي ارتفاع ثابت يقص النص.
   ========================================================= */
.abu-card-status { overflow: visible !important; height: auto !important; }
.abu-card-status span {
    display: inline-block;
    max-width: 100%;
    font-weight: bold;
    white-space: nowrap;
    line-height: 1.9 !important;
    padding-bottom: 0.12em;
    overflow: visible !important;
}
.abu-card-name, .abu-card-jobtitle { overflow: visible !important; }

/* =========================================================
   ABU v2.0.0 — صفحة التحقق العامة الموحدة [abu_verify]
   ========================================================= */
.abu-verify-wrap { max-width: 720px; margin: 0 auto; padding: 30px 15px 60px; direction: rtl; font-family: 'Cairo', sans-serif; }
.abu-verify-box {
    background: #fff; padding: 30px; border-radius: 14px; text-align: center;
    box-shadow: 0 14px 34px rgba(0,0,0,.07); border-top: 5px solid var(--abu-primary, #8b201d);
}
.abu-verify-title { margin: 0 0 8px; font-size: 21px; font-weight: 900; color: #222; }
.abu-verify-hint { font-size: 13.5px; color: #777; margin-bottom: 20px; line-height: 1.7; }
.abu-verify-wrap .abu-search-row { display: flex; gap: 10px; }
.abu-verify-wrap .abu-search-row input {
    flex: 1; padding: 14px 18px; border-radius: 12px; border: 2px solid var(--abu-primary, #8b201d);
    font-family: 'Cairo', sans-serif; font-size: 14px; outline: none; direction: ltr; text-align: center;
}
.abu-verify-wrap .abu-search-row button {
    background: var(--abu-primary, #8b201d); color: #fff; border: none; padding: 0 26px;
    border-radius: 12px; font-weight: 800; cursor: pointer; font-family: 'Cairo', sans-serif;
}
.abu-verify-result { background: #fff; margin-top: 22px; padding: 26px; border-radius: 14px; box-shadow: 0 10px 26px rgba(0,0,0,.06); }
.abu-verify-status { font-size: 18px; font-weight: 900; margin-bottom: 16px; text-align: center; }
.abu-verify-table { width: 100%; border-collapse: collapse; }
.abu-verify-table th, .abu-verify-table td { padding: 11px 10px; border-bottom: 1px solid #f1f1f1; font-size: 14px; text-align: right; }
.abu-verify-table th { color: #8b201d; width: 160px; font-weight: 800; background: #faf7f6; }
.abu-verify-open { text-align: center; margin: 18px 0 0; }
.abu-verify-open a { color: #8b201d; font-weight: 800; text-decoration: none; }
.abu-verify-open a:hover { text-decoration: underline; }
@media (max-width: 600px) {
    .abu-verify-wrap .abu-search-row { flex-direction: column; }
    .abu-verify-wrap .abu-search-row button { padding: 14px; }
    .abu-verify-table th { width: 120px; }
}

/* =========================================================
   v2.4.0 — الصفحة الشخصية للمنتسب [abu_person_portal]
   ========================================================= */
.abu-portal {
    direction: rtl !important;
    font-family: 'Cairo', sans-serif !important;
    max-width: 980px;
    margin: 30px auto;
    padding: 0 14px;
}
.abu-portal-header {
    display: flex;
    gap: 22px;
    align-items: center;
    background: linear-gradient(135deg, var(--abu-primary) 0%, var(--abu-primary-dark) 100%);
    color: #fff;
    border-radius: var(--abu-radius);
    padding: 24px;
    box-shadow: 0 6px 22px rgba(139, 32, 29, .22);
}
.abu-portal-photo img,
.abu-portal-photo-empty {
    width: 122px;
    height: 122px;
    border-radius: 50%; /* v2.5.2 — دائرية لتوافق شكل البطاقات وصندوق الشخص الموحد */
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, .85);
    background: rgba(255, 255, 255, .15);
    display: block;
}
.abu-portal-photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 46px;
    border-style: dashed;
}
.abu-portal-identity { flex: 1; min-width: 0; }
.abu-portal-identity h2 {
    margin: 0 0 6px;
    font-size: 25px;
    color: #fff;
    line-height: 1.3;
}
.abu-portal-code {
    font-weight: 900;
    letter-spacing: 2px;
    font-size: 15px;
    opacity: .92;
    margin-bottom: 10px;
}
.abu-portal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 13.5px;
    opacity: .95;
}
.abu-portal-badges {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.abu-portal-badge {
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 12.5px;
    font-weight: 700;
}
.abu-portal-codes {
    background: #fff;
    border: 1px solid var(--abu-border);
    border-radius: var(--abu-radius);
    padding: 18px 20px;
    margin: 22px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
.abu-portal-codes h3 { margin: 0 0 12px; font-size: 17px; color: var(--abu-primary); }
.abu-portal-codes table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.abu-portal-codes th,
.abu-portal-codes td { padding: 9px 10px; border-bottom: 1px solid #f2eeee; text-align: right; }
.abu-portal-codes th { background: var(--abu-bg-soft); font-weight: 700; color: #555; }
.abu-portal-codes code {
    background: var(--abu-bg-soft);
    color: var(--abu-primary);
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 5px;
    direction: ltr;
    display: inline-block;
}
.abu-portal-note {
    text-align: center;
    color: #888;
    font-size: 12.5px;
    margin: 26px 0 10px;
}
@media (max-width: 640px) {
    .abu-portal-header { flex-direction: column; text-align: center; }
    .abu-portal-meta,
    .abu-portal-badges { justify-content: center; }
    .abu-portal-codes { padding: 14px; }
    .abu-portal-codes th, .abu-portal-codes td { padding: 7px 5px; font-size: 12.5px; }
}

/* ---- v2.5.0 — لوحة حالة العضوية والتجديد داخل الصفحة الشخصية ---- */
.abu-portal-renew {
    background: #fff;
    border: 1px solid var(--abu-border);
    border-radius: var(--abu-radius);
    padding: 18px 20px;
    margin: 22px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
.abu-portal-renew h3 { margin: 0 0 14px; font-size: 17px; color: var(--abu-primary); }
.abu-renew-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #f4efef;
}
.abu-renew-row:last-of-type { border-bottom: 0; }
.abu-renew-info { flex: 1; min-width: 200px; font-size: 14px; }
.abu-renew-info code {
    background: var(--abu-bg-soft);
    color: var(--abu-primary);
    padding: 2px 8px;
    border-radius: 5px;
    direction: ltr;
    display: inline-block;
    font-size: 12.5px;
}
.abu-renew-state { font-size: 13px; font-weight: 700; margin-top: 4px; }
.abu-renew-btn {
    background: linear-gradient(135deg, #1a7f37 0%, #146c2e 100%);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 11px 22px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.abu-renew-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(26, 127, 55, .3); }
.abu-renew-ok { font-size: 13px; color: #777; }
.abu-portal-email {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e8dede;
}
.abu-portal-email label { display: block; font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.abu-portal-email-row { display: flex; gap: 8px; flex-wrap: wrap; }
.abu-portal-email-row input {
    flex: 1;
    min-width: 220px;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    direction: ltr;
    text-align: left;
}
.abu-portal-email-row button {
    background: var(--abu-primary);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 9px 24px;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}
@media (max-width: 640px) {
    .abu-renew-row { flex-direction: column; align-items: stretch; }
    .abu-renew-btn { width: 100%; }
}

/* ==========================================================
 *  v2.7.0 — رسالة رفض الحقل (ألقاب / لغة غير عربية)
 * ========================================================== */
.abu-reg-wrap .abu-invalid-msg {
    display: none;
    color: #b32d2e;
    font-size: 12.5px;
    font-weight: 700;
    margin-top: 6px;
    line-height: 1.7;
}
