@font-face {
  font-family: 'Rakkas';
  src: url('assets/fonts/rakkas-400.ttf') format('truetype');
  font-weight: 400;
}
@font-face {
  font-family: 'Aref Ruqaa';
  src: url('assets/fonts/arefruqaa-400.ttf') format('truetype');
  font-weight: 400;
}
@font-face {
  font-family: 'Aref Ruqaa';
  src: url('assets/fonts/arefruqaa-700.ttf') format('truetype');
  font-weight: 700;
}
@font-face {
  font-family: 'Markazi Text';
  src: url('assets/fonts/markazi-400.ttf') format('truetype');
  font-weight: 400;
}
@font-face {
  font-family: 'Markazi Text';
  src: url('assets/fonts/markazi-600.ttf') format('truetype');
  font-weight: 600;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy: #1b2a4a;
  --navy-dark: #101b33;
  --gold: #d4af37;
  --gold-light: #f2dc9b;
  --cream: #f7efdd;
}

body {
  font-family: 'Markazi Text', serif;
  background: var(--cream);
  color: #3d3325;
  min-height: 100vh;
  padding-bottom: 40px;
}

/* ---------- الهيدر ---------- */
#appHeader {
  background: linear-gradient(160deg, #26365c, var(--navy) 55%, var(--navy-dark));
  color: var(--gold-light);
  text-align: center;
  padding: 34px 18px 26px;
  border-bottom: 4px solid var(--gold);
}
.header-ornament { color: var(--gold); font-size: 26px; }
#appHeader h1 {
  font-family: 'Rakkas', serif;
  font-size: 34px;
  font-weight: 400;
  margin: 6px 0 4px;
  background: linear-gradient(90deg, #f9e8a8, #e3c464, #b8933a, #e9cf7d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.subtitle { font-size: 19px; color: #d8d2c2; }

/* ---------- الشاشات ---------- */
.screen { display: none; padding: 20px 16px; max-width: 640px; margin: 0 auto; }
.screen.active { display: block; }

h2 {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 28px;
  color: var(--navy);
  margin: 8px 0 16px;
  text-align: center;
}

.back-btn {
  background: none;
  border: 2px solid var(--navy);
  color: var(--navy);
  font-family: 'Markazi Text', serif;
  font-size: 19px;
  padding: 4px 16px;
  border-radius: 22px;
  cursor: pointer;
}

.note {
  text-align: center;
  color: #8a7c5c;
  font-size: 18px;
  margin-top: 22px;
  line-height: 1.6;
}

/* ---------- الأقسام ---------- */
.cat-grid { display: flex; flex-direction: column; gap: 16px; margin-top: 10px; }
.cat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fffdf6;
  border: 2px solid #e3d5ae;
  border-radius: 18px;
  padding: 22px 20px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(27,42,74,.08);
  transition: transform .12s, box-shadow .12s;
  font-family: inherit;
  text-align: right;
}
.cat-card:active { transform: scale(.97); }
.cat-icon { font-size: 40px; }
.cat-name {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 27px;
  color: var(--navy);
  flex: 1;
}
.cat-count { font-size: 18px; color: #b8933a; }

/* ---------- التصميمات ---------- */
.design-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.design-card {
  background: #fffdf6;
  border: 2px solid #e3d5ae;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: transform .12s;
  font-family: inherit;
}
.design-card:active { transform: scale(.96); }
.design-card canvas { width: 100%; display: block; }
.design-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px 10px;
}
.design-num {
  background: var(--navy);
  color: var(--gold-light);
  font-size: 17px;
  border-radius: 12px;
  padding: 1px 12px;
}
.design-name { font-size: 18px; color: var(--navy); font-weight: 600; }

/* ---------- النموذج ---------- */
.preview-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
#previewCanvas {
  width: 240px;
  border-radius: 12px;
  box-shadow: 0 6px 22px rgba(27,42,74,.25);
  border: 2px solid var(--gold);
}

#dataForm { display: flex; flex-direction: column; gap: 12px; }
#dataForm label {
  font-size: 20px;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#dataForm input {
  font-family: 'Markazi Text', serif;
  font-size: 21px;
  padding: 10px 14px;
  border: 2px solid #d9c98f;
  border-radius: 12px;
  background: #fffdf6;
  color: #3d3325;
}
#dataForm input:focus { outline: none; border-color: var(--gold); }

.actions { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.action-btn {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 23px;
  padding: 14px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
}
.action-btn.gold {
  background: linear-gradient(90deg, #e3c464, #d4af37);
  color: #3a2c05;
  box-shadow: 0 4px 12px rgba(184,147,58,.4);
}
.action-btn.dark {
  background: var(--navy);
  color: var(--gold-light);
}
.action-btn:disabled { opacity: .55; cursor: default; }

.quality-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.quality-label { font-size: 19px; font-weight: 600; color: var(--navy); }
#imageQuality {
  font-family: 'Markazi Text', serif;
  font-size: 19px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 2px solid #d9c98f;
  background: #fffdf6;
}

.progress { display: flex; align-items: center; gap: 10px; }
.progress-bar {
  flex: 1;
  height: 14px;
  background: #e8dcc0;
  border-radius: 8px;
  overflow: hidden;
}
#progressFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e3c464, #b8933a);
  transition: width .15s;
}
#progressText { font-size: 18px; font-weight: 600; color: var(--navy); min-width: 44px; }

/* ---------- التنبيهات ---------- */
.toast {
  position: fixed;
  bottom: 18px;
  right: 16px;
  left: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: var(--navy);
  color: var(--gold-light);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 19px;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.toast button {
  background: var(--gold);
  border: none;
  color: #3a2c05;
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  padding: 6px 18px;
  border-radius: 10px;
  cursor: pointer;
}
.hidden { display: none !important; }

/* ---------- أزرار القوائم ---------- */
.menu-row, .tools-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}
.tools-row { margin: 4px 0 16px; }
.menu-btn {
  background: #fffdf6;
  border: 2px solid var(--gold);
  color: var(--navy);
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 20px;
  padding: 10px 22px;
  border-radius: 14px;
  cursor: pointer;
}
.menu-btn:active { transform: scale(.96); }

.action-btn.save {
  background: #fffdf6;
  border: 3px solid var(--gold);
  color: #7a5a18;
}

/* ---------- بطاقات الحجوزات والإحصائيات ---------- */
.cards-list { display: flex; flex-direction: column; gap: 12px; }
.booking-card {
  background: #fffdf6;
  border: 2px solid #e3d5ae;
  border-radius: 14px;
  padding: 14px 16px;
}
.booking-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.booking-names {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 23px;
  color: var(--navy);
}
.booking-del {
  background: none;
  border: none;
  color: #a3122d;
  font-size: 18px;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 8px;
}
.booking-line { font-size: 19px; color: #5a4c33; margin-top: 3px; }
.booking-price {
  display: inline-block;
  background: linear-gradient(90deg, #e3c464, #d4af37);
  color: #3a2c05;
  font-weight: 600;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 19px;
  margin-top: 6px;
}
.booking-saved { font-size: 17px; color: #8a7c5c; margin-top: 4px; }

.stat-row {
  background: #fffdf6;
  border: 2px solid #e3d5ae;
  border-radius: 14px;
  padding: 12px 16px;
}
.stat-head {
  display: flex;
  justify-content: space-between;
  font-size: 20px;
  color: var(--navy);
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-bar {
  height: 12px;
  background: #efe6cf;
  border-radius: 7px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  background: linear-gradient(90deg, #e3c464, #b8933a);
  border-radius: 7px;
}

/* ---------- شاشة الغلاف ---------- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background:
    radial-gradient(ellipse 90% 55% at 50% 18%, rgba(227,196,100,.14), transparent 60%),
    linear-gradient(165deg, #26365c, #1b2a4a 50%, #0c1526);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .6s ease, visibility .6s;
}
#splash.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 12% 22%, rgba(249,232,168,.7), transparent),
    radial-gradient(1.6px 1.6px at 78% 12%, rgba(249,232,168,.5), transparent),
    radial-gradient(2.4px 2.4px at 88% 44%, rgba(249,232,168,.6), transparent),
    radial-gradient(1.5px 1.5px at 24% 68%, rgba(249,232,168,.45), transparent),
    radial-gradient(2px 2px at 64% 82%, rgba(249,232,168,.55), transparent),
    radial-gradient(1.4px 1.4px at 40% 8%, rgba(249,232,168,.4), transparent),
    radial-gradient(1.8px 1.8px at 8% 88%, rgba(249,232,168,.45), transparent),
    radial-gradient(1.6px 1.6px at 92% 76%, rgba(249,232,168,.4), transparent);
  animation: twinkle 2.4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .45; } to { opacity: 1; } }

.splash-inner { position: relative; text-align: center; }

.splash-ring { overflow: visible; }
.ring-outer {
  stroke-dasharray: 553;
  stroke-dashoffset: 553;
  animation: drawRing 1.5s ease-out forwards .15s;
  filter: drop-shadow(0 0 8px rgba(212,175,55,.55));
}
.ring-inner {
  stroke-dasharray: 490;
  stroke-dashoffset: 490;
  animation: drawRing 1.5s ease-out forwards .35s;
}
.ring-heart {
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  animation: drawRing 1s ease-out forwards 1.2s;
}
@keyframes drawRing { to { stroke-dashoffset: 0; } }

.splash-d {
  position: absolute;
  top: 78px;
  right: 0;
  left: 0;
  font-family: 'Rakkas', serif;
  font-size: 64px;
  line-height: 1;
  background: linear-gradient(90deg, #f9e8a8, #e3c464, #b8933a, #e9cf7d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0;
  animation: fadeUp .7s ease-out forwards .9s;
}

.splash-title {
  margin-top: 26px;
  font-family: 'Rakkas', serif;
  font-weight: 400;
  font-size: 52px;
  background: linear-gradient(90deg, #f9e8a8, #e3c464 35%, #b8933a 60%, #f2dc9b);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeUp .8s ease-out forwards 1.3s, shimmer 3s linear infinite 2s;
  opacity: 0;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.splash-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
  color: #d4af37;
  font-size: 18px;
  opacity: 0;
  animation: fadeUp .7s ease-out forwards 1.7s;
}
.splash-divider span {
  display: block;
  width: 90px;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, #d4af37, transparent);
}
.splash-tag {
  margin-top: 12px;
  font-size: 21px;
  color: #cfc7b2;
  opacity: 0;
  animation: fadeUp .7s ease-out forwards 1.9s;
}

/* وضع المعاينة الثابتة للغلاف */
#splash.static .ring-outer, #splash.static .ring-inner, #splash.static .ring-heart { stroke-dashoffset: 0; animation: none; }
#splash.static .splash-d, #splash.static .splash-title, #splash.static .splash-divider, #splash.static .splash-tag { opacity: 1; animation: none; transform: none; }
