/* Pavilion admin — light Apple frosted glass, bilingual (AR-first, RTL). */
:root {
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(246, 248, 251, 0.9);
  --stroke: rgba(105, 115, 130, 0.22);
  --text: #1d1d1f;
  --text-dim: rgba(60, 60, 67, 0.6);
  --blue: #007aff;
  --red: #ff3b30;
  --green: #34c759;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Kufam", "IBM Plex Sans Arabic", system-ui, sans-serif;
  color: var(--text); min-height: 100vh; padding: 26px 18px 110px;
  background:
    radial-gradient(90% 70% at 15% 5%, rgba(255, 255, 255, 0.95), transparent 60%),
    radial-gradient(80% 65% at 90% 95%, rgba(148, 163, 184, 0.28), transparent 60%),
    linear-gradient(180deg, #f1f4f8, #dde2e9);
}
#app, header, nav, .tab { max-width: 860px; margin-inline: auto; }
.en { font-weight: 500; color: var(--text-dim); font-size: 0.8em; }

/* login */
#login { max-width: 400px; margin: 16vh auto 0; text-align: center; }
#login h1 { font-size: 21px; }
#login input {
  width: 100%; margin-top: 16px; font-family: inherit; font-size: 17px; text-align: center;
  background: rgba(255, 255, 255, 0.85); border: 1px solid var(--stroke); border-radius: 12px;
  padding: 13px; outline: none; direction: ltr;
}
#login button { width: 100%; margin-top: 10px; }
#loginErr { display: none; color: var(--red); font-size: 13px; margin-top: 10px; font-weight: 600; }
#loginErr.show { display: block; }

/* header + tabs */
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
h1 { font-size: 22px; font-weight: 700; }
.sub { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.8; }
a.back { font-size: 13px; color: var(--blue); text-decoration: none; white-space: nowrap; margin-top: 6px; }
nav#tabs { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
nav#tabs button {
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 999px;
  padding: 10px 20px; cursor: pointer;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
nav#tabs button.active { background: var(--blue); color: #fff; border-color: transparent; }
nav#tabs button.active .en { color: rgba(255, 255, 255, 0.75); }

/* tabs + cards */
.tab { display: none; }
.tab.active { display: block; }
.card {
  background: var(--glass-strong); border: 1px solid var(--stroke);
  border-radius: 20px; padding: 18px; margin-top: 16px;
  box-shadow: 0 12px 40px rgba(50, 60, 75, 0.1);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card h2 { font-size: 15px; font-weight: 700; }
.card p { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.7; }
.hint { font-size: 12.5px; color: var(--text-dim); margin-top: 12px; line-height: 1.8; }
.big-hint { margin-top: 16px; }

textarea, .faq-entry input {
  width: 100%; margin-top: 10px; font-family: inherit; font-size: 14px; line-height: 1.9;
  color: var(--text); background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--stroke); border-radius: 12px; padding: 11px 14px;
  outline: none; resize: vertical;
}
textarea:focus, .faq-entry input:focus { border-color: var(--blue); }
textarea[dir="ltr"], input[dir="ltr"] { direction: ltr; text-align: left; }

/* buttons */
button { font-family: inherit; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
.ai {
  font-size: 12.5px; font-weight: 600; color: var(--blue);
  background: rgba(0, 122, 255, 0.1); border: 1px solid rgba(0, 122, 255, 0.25);
  border-radius: 999px; padding: 8px 14px; white-space: nowrap;
}
.ai.busy { color: var(--text-dim); }
.ai.big { font-size: 14px; padding: 12px 22px; }
.ai-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost {
  display: block; width: 100%; margin-top: 14px; font-size: 14px; font-weight: 600;
  color: var(--blue); background: transparent; border: 1.5px dashed rgba(0, 122, 255, 0.4);
  border-radius: 16px; padding: 14px;
}
#loginBtn, #saveBtn {
  font-size: 15px; font-weight: 600; color: #fff; background: var(--blue);
  border: none; border-radius: 999px; padding: 13px 34px;
}

/* FAQ */
.faq-gen { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.faq-gen textarea { flex: 1; min-width: 240px; }
.faq-entry { position: relative; }
.faq-entry .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .faq-entry .grid { grid-template-columns: 1fr; } }
.faq-entry label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-dim); margin-top: 8px; }
.faq-entry .entry-actions { position: absolute; top: 14px; inset-inline-end: 14px; display: flex; gap: 6px; }
.faq-entry .mv {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  background: rgba(105, 115, 130, 0.1); border: 1px solid var(--stroke);
  border-radius: 999px; padding: 6px 11px;
}
.faq-entry .del {
  font-size: 12px; font-weight: 600; color: var(--red);
  background: rgba(255, 59, 48, 0.09); border: 1px solid rgba(255, 59, 48, 0.25);
  border-radius: 999px; padding: 6px 13px;
}

/* Photos */
#photoGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 14px; }
.photo-card {
  background: var(--glass-strong); border: 1px solid var(--stroke); border-radius: 18px;
  overflow: hidden; box-shadow: 0 10px 30px rgba(50, 60, 75, 0.08);
}
.photo-card .ph { height: 130px; background: #e3e7ed center/cover no-repeat; position: relative; }
.photo-card .ph.override::after {
  content: "صورة مخصصة"; position: absolute; top: 8px; inset-inline-start: 8px;
  background: var(--green); color: #fff; font-size: 10.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.photo-card .meta { padding: 10px 12px 12px; }
.photo-card .nm { font-size: 13px; font-weight: 700; }
.photo-card .nm-en { font-size: 10.5px; color: var(--text-dim); direction: ltr; text-align: end; }
.photo-card .count {
  font-size: 10.5px; font-weight: 700; color: var(--blue);
  background: rgba(0, 122, 255, 0.1); border-radius: 999px; padding: 2px 8px; margin-inline-start: 4px;
}
.photo-card .thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.photo-card .thumb { position: relative; }
.photo-card .thumb img { width: 52px; height: 40px; object-fit: cover; border-radius: 8px; display: block; }
.photo-card .thumb .x {
  position: absolute; top: -6px; inset-inline-end: -6px; width: 19px; height: 19px;
  font-size: 10px; line-height: 1; color: #fff; background: var(--red);
  border: none; border-radius: 50%; padding: 0;
}
.photo-card .acts { display: flex; gap: 6px; margin-top: 9px; }
.photo-card .acts button {
  flex: 1; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 8px 0;
  color: var(--blue); background: rgba(0, 122, 255, 0.1); border: 1px solid rgba(0, 122, 255, 0.25);
}
.photo-card .acts button.rm { color: var(--red); background: rgba(255, 59, 48, 0.08); border-color: rgba(255, 59, 48, 0.22); flex: 0 0 auto; padding: 8px 12px; }

/* links + rules viewer */
.links { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.links a {
  font-size: 13.5px; font-weight: 600; color: var(--blue); text-decoration: none;
  background: rgba(0, 122, 255, 0.07); border: 1px solid rgba(0, 122, 255, 0.18);
  border-radius: 12px; padding: 11px 15px;
}
.stack-info { font-size: 13px !important; line-height: 2 !important; }
details summary { font-size: 14px; font-weight: 700; cursor: pointer; }
.prompt-view {
  margin-top: 10px; max-height: 320px; overflow: auto; white-space: pre-wrap;
  font-family: inherit; font-size: 12px; line-height: 1.9; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.7); border: 1px solid var(--stroke);
  border-radius: 12px; padding: 12px 14px;
}

/* save bar */
#savebar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; gap: 14px; align-items: center; justify-content: center;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--glass); border-top: 1px solid var(--stroke);
  backdrop-filter: blur(28px) saturate(1.8); -webkit-backdrop-filter: blur(28px) saturate(1.8);
}
#status { font-size: 13px; font-weight: 600; min-width: 120px; }
#status.ok { color: var(--green); }
#status.err { color: var(--red); }
