/* ==========================================================
   لوحة تحكم أحمد الفهيد — Standalone Admin Portal
   ========================================================== */

:root {
  --white: #ffffff;
  --black: #000000;
  --teal: #28c9a9;
  --teal-dark: #1fa88c;
  --teal-soft: rgba(40, 201, 169, 0.12);

  --ink: #0f1115;
  --muted: #6b7280;
  --line: #e6e8eb;
  --surface: #f6f7f9;
  --danger: #e2483d;
  --warn: #f59e0b;

  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .06);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, .10);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: var(--teal-dark); text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 900; line-height: 1.35; }
/* المتصفح يعطي figure هامشاً افتراضياً 1em 40px — يقتطع 80px من كل خلية */
figure, figcaption { margin: 0; }

.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 16px; }
.hidden { display: none !important; }

/* ------------------------- تسجيل الدخول ------------------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(40, 201, 169, .16), transparent 70%),
    var(--surface);
}

.login__card {
  width: min(420px, 100%);
  padding: 34px 28px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login__logo {
  width: min(230px, 70%);
  height: auto;
  margin: 0 auto 16px;
}
.login__title { font-size: 1.2rem; }
.login__sub { margin: 4px 0 22px; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.login__sub b { color: var(--ink); font-weight: 800; }

/* حقل كلمة السر مع زر الإظهار */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-inline-start: 46px; }

.pw-toggle {
  position: absolute;
  inset-inline-start: 6px;
  inset-block: 6px;
  width: 36px;
  display: grid; place-items: center;
  border: 0; border-radius: 9px;
  background: none; color: var(--muted);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.pw-toggle:hover { color: var(--teal-dark); background: var(--teal-soft); }
.pw-toggle i { width: 18px; height: 18px; }

.login__card .field label { text-align: start; }

/* ------------------------- الهيكل ------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; height: 62px;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 900; }
.topbar__brand img { height: 30px; width: auto; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

.tabs {
  display: flex; gap: 6px;
  padding: 14px 0 0;
}
.tab {
  padding: 9px 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-weight: 700; font-size: .9rem;
  transition: all .2s var(--ease);
}
.tab:hover { border-color: var(--teal); }
.tab.is-active { background: var(--black); border-color: var(--black); color: var(--white); }

.panel { padding-block: 20px 60px; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
}
.card__title {
  display: flex; align-items: center; gap: 9px;
  font-size: 1.05rem; margin-bottom: 4px;
}
.card__title i { color: var(--teal); width: 20px; height: 20px; }
.card__hint { color: var(--muted); font-size: .85rem; margin: 0 0 18px; }

/* ------------------------- النماذج ------------------------ */
.grid2 { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.field { display: grid; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: .85rem; font-weight: 800; }
.field small { color: var(--muted); font-size: .76rem; }

.input, .select, .textarea {
  width: 100%;
  font: inherit; font-size: .95rem;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  color: inherit;
  outline: none;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}
.textarea { resize: vertical; min-height: 84px; font-family: 'Amiri', 'Cairo', serif; }

.switch { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: .9rem; }
.switch input { width: 18px; height: 18px; accent-color: var(--teal); }

/* ------------------------- الأزرار ------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px;
  border: 0; border-radius: 999px;
  font-weight: 800; font-size: .92rem;
  transition: transform .2s var(--ease), background .2s var(--ease), opacity .2s;
}
.btn i { width: 18px; height: 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn--dark { background: var(--black); color: var(--white); }
.btn--dark:hover:not(:disabled) { transform: translateY(-2px); }
.btn--teal { background: var(--teal); color: var(--white); }
.btn--teal:hover:not(:disabled) { background: var(--teal-dark); transform: translateY(-2px); }
.btn--ghost { background: var(--white); border: 1.5px solid var(--line); }
.btn--ghost:hover:not(:disabled) { border-color: var(--teal); }
.btn--danger { background: var(--danger); color: var(--white); }
.btn--sm { padding: 8px 15px; font-size: .82rem; }
.btn--block { width: 100%; }

/* ------------------------- منطقة الإفلات ------------------ */
.dropzone {
  display: grid; place-items: center; gap: 6px;
  padding: 40px 20px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  transition: all .25s var(--ease);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.dropzone i { width: 42px; height: 42px; color: var(--teal); }
.dropzone strong { font-size: 1rem; }
.dropzone span { color: var(--muted); font-size: .85rem; }

.picker-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }

/* ------------------------- التقدم ------------------------- */
.progress { margin-top: 18px; }
.progress__head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .85rem; font-weight: 800; margin-bottom: 8px;
}
.progress__head b { font-size: 1.15rem; color: var(--teal-dark); }
.progress__track {
  height: 10px; border-radius: 999px;
  background: var(--line); overflow: hidden;
}
.progress__bar {
  height: 100%; width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--teal-dark));
  transition: width .25s var(--ease);
}
.progress__note { margin-top: 8px; font-size: .82rem; color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.stat {
  padding: 14px 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  text-align: center;
}
.stat__val { font-size: 1.15rem; font-weight: 900; line-height: 1.2; }
.stat__val--good { color: var(--teal-dark); }
.stat__key { font-size: .74rem; color: var(--muted); font-weight: 700; }

/* ------------------------- شبكة المعاينة ------------------ */
.previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 2.5px solid transparent;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.is-cover { border-color: var(--teal); }
.thumb.is-cover::after {
  content: 'الغلاف';
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 3px;
  background: var(--teal); color: var(--white);
  font-size: .68rem; font-weight: 800; text-align: center;
}

.thumb__tools {
  position: absolute; inset-block-start: 5px; inset-inline: 5px;
  display: flex; justify-content: space-between; gap: 4px;
  opacity: 0;
  transition: opacity .2s var(--ease);
}
.thumb:hover .thumb__tools,
.thumb:focus-within .thumb__tools { opacity: 1; }
@media (hover: none) { .thumb__tools { opacity: 1; } }

.thumb__btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  backdrop-filter: blur(3px);
  transition: background .2s var(--ease);
}
.thumb__btn i { width: 17px; height: 17px; }
.thumb__btn--star:hover { background: var(--teal); }
.thumb__btn--del:hover { background: var(--danger); }

.thumb__size {
  position: absolute; inset-inline-start: 5px; bottom: 5px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: .64rem; font-weight: 700;
}
.thumb.is-cover .thumb__size { display: none; }

/* ------------------------- قائمة الألبومات ---------------- */
.albums { display: grid; gap: 10px; }

.album-row {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.album-row__cover {
  width: 62px; height: 62px;
  border-radius: 10px; overflow: hidden;
  background: var(--surface);
}
.album-row__cover img { width: 100%; height: 100%; object-fit: cover; }
.album-row__title { font-weight: 800; font-size: .95rem; }
.album-row__meta { color: var(--muted); font-size: .78rem; }
.album-row__tools { display: flex; gap: 6px; }

.badge {
  display: inline-block;
  padding: 1px 9px; border-radius: 999px;
  font-size: .7rem; font-weight: 800;
}
.badge--on { background: var(--teal-soft); color: var(--teal-dark); }
.badge--off { background: #fdecea; color: var(--danger); }

/* ------------------------- التوست ------------------------- */
.toast {
  position: fixed; bottom: 22px; inset-inline: 0;
  z-index: 90; display: grid; place-items: center;
  pointer-events: none;
}
.toast__msg {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: .88rem; font-weight: 700;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(14px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast__msg.is-visible { opacity: 1; transform: none; }
.toast__msg i { width: 17px; height: 17px; }
.toast__msg--ok i { color: var(--teal); }
.toast__msg--err i { color: #ff8b82; }

/* ------------------------- الحالة الفارغة ----------------- */
.empty {
  text-align: center; padding: 46px 20px; color: var(--muted);
}
.empty i { width: 40px; height: 40px; color: var(--teal); }
.empty p { font-weight: 700; margin: 10px 0 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
