/* =====================================================
   ألوان هوية مجموعة الباندا — غيّرها من هنا فقط
   ===================================================== */
:root {
  --brand: #FACC15;        /* أصفر الباندا (الأزرار) */
  --brand-dark: #EAB308;   /* عند المرور بالماوس */
  --brand-soft: #FEF3C7;   /* خلفيات صفراء فاتحة */
  --ink: #121212;          /* الأسود: النص والإطارات */
  --bg: #FFFBEF;           /* الخلفية الكريمية */
  --card: #FFFFFF;
  --muted: #55524A;
  --line: #121212;         /* إطارات سوداء */
  --soft-line: #ECE4CB;
  --shadow: 4px 4px 0 #121212;   /* الظل الصلب */

  /* خلفية أيقونة كل خدمة */
  --c1-soft: #FEF3C7;   /* تلخيص واختبار */
  --c2-soft: #E4ECF7;   /* تنسيق */
  --c3-soft: #FBE6D8;   /* تدقيق */

  --ok: #15803D; --ok-soft: #DCFCE7;
  --err: #B42318; --err-soft: #FDE7E4;
  --font: "Tajawal", system-ui, sans-serif;
  --font-display: "Cairo", "Tajawal", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 17px; color: var(--ink); background: var(--bg); line-height: 1.75; }
a { color: var(--ink); text-decoration-color: var(--brand); text-decoration-thickness: 3px; text-underline-offset: 4px; }
a:hover { color: #000; text-decoration-color: var(--brand-dark); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 900; line-height: 1.35; margin: 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 28px; padding-bottom: 48px; min-height: 70vh; }
.muted { color: var(--muted); }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.inline { display: inline; margin: 0; }

/* الهيدر */
.topbar { background: var(--bg); border-bottom: 2px solid var(--ink); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 900; font-size: 22px; }
.brand img { display: block; }
.brand small { background: var(--ink); color: var(--brand); font-size: 13px; padding: 1px 10px; border-radius: 999px; font-family: var(--font); font-weight: 700; }
.nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nav > a:not(.btn) { text-decoration: none; font-weight: 700; padding: 10px 4px; }
.credits { background: var(--ink); color: var(--brand); padding: 4px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.linkbtn { background: none; border: 0; font: inherit; font-weight: 700; color: var(--muted); cursor: pointer; padding: 10px 4px; }
.demo-bar { background: var(--ink); color: var(--brand); text-align: center; font-size: 14px; font-weight: 700; padding: 8px 16px; }

/* الأزرار — نفس ستايل panda.com.ly */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--brand); color: var(--ink); border: 2px solid var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: 11px 22px; min-height: 48px; font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; transition: transform .08s, box-shadow .08s; }
.btn:hover { background: var(--brand-dark); color: var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; min-height: 40px; font-size: 15px; box-shadow: 3px 3px 0 var(--ink); }
.btn-lg { width: 100%; padding: 14px; font-size: 18px; }
.btn-ghost { background: var(--card); }
.btn-ghost:hover { background: var(--brand-soft); }

/* الرئيسية */
.hero { text-align: center; padding: 16px 0 32px; }
.hero .pill { display: inline-block; background: var(--ink); color: var(--brand); border-radius: 999px; padding: 4px 16px; font-weight: 700; font-size: 15px; margin-bottom: 14px; }
.hero h1 { font-size: clamp(30px, 6vw, 48px); }
.hero h1 mark { background: none; color: inherit; box-shadow: inset 0 -0.28em 0 var(--brand); }
.hero p { margin: 8px 0 0; color: var(--muted); font-size: 19px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.card { background: var(--card); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); border-radius: 22px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 23px; }
.card p { margin: 0; color: #3D3A33; }
.card ul { margin: 0; padding: 0 20px 0 0; color: #2A2823; }
.card ul li::marker { color: var(--brand-dark); }
.card-btn { margin-top: auto; }
.card-icon { width: 56px; height: 56px; border-radius: 16px; border: 2px solid var(--ink); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; color: var(--ink); }
.c1 .card-icon { background: var(--c1-soft); }
.c2 .card-icon { background: var(--c2-soft); }
.c3 .card-icon { background: var(--c3-soft); }

.panel { margin-top: 40px; background: var(--card); border: 2px solid var(--ink); border-radius: 22px; padding: 24px; }
.panel h2 { font-size: 23px; margin-bottom: 8px; }
.jobs { list-style: none; margin: 0; padding: 0; }
.jobs li + li { border-top: 1.5px dashed var(--soft-line); }
.jobs a { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 14px 0; text-decoration: none; color: var(--ink); }
.jobs .muted { font-size: 15px; }

/* النماذج */
.auth { max-width: 440px; margin: 16px auto; background: var(--card); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); border-radius: 22px; padding: 28px; }
.auth h1 { font-size: 30px; margin-bottom: 4px; }
.form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.form label { font-weight: 700; }
.form input[type=text], .form input[type=email], .form input[type=password], .form select {
  font: inherit; padding: 11px 14px; min-height: 50px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); width: 100%;
}
.form input:focus, .form select:focus, .btn:focus-visible, .opt:focus-visible, .drop:focus-within, .check:focus-within { outline: 3px solid var(--brand-dark); outline-offset: 2px; }
.form .btn { margin-top: 10px; }
fieldset { border: 0; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 800; margin-bottom: 8px; font-size: 18px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 2px solid var(--soft-line); border-radius: 14px; cursor: pointer; font-weight: 600 !important; background: #fff; }
.check input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--ink); flex: 0 0 auto; }
.check:has(input:checked) { border-color: var(--ink); background: var(--brand-soft); }

.alert { padding: 12px 16px; border-radius: 14px; margin: 10px 0; border: 2px solid currentColor; font-weight: 600; }
.alert-err { background: var(--err-soft); color: #7A1A12; }
.alert-ok { background: var(--ok-soft); color: #14532D; }
.alert-info { background: var(--brand-soft); color: var(--ink); }

/* صفحة الخدمة */
.back { margin: 0 0 14px; }
.back a { font-weight: 700; }
.service, .result { max-width: 780px; margin: 0 auto; background: var(--card); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); border-radius: 22px; padding: 26px; }
.service-head { display: flex; gap: 16px; align-items: flex-start; }
.service-head h1 { font-size: 28px; }
.service-head p { margin: 4px 0 0; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; border: 2.5px dashed var(--ink); border-radius: 18px; padding: 32px 16px; background: var(--bg); cursor: pointer; color: var(--ink); font-weight: 400 !important; }
.drop strong { font-size: 18px; }
.drop.has-file { border-style: solid; background: var(--brand-soft); }
.drop.drag { background: var(--brand-soft); }
.cost { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; background: var(--bg); border: 2px dashed var(--soft-line); border-radius: 14px; padding: 12px 14px; margin-top: 6px; }

.loading { position: fixed; inset: 0; background: rgba(18,18,18,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.loading[hidden] { display: none; }
.loading-box { background: var(--card); border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); border-radius: 22px; padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 340px; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid var(--brand-soft); border-top-color: var(--ink); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .btn { transition: none; } }

/* النتيجة */
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.result h1 { font-size: 28px; margin-top: 8px; }
.result-head p { margin: 2px 0 0; }
.tag { display: inline-block; background: var(--ink); color: var(--brand); padding: 3px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--brand-soft); border: 2px solid var(--ink); border-radius: 14px; padding: 12px; margin-bottom: 16px; font-weight: 700; }
.share input { flex: 1 1 220px; min-width: 0; font: inherit; font-size: 14px; font-weight: 400; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
.block { border-top: 2px dashed var(--soft-line); padding-top: 16px; margin-top: 16px; }
.block > h2 { font-size: 22px; margin-bottom: 6px; }
.prose h2, .prose h3, .prose h4 { font-size: 19px; margin: 14px 0 4px; }
.prose p { margin: 6px 0; }
.prose ul { margin: 6px 0; padding: 0 22px 0 0; }
.notes { margin-top: 20px; background: var(--brand-soft); border: 2px solid var(--ink); border-radius: 16px; padding: 16px 18px; }
.notes h2 { font-size: 19px; }
.notes ul { margin: 6px 0 0; padding: 0 20px 0 0; }
.cta-box { margin-top: 24px; background: var(--ink); color: #fff; border-radius: 18px; padding: 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.cta-box .btn { box-shadow: 3px 3px 0 var(--brand-dark); }

/* الاختبار */
.quiz { border-top: 2px dashed var(--soft-line); margin-top: 16px; padding-top: 16px; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.quiz-top h2 { font-size: 22px; }
.score { background: var(--brand); border: 2px solid var(--ink); color: var(--ink); border-radius: 999px; padding: 2px 16px; font-weight: 800; font-size: 16px; }
.q { background: var(--bg); border: 2px solid var(--soft-line); border-radius: 16px; padding: 16px; margin: 14px 0; }
.q-text { font-weight: 700; font-size: 18px; margin: 0 0 10px; }
.q-num { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--brand); align-items: center; justify-content: center; font-size: 15px; margin-left: 6px; }
.q-opts { display: flex; flex-direction: column; gap: 8px; }
.opt { text-align: right; font: inherit; font-size: 17px; padding: 11px 14px; min-height: 50px; border-radius: 12px; border: 2px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; }
.opt:hover:not(:disabled) { background: var(--brand-soft); }
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); color: #14532D; font-weight: 700; }
.opt.right::after { content: " ✓"; }
.opt.wrong { border-color: var(--err); background: var(--err-soft); color: #7A1A12; }
.opt.wrong::after { content: " ✗"; }
.q-explain { margin: 10px 0 0; padding: 10px 12px; background: #fff; border-radius: 12px; border-right: 4px solid var(--brand); color: #2A2823; }

.foot { text-align: center; color: var(--muted); font-size: 15px; padding: 24px 16px 32px; border-top: 2px solid var(--ink); }
.foot a { color: var(--muted); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .service, .result, .auth, .panel, .card { padding: 18px; border-radius: 18px; }
  .service-head { flex-direction: column; gap: 10px; }
}

/* اختيارُ الملف: زرٌّ عربيّ + اسمُ الملف. الحقلُ الحقيقيّ مخفيٌّ بصرياً لا display:none (آيفون يحتاجه حيّاً
   ليفتح المنتقي من الـlabel)، وبلا required */
.file-pick { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0; position: relative; }
.file-input-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.file-pick:focus-within .file-btn { outline: 3px solid var(--brand-dark); outline-offset: 2px; }
.form .file-btn { margin-top: 0; font-weight: 800 !important; }
.file-name { flex: 1 1 160px; min-width: 0; color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.file-name.chosen { color: var(--ink); font-weight: 700; }

/* أزرار التحميل في صفحة النتيجة: PDF أوّلاً */
.dl-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* لوحة الإدارة */
.admin { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }
.admin .panel { margin-top: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { text-align: right; padding: 8px 10px; border-bottom: 1.5px dashed var(--soft-line); vertical-align: middle; white-space: nowrap; }
.tbl th { font-weight: 800; border-bottom: 2px solid var(--ink); }
.tbl td.num, .tbl th.num { text-align: left; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 800; border-top: 2px solid var(--ink); border-bottom: 0; }
.credit-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.credit-form input[type=number] { width: 72px; font: inherit; padding: 6px 8px; min-height: 40px; border: 2px solid var(--ink); border-radius: 10px; }
.credit-form .btn { margin: 0; padding: 4px 12px; min-height: 40px; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=number] { width: 100px; font: inherit; padding: 8px 10px; min-height: 46px; border: 2px solid var(--ink); border-radius: 12px; }
.inline-form .btn { margin: 0; }
.pos { color: var(--ok); font-weight: 700; }
.neg { color: var(--err); font-weight: 700; }
.jobs .pending-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 14px 0; }
.jobs .pending .tag { font-size: 12px; margin-inline-start: 6px; }

/* جداول Markdown في النتيجة (مقارنات) — تتمرّر أفقياً على الجوّال بدل أن تكسر الصفحة */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 10px 0; }
.md-table { border-collapse: collapse; width: 100%; font-size: 15px; background: #fff; }
.md-table th, .md-table td { border: 1.5px solid var(--ink); padding: 8px 10px; text-align: start; vertical-align: top; }
.md-table th { background: var(--brand-soft); font-weight: 800; }
