/* File: C:\Users\am964\Projects\RashaStores\css\admin.css  — admin page (loads after style.css) */

body.admin { background: var(--ivory); }
.hide-sm { text-decoration: none; }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(380px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 20px;
  padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); text-align: center;
}
.login-card img { width: 96px; height: 96px; border-radius: 50%; margin: 0 auto; }
.login-card h1 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.8rem; }
html[lang="ar"] .login-card h1 { font-family: var(--font-ar); font-size: 1.4rem; }
.login-card .field { text-align: start; }
.login-card .pill-btn { align-self: center; }

/* ---------- Layout ---------- */
.admin-main { padding: 22px 0 60px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 16px; font-weight: 500; color: var(--ink-soft);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select, .field select {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--paper);
}
.toolbar input { flex: 1 1 200px; }
.toolbar .btn { padding: 10px 18px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.field .hint, .hint { color: var(--ink-soft); font-size: 0.8rem; margin: 0; }
.field input, .field textarea, .field select { background: var(--paper); }
.field.small { max-width: 200px; }
fieldset.field { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.field legend { font-size: 0.82rem; font-weight: 600; padding: 0; margin-bottom: 4px; }
.with-btn { display: flex; gap: 8px; align-items: center; }
.with-btn input { flex: 1; min-width: 0; }
.self-start { align-self: flex-start; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }

/* ---------- Lists ---------- */
.admin-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.row.hidden-product { opacity: 0.6; }
.row .thumb { width: 64px; height: 80px; border-radius: 8px; object-fit: cover; background: var(--sand); }
.row h3 { margin: 0; font-size: 1rem; font-weight: 500; }
.row .sub { color: var(--ink-soft); font-size: 0.85rem; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row .actions button { padding: 6px 12px; font-size: 0.85rem; }
.danger { color: var(--danger) !important; border-color: var(--danger) !important; }
.danger:hover { background: #fbe9e7 !important; }
.cat-row { grid-template-columns: 1fr auto; }
.status-pill { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--sand); }
.status-pill.off { background: #eee; color: #666; }
.cat-form { display: grid; grid-template-columns: 1fr 1fr 140px; gap: 14px; align-items: end; }
.cat-form .form-error, .cat-form .form-actions { grid-column: 1 / -1; }

/* ---------- Editor dialog ---------- */
.editor-dialog { width: min(760px, 100% - 16px); margin: auto; }
.editor { background: var(--ivory); border-radius: 18px; display: flex; flex-direction: column; max-height: 94dvh; overflow: hidden; }
.editor-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
.editor-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
html[lang="ar"] .editor-head h2 { font-family: var(--font-ar); font-size: 1.3rem; }
.editor-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.editor-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--paper); flex-wrap: wrap; }
.editor-foot .form-error { margin-inline-end: auto; }

.tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 8px; background: var(--paper);
}
.tag-input input { border: 0; outline: 0; flex: 1 1 100px; padding: 6px 4px; background: transparent; }
.tags { display: contents; }
.tag {
  display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--gold); background: var(--gold-soft);
  border-radius: 8px; font-size: 0.88rem; overflow: hidden;
}
.tag .tag-toggle { border: 0; background: transparent; padding: 4px 8px; }
.tag .tag-x { border: 0; background: transparent; padding: 4px 8px; border-inline-start: 1px solid rgba(0,0,0,0.08); }
.tag.out { background: #f1f1f1; border-color: #ccc; }
.tag.out .tag-toggle { text-decoration: line-through; color: #777; }
.tag small { font-size: 0.7rem; color: var(--danger); padding-inline-end: 6px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.82rem; color: var(--ink-soft); }
.presets .chip { padding: 4px 10px; font-size: 0.8rem; }

.color-rows { display: flex; flex-direction: column; gap: 8px; }
.color-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; align-items: center; }
.color-row input { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; background: var(--paper); min-width: 0; }

.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photo { position: relative; width: 104px; }
.photo img { width: 104px; height: 130px; object-fit: cover; border-radius: 10px; background: var(--sand); border: 2px solid transparent; }
.photo.main img { border-color: var(--gold); }
.photo .main-tag { position: absolute; top: 6px; inset-inline-start: 6px; background: var(--gold); color: var(--ink); font-size: 0.7rem; padding: 1px 7px; border-radius: 999px; }
.photo .photo-actions { display: flex; gap: 4px; margin-top: 4px; }
.photo .photo-actions button { flex: 1; border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 3px 0; font-size: 0.78rem; }
.photo.uploading img { opacity: 0.4; }
.upload-btn { position: relative; align-self: flex-start; cursor: pointer; padding: 9px 18px; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

.switch { display: flex; align-items: center; gap: 10px; font-weight: 500; padding-bottom: 10px; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--ink); }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  body.admin .brand-name { font-size: 1rem; }
  .grid-2, .cat-form { grid-template-columns: 1fr; }
  .row { grid-template-columns: 56px 1fr; }
  .row .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .cat-row .actions { grid-column: auto; }
  .with-btn { flex-direction: column; align-items: stretch; }
  .color-row { grid-template-columns: 1fr 1fr; }
  .editor-dialog { width: 100%; margin: auto 0 0; }
  .editor { border-radius: 18px 18px 0 0; }
}

/* ---------- per-size price & weight (Oct 31) ---------- */
.size-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.size-row { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 8px; align-items: center; }
.size-row input { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--paper); min-width: 0; }
.size-row.out strong { text-decoration: line-through; color: #888; }
.size-head span { font-size: 0.75rem; font-weight: 600; color: var(--ink-soft); }
.def-row { grid-template-columns: 1fr 1fr 40px; max-width: 420px; }
