:root{
  --bg:#0b1020;
  --panel:#0f1730;
  --card:#121c3a;
  --text:#eaf0ff;
  --muted:#a9b7e6;
  --brand:#6ee7ff;
  --brand2:#a78bfa;
  --ok:#34d399;
  --warn:#fbbf24;
  --bad:#fb7185;
  --border:rgba(255,255,255,.10);
  --shadow: 0 16px 40px rgba(0,0,0,.35);
  --radius:18px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background:
    radial-gradient(800px 500px at 15% 10%, rgba(110,231,255,.12), transparent 60%),
    radial-gradient(900px 600px at 85% 15%, rgba(167,139,250,.12), transparent 65%),
    radial-gradient(800px 600px at 50% 95%, rgba(52,211,153,.08), transparent 65%),
    var(--bg);
  color:var(--text);
  line-height:1.6;
}

a{color:inherit;text-decoration:none}
img{max-width:100%;display:block}
.container{max-width:1180px;margin:0 auto;padding:0 18px}


.hero{padding:54px 0 22px}
.hero-grid{display:grid;grid-template-columns: 1.15fr .85fr;gap:18px;align-items:stretch}
@media (max-width: 920px){.hero-grid{grid-template-columns:1fr}}
.panel{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card{padding:22px}
.h-title{font-size:44px;line-height:1.15;margin:0 0 10px}
@media (max-width: 520px){.h-title{font-size:34px}}
.h-sub{margin:0 0 18px;color:var(--muted);max-width:60ch}
.pills{display:flex;gap:10px;flex-wrap:wrap}
.pill{
  font-size:13px;color:var(--muted);
  padding:7px 10px;border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
}

.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:11px 14px;border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.05);
  color:var(--text);
  cursor:pointer;
}
.btn:hover{background: rgba(255,255,255,.08)}
.btn.primary{
  background: linear-gradient(135deg, rgba(110,231,255,.22), rgba(167,139,250,.22));
}
.btn.ok{background: rgba(52,211,153,.14)}
.btn.bad{background: rgba(251,113,133,.14)}
.btn:disabled{opacity:.55;cursor:not-allowed}


.section{padding:22px 0}
.section h2{margin:0 0 10px;font-size:24px}
.section p.lead{margin:0 0 14px;color:var(--muted)}

.toolbar{
  display:flex;gap:10px;flex-wrap:wrap;align-items:center;
  padding:12px;border-radius:16px;border:1px solid var(--border);
  background: rgba(255,255,255,.03);
}
.input, select, textarea{
  width:100%;
  padding:11px 12px;border-radius:14px;
  border:1px solid var(--border);
  background: rgba(10,14,28,.55);
  color:var(--text);
  outline:none;
}
.input::placeholder, textarea::placeholder{color: rgba(234,240,255,.45)}
.row{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media (max-width:720px){.row{grid-template-columns:1fr}}
.grid{
  display:grid;gap:12px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 980px){.grid{grid-template-columns: repeat(2, 1fr)}}
@media (max-width: 640px){.grid{grid-template-columns:1fr}}

.card{
  border:1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.03);
  overflow:hidden;
  box-shadow: 0 10px 22px rgba(0,0,0,.22);
}
.card .thumb{
  height:160px;
  background:
    radial-gradient(420px 250px at 20% 20%, rgba(110,231,255,.20), transparent 55%),
    radial-gradient(420px 250px at 80% 20%, rgba(167,139,250,.20), transparent 55%),
    rgba(255,255,255,.04);
  border-bottom:1px solid var(--border);
}
.card .content{padding:14px}
.card h3{margin:0 0 6px;font-size:18px}
.meta{display:flex;gap:8px;flex-wrap:wrap;color:var(--muted);font-size:13px}
.tag{
  padding:6px 9px;border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
}
.card .desc{margin:10px 0 0;color:rgba(234,240,255,.82);font-size:14px}

/* ✅ KPI Grid Modern (مرن في الديسك/تابلت/موبايل) */
.kpis{
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ✅ KPI Card */
.kpi{
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 12px 12px;

  display: flex;
  flex-direction: column;
  gap: 8px;

  align-items: center;
  text-align: center;

  box-shadow: 0 10px 22px rgba(0,0,0,.25);
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.kpi .label{
  font-size: 13px;
  color: var(--muted);
}

.kpi .value{
  font-size: 30px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.kpi:hover{
  transform: translateY(-2px);
  border-color: rgba(90,130,255,.35);
  background: rgba(90,130,255,.10);
}

/* ✅ Desktop only: وسط الكلام عموديًا + ارتفاع أنيق */
@media (min-width: 921px){
  .stats.kpis{
    height: 100%;
  }

  .stats.kpis .kpi{
    min-height: 140px;        /* عدّلها 130/150 حسب ذوقك */
    justify-content: center;  /* ✅ يوسّط المحتوى عموديًا */
    gap: 10px;
  }

  .stats.kpis .kpi .label{
    margin: 0;
  }

  .stats.kpis .kpi .value{
    margin: 0;
  }
}
/* ✅ Home stats panel padding */
.stats{
  padding: 12px;
}

.footer{
  margin-top:26px;
  padding:22px 0;
  border-top:1px solid var(--border);
  color:var(--muted);
}
.footer .frow{display:flex;gap:12px;flex-wrap:wrap;align-items:center;justify-content:space-between}
hr.sep{border:none;border-top:1px solid var(--border);margin:16px 0}

.toast{
  position:fixed;left:50%;bottom:16px;transform:translateX(-50%);
  background: rgba(10,14,28,.92);
  border:1px solid var(--border);
  border-radius: 14px;
  padding:10px 12px;
  max-width: min(560px, calc(100% - 20px));
  box-shadow: var(--shadow);
  display:none;
}
.toast.show{display:block}
.toast b{display:block}
.toast small{color:var(--muted)}

.modal-backdrop{
  position:fixed;inset:0;background:rgba(0,0,0,.55);
  display:none;align-items:center;justify-content:center;padding:18px;z-index:100;
}
.modal-backdrop.show{display:flex}
.modal{
  width:min(860px, 100%);
  border-radius: 20px;
  border:1px solid var(--border);
  background: rgba(15,23,48,.95);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal header{
  padding:14px 16px;border-bottom:1px solid var(--border);
  display:flex;align-items:center;justify-content:space-between;gap:10px
}
.modal header h3{margin:0;font-size:18px}
.modal .body{padding:16px}
.modal .actions{padding:12px 16px;border-top:1px solid var(--border);justify-content:flex-end}
.muted{color:var(--muted)}

.login-wrap{
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;         
  padding-bottom: 0;
}

.login-card{
  min-height: unset !important;  
  height: auto !important;
  display: block !important;     
  padding-bottom: 18px;
}
.login-card{
  min-height: 480px;            
  display: flex;
  flex-direction: column;
}
.input{
  text-align: center;
}
.input::placeholder{
  text-align: center;
}
.actions{
  display: flex;
}
.actions .btn{
  width: 100%;
}

.login-brand{
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 999;
}

.login-logo{
  width: 100px;
  height: 100px;
  object-fit: contain;
}

@media (max-width: 600px){
  .login-brand{
    top: 12px;
    left: 12px;
  }

  .login-logo{
    width: 60px;
    height: 60px;
  }
}

.login-logo{
  filter: drop-shadow(0 0 8px rgba(110,231,255,.6));
}

/* ===== Navbar RTL + Responsive ===== */
.nav{
  position:sticky;
  top:0;
  z-index:50;
  backdrop-filter: blur(10px);
  background: rgba(11,16,32,.65);
  border-bottom:1px solid var(--border);
}

.nav-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 0;
  position: relative;
}

/* اللوجو + الاسم */
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:800;
  letter-spacing:.2px;
  text-decoration:none;
  margin-right: 40px; 
}

.nav-logo{
  width:95px;
  height:85px;
  border-radius:10px;
  object-fit:cover;
}

/* روابط الديسكتوب */
.nav-links{
  display:flex;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
}

.nav-links a{
  padding:8px 10px;
  border-radius:12px;
  color:var(--muted);
  border:1px solid transparent;
  text-decoration:none;
  text-align:right;
}
.nav-links a:hover{
  color:var(--text);
  border-color:var(--border);
  background:rgba(255,255,255,.04);
}

/* زر الموبايل */
.nav-toggle{
  display:none;
  border:0;
  background: rgba(255,255,255,.08);
  color: inherit;
  padding:10px 12px;
  border-radius:12px;
  font-size:18px;
  cursor:pointer;
}

/* موبايل */
@media (max-width: 780px){
  .nav-inner{
    display:grid;
    grid-template-columns: auto 1fr auto;  /* زر | مساحة | لوجو */
    align-items:center;
    gap:16px;
    position: relative;
  }

  /* ✅ زر القائمة يمين */
  .nav-toggle{
    display:inline-flex;
    justify-self: end;
  }

  /* ✅ اللوجو شمال */
  .brand{
    justify-self: start;
    margin-right: 0;  /* يلغي الزق بتاع الديسكتوب */
  }

  /* ✅ القائمة المنسدلة */
  .nav-links{
    display:none;
    position:absolute;
    top: 95px;      /* حسب ارتفاع اللوجو */
    right: 12px;
    left: 12px;
    flex-direction:column;
    align-items:stretch;
    gap:0;
    padding:10px;
    border-radius:16px;
    background: rgba(10,10,12,.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.08);
  }

  .nav-links a{
    padding:12px 10px;
    border-radius:12px;
    text-align:right;
  }

  .nav-links a:hover{
    background: rgba(255,255,255,.06);
  }

  .nav-logo{
    width:95px;
    height:80px;
    border-radius:14px;
  }

  .nav-links.is-open{
    display:flex;
  }
}

.footer-center{
  justify-content: center;
  text-align: center;
}

/* Modern Project Cards */
.project-card{
  display:block;
  overflow:hidden;
  border-radius:18px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
  transform: translateZ(0);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.project-card:hover{
  transform: translateY(-4px);
  border-color: rgba(255,255,255,.20);
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
}

.project-card .thumb{
  position:relative;
  width:100%;
  aspect-ratio: 16 / 9; /* ثابت وحديث */
  background: rgba(255,255,255,.04);
  overflow:hidden;
}

.project-card .thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  transform: scale(1.02);
  transition: transform .35s ease;
}

.project-card:hover .thumb img{
  transform: scale(1.08);
}

.project-card .content{
  padding:14px 14px 16px;
}

.project-card .pc-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.project-card h3{
  margin:0;
  font-size:18px;
  line-height:1.3;
}

.project-card .pc-year{
  font-size:12px;
  opacity:.8;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
  white-space:nowrap;
}

.project-card .desc{
  margin:10px 0 12px;
  opacity:.9;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}

.project-card .pc-bottom{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:10px;
}

.project-card .pc-tags{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  max-width:75%;
}

.project-card .pc-cta{
  font-size:13px;
  opacity:.9;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}
/* Project Details Modern Layout */
.project-hero{
  padding:16px;
  border-radius:18px;
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:16px;
}

@media (max-width: 900px){
  .project-hero{ grid-template-columns: 1fr; }
}



.pg-zoom{
  position:absolute;
  left:12px;
  bottom:12px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.35);
  color:#fff;
  cursor:pointer;
}

.project-hero__info{
  padding:6px 4px;
}

.pg-title{
  margin:0 0 10px;
  font-size:34px;
  line-height:1.15;
}

.pg-summary{
  margin:0 0 14px;
  opacity:.9;
}

.pg-tags{
  margin-bottom:14px;
}

.pg-actions{ gap:10px; flex-wrap:wrap; }

.pg-thumbs{
  margin-top:14px;
  display:flex;
  gap:10px;
  overflow:auto;
  padding-bottom:4px;
}

.pg-thumb{
  width: 140px;           /* 👈 عرض ثابت */
  aspect-ratio: 16 / 9;   /* 👈 نفس النسبة */
  height: auto;           /* بيتحسب تلقائي */
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  border-radius:12px;
  padding:0;
  overflow:hidden;
  cursor:pointer;
  flex: 0 0 auto;
  transition: transform .2s ease, border-color .2s ease;
}

/* ✅ Hide scrollbar (still scrollable) */
.pg-thumbs{
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge القديم */
}
.pg-thumbs::-webkit-scrollbar{
  width: 0;
  height: 0;                      /* Chrome/Safari */
}
.pg-thumb img{
  object-fit: contain;
  background: transparent;
}
.pg-thumb{
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
}
.pg-thumb:hover{ transform: translateY(-2px); border-color: rgba(255,255,255,.22); }
.pg-thumb.is-active{ border-color: rgba(255,255,255,.35); }

.pg-desc{
  margin-top:14px;
  padding:16px;
  border-radius:18px;
}

.pg-lightbox{
  position:fixed;
  inset:0;
  display:none;
  place-items:center;
  background: rgba(0,0,0,.75);
  z-index:9999;
}

.pg-lightbox.is-open{ display:grid; }

.pg-lightbox img{
  max-width: min(1100px, 92vw);
  max-height: 86vh;
  border-radius:16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.pg-lightbox__close{
  position:fixed;
  top:18px;
  right:18px;
  width:44px;
  height:44px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.35);
  color:#fff;
  font-size:28px;
  cursor:pointer;
}

/* ✅ Main image area ثابت على كل الشاشات */
.project-hero__media{
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius:16px;
  overflow:hidden;
  position: relative;

  /* ✅ نفس الستايل بتاع .panel */
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  
  display:flex;             /* ✅ عشان نوسّط الصورة */
  align-items:center;
  justify-content:center;
  padding: 10px;            /* ✅ مساحة محترمة حوالين الصورة */
}

/* ✅ Show full image (no crop) داخل مساحة ثابتة */
.project-hero__media img{
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
/* Mobile grid tuning */
@media (max-width: 640px){
  .grid{
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .project-card h3{ font-size: 16px; }
  .project-card .desc{ -webkit-line-clamp: 3; }
}
@media (min-width: 641px) and (max-width: 1024px){
  .grid{
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* Modal wrapper */
.img-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  padding: 16px;                /* مهم للموبايل */
}
.img-modal.is-open{ display: flex; } /* flex عشان يتسنتر */
.img-modal{
  align-items: center;
  justify-content: center;
}

/* Backdrop */
.img-modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
}

/* Card */
.img-modal-card{
  position: relative;
  z-index: 1;
  width: min(92vw, 950px);
  max-height: min(88vh, 760px);
  border-radius: 18px;
  padding: 12px;
  background: rgba(20,20,20,.88);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 25px 80px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Image */
.img-modal-card img{
  width: 100%;
  height: auto;
  max-height: 74vh;      /* الصورة ما تكسرش الشاشة */
  object-fit: contain;
  border-radius: 14px;
  display: block;
}

/* Close button */
.img-modal-close{
  position: absolute;
  top: 10px;
  left: 10px; /* RTL */
  padding: 8px 10px;
  border-radius: 12px;
  z-index: 2;
}

/* Caption */
#imgModalCap{
  text-align: center;
}

/* Mobile tweaks */
@media (max-width: 520px){
  .img-modal{ padding: 10px; }
  .img-modal-card{
    width: 100%;
    max-height: 92vh;
    border-radius: 16px;
    padding: 10px;
  }
  .img-modal-card img{
    max-height: 78vh;
    border-radius: 12px;
  }
}


 