/* KRS Payals admin edit mode. Only seen after Staff login. */

.staff-links { margin: .8rem 0 0; }
.staff-links button { border: 0; background: none; color: var(--oxide-soft); font-size: .78rem; text-decoration: underline; padding: .3rem; }

/* The bar at the bottom of the screen while editing */
.admin-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: none;
  align-items: center;
  gap: .4rem;
  padding: .55rem .8rem calc(.55rem + env(safe-area-inset-bottom));
  background: var(--oxide);
  color: var(--silver-pale);
  box-shadow: 0 -6px 20px -10px rgba(0, 0, 0, .5);
}
.admin .admin-bar { display: flex; }
.admin body { padding-bottom: 4.5rem; }
.admin-bar .label { font-size: .85rem; font-weight: 500; margin-right: auto; }
.admin-bar button {
  min-height: 40px;
  padding: .35rem .8rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: none;
  color: inherit;
  font-size: .85rem;
  transition: transform 160ms var(--ease-out);
}
.admin-bar button:active { transform: scale(.97); }

/* Cards say "Edit" while editing; the last card adds a design */
.admin .cat-card::before {
  content: "✎ Edit";
  position: absolute;
  top: .45rem;
  right: .45rem;
  z-index: 1;
  font-size: .68rem;
  background: var(--oxide);
  color: var(--silver-pale);
  border-radius: 3px;
  padding: .1rem .4rem;
}
.cat-card.add-card {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1.5px dashed rgba(29, 34, 38, .35);
  background: none;
  color: var(--oxide);
  font-weight: 500;
}
[data-theme="dark"] .cat-card.add-card { border-color: rgba(228, 230, 225, .35); }
.admin .cat-card.add-card::before { content: none; }

/* Admin sheets (login, ranges, design editor): same slide-up sheet as the catalogue */
dialog.admin-sheet {
  position: fixed;
  inset: auto 0 0 0;
  margin: 0 auto;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  padding: 0 0 env(safe-area-inset-bottom);
  border: 0;
  border-radius: 14px 14px 0 0;
  background: var(--paper);
  color: var(--oxide);
  overflow: auto;
  transform: translateY(100%);
  transition: transform 250ms var(--ease-drawer), overlay 250ms var(--ease-drawer) allow-discrete, display 250ms var(--ease-drawer) allow-discrete;
}
dialog.admin-sheet[open] { transform: translateY(0); }
@starting-style { dialog.admin-sheet[open] { transform: translateY(100%); } }
dialog.admin-sheet::backdrop { background: rgb(0 0 0 / .45); }
body:has(dialog.admin-sheet[open]) { overflow: hidden; }

.admin-form { padding: .4rem 1.5rem 1.5rem; display: flex; flex-direction: column; gap: .8rem; }
.admin-form .grab { width: 40px; height: 4px; border-radius: 2px; background: rgba(29, 34, 38, .2); margin: .2rem auto 0; }
[data-theme="dark"] .admin-form .grab { background: rgba(228, 230, 225, .25); }
.admin-form h2 { font-size: 1.35rem; margin: 0; }
.admin-form .hint { font-size: .85rem; color: var(--oxide-soft); margin: -.4rem 0 0; }
.admin-form label { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; color: var(--oxide-soft); }
.admin-form input:not([type="checkbox"]):not([type="file"]),
.admin-form select,
.admin-form textarea {
  width: 100%;
  min-height: 44px;
  padding: .55rem .7rem;
  border: 1px solid rgba(29, 34, 38, .25);
  border-radius: 6px;
  background: var(--card, #F8F9F6);
  color: var(--oxide);
  font: 1rem 'Archivo', system-ui, sans-serif; /* 16px stops phones zooming in */
}
[data-theme="dark"] .admin-form input:not([type="checkbox"]),
[data-theme="dark"] .admin-form select,
[data-theme="dark"] .admin-form textarea { border-color: rgba(228, 230, 225, .25); }
.admin-form textarea { resize: vertical; }
.admin-form label.check { flex-direction: row; align-items: center; gap: .55rem; font-size: .92rem; color: var(--oxide); }
.admin-form label.check input { width: 20px; height: 20px; accent-color: var(--oxide); }
.admin-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.admin-form .row { display: flex; gap: .6rem; }
.admin-form .row > .btn { flex: 1; }
.admin-form .row.wrap { flex-wrap: wrap; }
.admin-form .btn.small { width: auto; flex: none; padding: .55rem .9rem; font-size: .88rem; }
.admin-form .btn.danger { background: none; color: var(--kumkum); border: 1px solid var(--kumkum); }
.admin-form .form-error { color: var(--kumkum); font-size: .88rem; margin: 0; }

.photo { display: flex; align-items: center; gap: .9rem; }
.photo-preview {
  flex: none;
  width: 120px;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--silver-pale);
  color: var(--oxide-soft);
  font-size: .75rem;
  border: var(--rule);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

.size-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.size-table th { text-align: left; font-weight: 500; color: var(--oxide-soft); padding: 0 .3rem .3rem 0; }
.size-table td { padding: .2rem .3rem .2rem 0; }
.size-table td:last-child { width: 44px; }
.size-table .x, .range-list button {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(29, 34, 38, .2);
  border-radius: 6px;
  background: none;
  color: var(--oxide);
}
[data-theme="dark"] .size-table .x, [data-theme="dark"] .range-list button { border-color: rgba(228, 230, 225, .25); }
.range-list button:disabled { opacity: .35; }

.range-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.range-list li { display: flex; align-items: center; gap: .35rem; }
.range-list li input { flex: 1; min-width: 0; }
.range-list .count { font-size: .78rem; color: var(--oxide-soft); min-width: 1.5rem; text-align: center; }
/* On a phone the range name gets its own line; the Tamil name and the buttons go below it */
@media (max-width: 499px) {
  .range-list li { flex-wrap: wrap; padding-bottom: .5rem; border-bottom: 1px dotted rgba(29, 34, 38, .18); }
  .range-list li:last-child { border-bottom: 0; }
  .range-list li input:not(.ta) { flex-basis: 100%; }
}
.row.add input { flex: 1; }

/* Saved / error messages */
.admin-toast {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(5rem + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: 420px;
  margin: 0 auto;
  padding: .7rem 1rem;
  border-radius: 8px;
  background: var(--oxide);
  color: var(--silver-pale);
  font-size: .9rem;
  text-align: center;
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
  transition: opacity 400ms ease, transform 400ms ease;
}
.admin-toast.show { opacity: 1; transform: translateY(0); }
