:root{
  --bg:#f7f6f3;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --brand:#1f6f64;
  --gold:#c8a85a;
  --border:#e5e7eb;
  --shadow: 0 10px 30px rgba(2,6,23,.08);
  --radius:18px;
  --maxw:1100px;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, "Noto Kufi Arabic", "Cairo", sans-serif;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 40%);
  color:var(--text);
}
a{color:inherit}
.container{max-width:var(--maxw);margin:0 auto;padding:18px}
.header{display:flex; align-items:center; justify-content:center; padding:18px 0 8px;}
.logo{display:flex; flex-direction:column; align-items:center; gap:10px;}
.logo img{max-width:180px; height:auto}
.hero{
  background: radial-gradient(1200px 500px at 50% -60%, rgba(31,111,100,.18), transparent 60%),
              radial-gradient(900px 450px at 20% 0%, rgba(200,168,90,.18), transparent 60%),
              #ffffff;
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:18px;
  text-align:center;
}
.hero h1{margin:0 0 8px;font-size:22px}
.hero p{margin:0;color:var(--muted)}
.grid{display:grid;grid-template-columns: repeat(2, minmax(0,1fr));gap:12px;margin-top:14px;}
@media(min-width:900px){.grid{grid-template-columns: repeat(4, minmax(0,1fr));}.hero h1{font-size:26px}}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(2,6,23,.06);
  overflow:hidden;
  cursor:pointer;
  transition:.15s transform ease, .15s box-shadow ease;
}
.card:hover{transform:translateY(-2px); box-shadow: 0 14px 30px rgba(2,6,23,.10);}
.card img{width:100%; aspect-ratio: 4/5; object-fit:contain; display:block}
.card .name{padding:10px 12px; font-weight:700; font-size:13px; text-align:center}
.panel{
  margin-top:14px;
  background:#fff;
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
}
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:flex-end}
.field{flex:1; min-width:220px}
label{display:block; font-size:13px; color:var(--muted); margin-bottom:6px}
input[type="text"], input[type="password"], input[type="number"], select, textarea{
  width:100%;
  padding:12px 12px;
  border:1px solid var(--border);
  border-radius: 14px;
  outline:none;
  background:#fff;
  font-size:14px;
}
textarea{min-height:90px; resize:vertical}
.btn{
  border:none;border-radius: 14px;padding:12px 14px;font-weight:700;cursor:pointer;transition:.12s transform ease;
}
.btn:active{transform:scale(.98)}
.btn.primary{background:linear-gradient(135deg, var(--brand), #0f4d45); color:#fff}
.btn.gold{background:linear-gradient(135deg, var(--gold), #9a7d37); color:#1a1407}
.btn.gray{background:#eef2f7;color:#0f172a}
.small{font-size:12px; color:var(--muted)}
.footer{padding:24px 0; text-align:center; color:var(--muted)}
.badge{
  display:inline-flex; gap:8px; align-items:center;
  padding:8px 12px;
  border:1px solid var(--border);
  border-radius: 999px;
  background:#fff;
  color:var(--muted);
  font-size:12px;
}
.modal{
  position:fixed; inset:0;
  background:rgba(2,6,23,.55);
  display:none;align-items:center; justify-content:center;
  padding:16px;z-index:50;
}
.modal.show{display:flex}
.modal .box{
  width:min(980px, 100%);
  background:#fff;border-radius: 18px;overflow:hidden;
  border:1px solid var(--border);
  box-shadow: 0 25px 70px rgba(2,6,23,.35);
}
.modal .top{
  padding:12px 14px;display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--border);
}
.modal .canvasWrap{padding:14px; display:flex; justify-content:center; background:#f8fafc}
canvas{max-width:100%; height:auto; border-radius: 14px}
.notice{padding:10px 12px; border-radius: 14px; background:#fff7ed; border:1px solid #fed7aa; color:#9a3412; display:none}
.notice.show{display:block}

@media(max-width:600px){
  .modal{padding:0}
  .modal .box{height:100%;border-radius:0}
  .modal .top{position:sticky;top:0;background:#fff;z-index:2}
  .modal .canvasWrap{
    padding:10px;
    height:calc(100vh - 110px);
    display:flex;
    justify-content:center;
    align-items:center;
    overflow:auto;
    background:#f8fafc;
  }
  .modal .canvasWrap canvas{
    width:100% !important;
    max-width: 100% !important;
    height:auto !important;
  }
}

.iconBtn{
  border:0;
  background:rgba(15,23,42,0.06);
  width:40px;
  height:40px;
  border-radius:14px;
  font-size:18px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.iconBtn:active{ transform: scale(0.98); }
@media(max-width:600px){
  .iconBtn{ width:44px; height:44px; border-radius:16px; }
}

.modal .box{ position:relative; }

.modalX{
  position:absolute;
  top:12px;
  right:12px;
  border:0;
  background:rgba(15,23,42,0.10);
  width:44px;
  height:44px;
  border-radius:16px;
  font-size:18px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 50;
}
@media(max-width:600px){
  .modalX{ top:10px; right:10px; }
}

/* V6: مودال معاينة مضبوط على الجوال بدون مطّ */
.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:16px;
  background:rgba(2,6,23,0.55);
  z-index:9999;
}
.modal.open{ display:flex; }

.modal .box{
  width: min(520px, 92vw);
  max-height: 92vh;
  background:#fff;
  border-radius:18px;
  overflow:hidden;
  position:relative;
  display:flex;
  flex-direction:column;
}

.modal .top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px;
  border-bottom:1px solid #e5e7eb;
  background:#fff;
}

.modal .canvasWrap{
  flex:1;
  min-height: 200px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:auto;
  background:#f8fafc;
  padding:10px;
}

.modalX{
  position:absolute;
  top:10px;
  right:10px;
  border:0;
  background:rgba(15,23,42,0.10);
  width:44px;
  height:44px;
  border-radius:16px;
  font-size:18px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:50;
}

@media(max-width:600px){
  .modal{ padding:10px; }
  .modal .box{ width: 96vw; max-height: 94vh; border-radius:16px; }
  .modal .canvasWrap{ padding:8px; }
}

/* preview-scale-fix */
.modal .canvasWrap canvas{ transform-origin:center center; }
/* إخفاء زر المعاينة */
#previewBtn,
.previewBtn,
button[data-action="preview"]{
  display: none !important;
}
/* ===============================
   Button Effects (Desktop + Mobile)
================================= */

/* الأساس */
button,
.btn,
a.btn,
input[type="button"],
input[type="submit"]{
  transition: transform .18s ease,
              box-shadow .18s ease,
              filter .18s ease,
              background .18s ease;
  will-change: transform;
  cursor: pointer;
}

/* ===============================
   كمبيوتر - Hover
================================= */
@media (hover: hover) {
  button:hover,
  .btn:hover,
  a.btn:hover,
  input[type="button"]:hover,
  input[type="submit"]:hover{
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 28px rgba(0,0,0,.14);
    filter: brightness(1.04);
  }
}

/* ===============================
   جوال - لمس (Tap Effect)
================================= */
button:active,
.btn:active,
a.btn:active,
input[type="button"]:active,
input[type="submit"]:active{
  transform: scale(.96);
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
  filter: brightness(.96);
}

/* تحسين استجابة اللمس */
button,
.btn,
a.btn{
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ===============================
   Focus (وصولية)
================================= */
button:focus-visible,
.btn:focus-visible,
a.btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px rgba(59,130,246,.25);
}

/* ===============================
   Disabled
================================= */
button:disabled,
.btn:disabled{
  transform: none !important;
  box-shadow: none !important;
  filter: none !important;
  opacity: .55;
  cursor: not-allowed;
}
.btn-primary:hover{
  box-shadow: 0 0 0 1px rgba(255,255,255,.2),
              0 14px 32px rgba(16,185,129,.25);
}
/* ===============================
   Luxury Button Light Effect
================================= */

button,
.btn,
a.btn{
  position: relative;
  overflow: hidden;
  transition: 
    transform .2s ease,
    box-shadow .2s ease,
    filter .2s ease,
    background .25s ease;
}

/* تفتيح اللون */
button:hover,
.btn:hover,
a.btn:hover{
  filter: brightness(1.15) saturate(1.1);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,.15);
}

/* لمعة متحركة */
button::before,
.btn::before,
a.btn::before{
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 120%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255,255,255,.4) 50%,
    transparent 70%
  );
  transition: left .5s ease;
}

/* حركة اللمعة */
button:hover::before,
.btn:hover::before,
a.btn:hover::before{
  left: 120%;
}

/* تأثير الجوال (لمسة) */
button:active,
.btn:active,
a.btn:active{
  transform: scale(.95);
  filter: brightness(.95);
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}

/* منع وميض أندرويد */
button,
.btn,
a.btn{
  -webkit-tap-highlight-color: transparent;
}
/* ===============================
   Derived Color Hover Effect
   (تفتيح من نفس اللون الأصلي)
================================= */

button,
.btn,
a.btn{
  position: relative;
  overflow: hidden;
  transition: 
    transform .18s ease,
    box-shadow .18s ease,
    filter .18s ease;
}

/* تفتيح مشتق من نفس اللون */
@media (hover:hover){
  button:hover,
  .btn:hover,
  a.btn:hover{
    transform: translateY(-2px);
    filter: brightness(1.12) saturate(1.05); /* تفتيح طبيعي */
    box-shadow: 0 10px 24px rgba(0,0,0,.14);
  }
}

/* لمعة خفيفة جداً من نفس اللون */
button::after,
.btn::after,
a.btn::after{
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 40%,
    rgba(255,255,255,.18),
    transparent 60%
  );
  opacity: 0;
  transition: opacity .25s ease;
}

button:hover::after,
.btn:hover::after,
a.btn:hover::after{
  opacity: 1;
}

/* الجوال - ضغط */
button:active,
.btn:active,
a.btn:active{
  transform: scale(.96);
  filter: brightness(.96);
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}

/* منع وميض اللمس */
button,
.btn,
a.btn{
  -webkit-tap-highlight-color: transparent;
}
button:hover,
.btn:hover{
  backdrop-filter: saturate(1.1);
}


