:root{
  --bg0:#060912;
  --bg1:#0b1220;

  --card:#0e1628cc;
  --stroke:#ffffff1a;

  --text:#eaf0ff;
  --muted:#b8c1dd;
  --soft:#9aa6cc;

  --accent:#d6b36a;
  --accent2:#7c5cff;

  --shadow: 0 12px 38px rgba(0,0,0,.36);
  --radius: 18px;
  --max: 1080px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: "Cairo", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 20% 10%, #132042 0%, transparent 60%),
    radial-gradient(900px 600px at 80% 10%, #2a1f12 0%, transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  color:var(--text);
}

.bg{
  position:fixed; inset:0;
  background:
    radial-gradient(800px 500px at 30% 30%, rgba(214,179,106,.10), transparent 60%),
    radial-gradient(700px 500px at 80% 60%, rgba(124,92,255,.08), transparent 55%);
  pointer-events:none;
}

.container{width:min(var(--max), calc(100% - 32px)); margin-inline:auto;}

.topbar{
  position:sticky; top:0; z-index:30;
  backdrop-filter: blur(10px);
  background: rgba(5,8,16,.55);
  border-bottom:1px solid var(--stroke);
}
.topbar__inner{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 0; gap:12px;
}

.brand{display:flex; align-items:center; gap:10px}
.brand__dot{
  width:14px; height:14px; border-radius:999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(214,179,106,.12);
}
.brand__title{font-weight:900; letter-spacing:.3px}
.brand__sub{font-size:12px; color:var(--muted); margin-top:2px}

.actions{display:flex; gap:10px; align-items:center}

.btn{
  border:1px solid var(--stroke);
  background: transparent;
  color: var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
  transition: .15s ease;
}
.btn:hover{transform: translateY(-1px); border-color: rgba(214,179,106,.45)}
.btn--primary{
  background: linear-gradient(180deg, rgba(214,179,106,.22), rgba(214,179,106,.10));
  border-color: rgba(214,179,106,.45);
}
.btn--ghost{opacity:.95}

.card{
  background: var(--card);
  border:1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:18px;
  margin-top:18px;
}

.num{
  direction:ltr;
  unicode-bidi:bidi-override;
  font-family:"Inter","Cairo",system-ui,Arial,sans-serif;
  letter-spacing:.2px;
}

.hero{padding:22px}
.hero__wrap{display:flex; gap:18px; align-items:center;}

.avatar{
  width:128px; height:128px; aspect-ratio:1/1;
  border-radius:18px; overflow:hidden;
  border:1px solid rgba(214,179,106,.60);
  background: rgba(255,255,255,.06);
  box-shadow: 0 14px 28px rgba(0,0,0,.30);
  flex:0 0 auto;
  position:relative;
}
.avatar::after{
  content:"";
  position:absolute; inset:-1px;
  border-radius:18px;
  background:
    radial-gradient(140px 140px at 30% 20%, rgba(214,179,106,.28), transparent 60%),
    radial-gradient(160px 140px at 80% 80%, rgba(124,92,255,.14), transparent 60%);
  pointer-events:none;
}
.avatar img{
  width:100%; height:100%;
  object-fit:cover;
  object-position:50% 18%;
  display:block;
  position:relative;
  z-index:1;
}

.hero__name{font-size:34px; font-weight:900; line-height:1.15; letter-spacing:.2px;}
.hero__title{margin-top:8px; color:var(--accent); font-weight:900; font-size:18px;}
.hero__meta{
  margin-top:10px; color:var(--muted);
  display:flex; flex-wrap:wrap; gap:10px; font-size:14px;
}

.hero__cta{margin-top:14px; display:flex; flex-wrap:wrap; gap:10px;}

.chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--stroke);
  text-decoration:none;
  color:var(--text);
  background: rgba(255,255,255,.03);
  transition:.15s ease;
}
.chip:hover{border-color: rgba(214,179,106,.45); transform: translateY(-1px)}

.hero__tags{margin-top:12px; display:flex; flex-wrap:wrap; gap:8px;}
.tag{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
  color:var(--muted);
  padding:7px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:12.5px;
}

.highlights__grid{display:grid; grid-template-columns:repeat(4,1fr); gap:12px;}
.hi{
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:12px;
  background: rgba(255,255,255,.03);
}
.hi__k{color:var(--soft); font-weight:900; font-size:12.5px}
.hi__v{margin-top:6px; font-weight:900; font-size:15px}

.grid{display:grid; grid-template-columns:1fr 1fr; gap:18px;}

.h2{margin:0 0 10px 0; font-weight:900; font-size:18px; letter-spacing:.2px;}
.p{margin:0; color:var(--muted); line-height:1.85}

.sectionHead{display:flex; align-items:baseline; justify-content:space-between; gap:12px;}
.sectionHead__hint{color:var(--soft); font-size:12.5px; font-weight:800;}

.list{display:flex; flex-direction:column; gap:10px;}
.group{
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:12px;
  background: rgba(255,255,255,.03);
}
.group__title{font-weight:900; color:var(--text); margin-bottom:8px;}
.group__items{color:var(--muted); line-height:1.9}

.note{
  margin-top:10px;
  font-size:12.5px;
  color:var(--soft);
  padding:10px 12px;
  border:1px dashed rgba(214,179,106,.35);
  border-radius:14px;
  background: rgba(214,179,106,.06);
}

.timeline{display:flex; flex-direction:column; gap:12px;}
.item{
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:14px;
  background: rgba(255,255,255,.03);
}
.item__head{display:flex; flex-wrap:wrap; align-items:baseline; gap:10px;}
.item__role{font-weight:900}
.item__org{color:var(--accent); font-weight:900}
.item__date{color:var(--muted); font-size:13px; font-weight:800}
.item__bullets{margin:10px 0 0 0; padding-inline-start:22px; color:var(--muted); line-height:1.9}

.kv{display:grid; grid-template-columns:1fr; gap:10px;}
.kv__row{
  display:flex; justify-content:space-between; gap:12px;
  padding:10px 12px;
  border:1px solid var(--stroke);
  border-radius:14px;
  background: rgba(255,255,255,.03);
}
.kv__k{color:var(--muted); font-weight:900}
.kv__v{font-weight:900}

.badges{display:flex; flex-wrap:wrap; gap:10px;}
.badge{
  border:1px solid var(--stroke);
  border-radius:999px;
  padding:10px 12px;
  background: rgba(255,255,255,.03);
  color:var(--muted);
  font-weight:900;
}

.cards{display:grid; grid-template-columns:1fr 1fr; gap:12px;}
.small{
  border:1px solid var(--stroke);
  border-radius:14px;
  padding:14px;
  background: rgba(255,255,255,.03);
}
.small__title{font-weight:900; margin-bottom:8px}
.small__desc{color:var(--muted); line-height:1.9; margin:0}
.small__meta{margin-top:10px; color:var(--soft); font-size:12.5px; font-weight:800}

.bullets{margin:0; padding-inline-start:22px; color:var(--muted); line-height:1.95;}

.footer{margin-bottom:26px}
.footer__inner{
  border-top:1px solid var(--stroke);
  padding:18px 0 0 0;
  color:var(--soft);
  font-size:13px;
  font-weight:800;
}

@media (max-width: 980px){
  .grid{grid-template-columns:1fr}
  .cards{grid-template-columns:1fr}
  .highlights__grid{grid-template-columns:1fr 1fr}
}
@media (max-width: 900px){
  .hero__wrap{flex-direction:column; align-items:flex-start;}
  .avatar{width:104px; height:104px; border-radius:16px}
  .hero__name{font-size:28px}
}
@media (max-width: 520px){
  .highlights__grid{grid-template-columns:1fr}
}

/* ========================== */
/* ✅ PRINT (PDF) — BLACK PRO  */
/* ========================== */
@media print{
  @page{
    size: A4;
    margin: 10mm;
  }

  html, body{
    background:#fff !important;
    color:#000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ✅ توحيد لون النص */
  body, p, li, div, span, strong, em, h1, h2, h3, h4, h5, h6,
  .p, .group__items, .item__date, .item__bullets, .hi__k, .hi__v,
  .kv__k, .kv__v, .small__desc, .small__meta, .sectionHead__hint, .note{
    color:#000 !important;
  }

  .bg{display:none !important;}
  .no-print{display:none !important;}
  .container{width:auto !important; margin:0 !important;}

  *{
    box-shadow:none !important;
    text-shadow:none !important;
  }

  /* ✅ منع التقطيع */
  .card, .group, .item, .small, .kv__row, .hi{
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ✅ إطار أسود واضح */
  .card{
    background:#fff !important;
    border: 2px solid #000 !important;
    border-radius: 10px !important;
    padding: 10px !important;
    margin-top: 8px !important;
  }

  .h2{
    font-size: 14px !important;
    margin: 0 0 8px 0 !important;
    padding: 7px 9px !important;
    background:#f2f2f2 !important;
    border: 1.5px solid #000 !important;
    border-radius: 8px !important;
  }

  .p{
    font-size: 12.3px !important;
    line-height: 1.7 !important;
  }

  /* ✅ ضغط المسافات حتى تناسب A4 */
  .grid{gap:10px !important;}
  .cards{gap:10px !important;}
  .timeline{gap:10px !important;}
  .highlights__grid{gap:8px !important;}
  .hi{padding:8px !important;}

  /* ✅ Fix: الصورة كانت تصير بالوسط بالـ PDF */
  .hero{padding:10px !important;}

  .hero__wrap{
    display:grid !important;
    grid-template-columns: 92px 1fr !important;
    column-gap:10px !important;
    align-items:start !important;
  }

  /* =============================== */
  /* ✅ RTL FIX (ARABIC PDF) — FINAL */
  /* =============================== */

  html[dir="rtl"] body{
    direction: rtl !important;
    text-align: right !important;
  }

  /* بالعربي نخليها: صورة | محتوى (بدون مساحات فاضية) */
  html[dir="rtl"] .hero__wrap{
    grid-template-columns: 90px 1fr !important; /* صورة | محتوى */
    column-gap:12px !important;
    align-items:start !important;
  }

  html[dir="rtl"] .avatar{
    justify-self:start !important; /* تبقى على بداية السطر (يمين الصفحة بالـ RTL) */
    align-self:start !important;
    margin:0 !important;
  }

  html[dir="rtl"] .hero__main{
    text-align:right !important;
  }

  /* الميتا بالعربي نخليها سطور حتى ما تتراص غلط */
  html[dir="rtl"] .hero__meta{
    display:block !important;
    gap:0 !important;
  }

  /* رقم التلفون يبقى LTR حتى ما ينقلب */
  html[dir="rtl"] .num{
    direction:ltr !important;
    unicode-bidi:bidi-override !important;
  }

  /* التاغات تبقى صفوف مو عمود */
  html[dir="rtl"] .hero__tags{
    display:flex !important;
    flex-wrap:wrap !important;
    gap:6px !important;
    margin-top:8px !important;
  }

  .avatar{
    width: 88px !important;
    height: 88px !important;
    border-radius: 10px !important;
    border: 2px solid #000 !important;
    background:#fff !important;

    justify-self:start !important;
    align-self:start !important;
    margin:0 !important;
  }

  .avatar::after{display:none !important;}

  .hero__name{font-size: 20px !important; line-height:1.15 !important;}
  .hero__title{font-size: 13px !important; margin-top: 3px !important;}
  .hero__meta{margin-top: 5px !important; font-size: 11.8px !important;}

  /* ✅ كروت داخلية */
  .group, .item, .small, .kv__row, .hi{
    background:#fff !important;
    border: 1px solid #000 !important;
    border-radius: 8px !important;
    padding: 9px !important;
  }

  .hi__k{font-size:11px !important;}
  .hi__v{font-size:12px !important;}

  .item__date{font-size: 11.5px !important;}
  .item__bullets{
    margin-top: 6px !important;
    font-size: 12.2px !important;
    line-height: 1.65 !important;
  }

  .group__items{
    font-size: 12.2px !important;
    line-height: 1.65 !important;
  }

  .badge, .tag{
    background:#fff !important;
    border:1px solid #000 !important;
    color:#000 !important;
  }

  a{color:#000 !important; text-decoration:none !important;}
}
