/* ============ صفحة الدخول ============ */
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login-wrap { width: min(430px, 92%); padding: 40px 0; }
.login-card { padding: 38px 32px; text-align: center; }
.login-logo {
  width: 74px; height: 74px;
  margin: 0 auto 16px;
  border-radius: 22px;
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-size: 2rem;
  box-shadow: 0 14px 40px rgba(109, 92, 255, 0.45);
}
.login-card h1 { font-size: 1.6rem; font-weight: 900; }
.login-sub { color: var(--text-dim); font-size: 0.9rem; margin: 6px 0 24px; }

.field { display: block; text-align: start; margin-bottom: 16px; }
.field > span { display: block; font-size: 0.88rem; font-weight: 700; color: var(--text-dim); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 0.98rem;
  outline: none;
  transition: var(--transition);
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(109, 92, 255, 0.15);
}
.field select option { background: var(--bg-soft); color: var(--text); }

.login-error {
  color: #ff8fa3;
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.3);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 14px;
  text-align: start;
}
.btn-block { width: 100%; justify-content: center; }
.back-link { display: inline-block; margin-top: 18px; color: var(--accent-2); font-weight: 700; font-size: 0.9rem; }
.login-hint { margin-top: 14px; font-size: 0.78rem; color: var(--text-dim); }
.login-hint code { background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 6px; direction: ltr; display: inline-block; }

/* ============ لوحة التحكم ============ */
.admin-main { padding: 110px 0 60px; min-height: 80vh; }
.logo-tag { font-size: 0.7rem; font-weight: 500; color: var(--text-dim); margin-inline-start: 8px; }
.admin-email { color: var(--text-dim); font-size: 0.85rem; }
.logout-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  color: #ff8fa3;
  border-color: rgba(255, 77, 109, 0.3);
}
.logout-icon-btn svg { width: 20px; height: 20px; }
.logout-icon-btn:hover { background: rgba(255, 77, 109, 0.12); border-color: rgba(255, 77, 109, 0.5); color: #ffb3c0; }

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.tab {
  padding: 11px 26px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.tab:hover { color: #fff; }
.tab.active {
  color: #fff;
  background: var(--gradient);
  border-color: transparent;
  box-shadow: 0 10px 30px rgba(109, 92, 255, 0.35);
}

.loading-msg { text-align: center; color: var(--text-dim); padding: 60px 0; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.panel-head h2 { font-size: 1.5rem; font-weight: 900; }

.items-list { display: flex; flex-direction: column; gap: 14px; }
.item-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  transition: var(--transition);
}
.item-row:hover { border-color: rgba(109, 92, 255, 0.4); }
.item-emoji {
  width: 48px; height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
}
.item-info { flex: 1; min-width: 0; }
.item-title { font-weight: 800; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { color: var(--text-dim); font-size: 0.82rem; }
.badge {
  font-size: 0.72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; margin-inline-start: 8px;
}
.badge.on { color: var(--accent-2); background: rgba(0,224,198,.1); border: 1px solid rgba(0,224,198,.25); }
.badge.off { color: #fbbf24; background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.3); }
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,.04);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}
.icon-btn:hover { color: #fff; border-color: var(--accent); }
.icon-btn.danger:hover { color: #ff8fa3; border-color: #ff4d6d; background: rgba(255,77,109,.08); }

/* نافذة المحرر */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 7, 14, 0.7);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-box { width: min(680px, 100%); max-height: 90vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h3 { font-size: 1.3rem; font-weight: 900; }
.close-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,.05);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
}
.close-btn:hover { color: #fff; border-color: #ff4d6d; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 8px; }

.check-field { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; cursor: pointer; }
.check-field input { width: 18px; height: 18px; accent-color: var(--accent); }
.check-field span { font-size: 0.92rem; color: var(--text-dim); }

/* ============ رفع الصور ============ */
.img-upload { width: 100%; }
.img-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 26px 16px;
  border: 2px dashed var(--card-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}
.img-drop:hover, .img-drop.drag {
  border-color: var(--accent);
  background: rgba(109, 92, 255, 0.08);
}
.img-drop-icon { font-size: 1.9rem; }
.img-drop-text { font-size: 0.92rem; color: var(--text-dim); }
.img-drop-text strong { color: var(--text); }
.img-drop-hint { font-size: 0.75rem; color: var(--text-dim); opacity: 0.7; }

.img-preview {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.03);
}
.img-preview img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
}
.img-remove {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255, 77, 109, 0.4);
  background: rgba(7, 11, 20, 0.75);
  color: #ff8fa3;
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}
.img-remove:hover { background: rgba(255, 77, 109, 0.25); color: #fff; }

/* الأقسام */
.settings-card { max-width: 640px; }
.settings-card.wide-card { max-width: 760px; }
.sep { border: 0; border-top: 1px dashed var(--card-border); margin: 20px 0; }
.muted { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 16px; }
.cat-form { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.cat-form input {
  flex: 1; min-width: 200px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.cat-form input:focus { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 8px 18px; }
.chip button {
  background: none; border: 0; color: var(--text-dim);
  cursor: pointer; font-size: 0.9rem; margin-inline-start: 6px;
}
.chip button:hover { color: #ff8fa3; }

/* تنبيه */
.toast {
  position: fixed;
  bottom: 26px; right: 50%;
  transform: translateX(50%);
  background: var(--gradient);
  color: #fff;
  font-weight: 700;
  padding: 13px 30px;
  border-radius: 14px;
  box-shadow: 0 16px 44px rgba(109, 92, 255, 0.5);
  z-index: 300;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(50%, 16px); } }

.btn-sm { padding: 8px 18px; font-size: 0.88rem; border-radius: 10px; }

@media (max-width: 640px) {
  .admin-email { display: none; }
  .item-row { flex-wrap: wrap; }
  .item-actions { width: 100%; justify-content: flex-end; }
}
