/* ============================================================
   Canyon Villas — Admin styles
   Loaded only by admin.html, so the public site stays lean.
   Relies on the design tokens defined in styles.css.
   ============================================================ */

body.admin { background: var(--sand-soft); }

/* ---------- Top bar ---------- */
.admin-bar {
  background: var(--ink);
  color: var(--cream);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-bar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.admin-bar .admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.admin-bar .admin-brand img { width: 38px; height: auto; }
.admin-bar .tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  background: var(--canyon);
  padding: 3px 8px;
  border-radius: 999px;
}

/* ---------- Layout ---------- */
.admin-main { padding-block: clamp(28px, 5vw, 56px); }
.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.admin-head h1 { font-family: var(--font-display); font-size: clamp(1.7rem, 3.4vw, 2.3rem); }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.panel h2 {
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

/* ---------- Login ---------- */
.admin-login { max-width: 420px; margin: clamp(30px, 8vh, 90px) auto; }
.admin-login h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 6px;
  text-align: center;
}
.admin-login .sub { color: var(--muted); font-size: 0.93rem; text-align: center; margin-bottom: 22px; }

/* ---------- Forms ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.admin-field { display: flex; flex-direction: column; gap: 6px; }
.admin-field--full { grid-column: 1 / -1; }
.admin-field label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.admin-field input[type="text"],
.admin-field input[type="number"],
.admin-field input[type="password"],
.admin-field select,
.admin-field textarea {
  font-family: inherit;
  font-size: 0.97rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
}
.admin-field textarea { min-height: 96px; resize: vertical; }
.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  outline: 2px solid var(--clay);
  outline-offset: 1px;
  border-color: transparent;
}
.admin-field .hint { font-size: 0.78rem; color: var(--muted); }

.admin-check { display: flex; align-items: center; gap: 9px; font-size: 0.93rem; }
.admin-check input { width: 17px; height: 17px; accent-color: var(--canyon); }

.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.admin-actions .spacer { flex: 1; }

/* ---------- Buttons ---------- */
.abtn {
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 11px 22px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.abtn--primary { background: var(--canyon); color: #fff; }
.abtn--primary:hover:not(:disabled) { background: var(--canyon-dark); }
.abtn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.abtn--ghost:hover:not(:disabled) { background: var(--sand-soft); }
.abtn--danger { background: transparent; color: #a11b1b; border-color: #e5b8b8; }
.abtn--danger:hover:not(:disabled) { background: #fdf0f0; }
.abtn:disabled { opacity: 0.55; cursor: not-allowed; }
.abtn--block { width: 100%; justify-content: center; }

/* ---------- Property list ---------- */
.prop-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  margin-bottom: 10px;
}
.prop-row__thumb {
  width: 78px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: linear-gradient(150deg, #e9c79a, #b35a35);
  flex-shrink: 0;
}
.prop-row__body { flex: 1; min-width: 0; }
.prop-row__title { font-weight: 700; }
.prop-row__meta { font-size: 0.86rem; color: var(--muted); }
.prop-row__actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.pill {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 8px;
}
.pill--draft { background: #f3e2c2; color: #7a5510; }
.pill--live { background: #dce8d4; color: #3f5c33; }

/* ---------- Photos ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.photo-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
  position: relative;
}
.photo-card img { width: 100%; height: 112px; object-fit: cover; display: block; }
.photo-card__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 7px 8px;
}
.photo-card__bar button {
  font-family: inherit;
  font-size: 0.76rem;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  padding: 3px 5px;
  border-radius: 5px;
}
.photo-card__bar button:hover { background: var(--sand-soft); color: var(--ink); }
.photo-card__bar .del:hover { background: #fdf0f0; color: #a11b1b; }
.photo-card .cover-flag {
  position: absolute;
  top: 7px;
  left: 7px;
  background: var(--canyon);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
}

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  color: var(--muted);
  font-size: 0.93rem;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--clay);
  background: var(--sand-soft);
  color: var(--ink);
}

/* ---------- Status messages ---------- */
.admin-status {
  font-size: 0.9rem;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: none;
}
.admin-status.is-visible { display: block; }
.admin-status.is-info { background: #e8eef4; color: #274257; }
.admin-status.is-success { background: #dce8d4; color: #35502a; }
.admin-status.is-error { background: #fbe4e4; color: #8d1a1a; }

.empty-note {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (max-width: 620px) {
  .prop-row { flex-wrap: wrap; }
  .prop-row__actions { width: 100%; }
}

/* ---------- Admin bar actions ---------- */
.admin-bar__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-bar__actions .abtn { padding: 9px 16px; font-size: 0.86rem; }

/* ---------- Bootstrap-password warning ---------- */
.bootstrap-warning {
  background: #fdf3d8;
  border: 1px solid #e8cd8a;
  border-left: 4px solid #d8a12a;
  color: #6b4c05;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 22px;
  font-size: 0.93rem;
  line-height: 1.6;
}
.bootstrap-warning code {
  background: rgba(0, 0, 0, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.88em;
}
.linkish {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--canyon);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.linkish:hover { color: var(--canyon-dark); }

@media (max-width: 620px) {
  .admin-bar .container { flex-wrap: wrap; }
  .admin-bar__actions { width: 100%; }
}

/* ---------- View-live-site affordances ---------- */
.ext-ico { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.85; }

.prop-row__actions .view-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

/* A draft isn't on the public site, so say so rather than offering a
   link that would appear broken. */
.not-live {
  font-size: 0.8rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  white-space: nowrap;
}

.admin-status .status-link {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  margin-left: 6px;
  white-space: nowrap;
}

/* ---------- Signed-in identity ---------- */
.who {
  font-size: 0.85rem;
  color: rgba(251, 246, 236, 0.75);
  display: inline-flex;
  align-items: center;
  /* A flex container drops the whitespace between its items, so the space
     in "Signed in as <name>" needs to come from gap. */
  gap: 4px;
  padding-right: 4px;
  white-space: nowrap;
}
.who strong { color: var(--cream); font-weight: 600; }

/* ---------- User rows ---------- */
.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  margin-bottom: 8px;
}
.user-row__name { font-weight: 700; flex: 1; min-width: 0; }
.user-row__meta { font-size: 0.82rem; color: var(--muted); font-weight: 400; }
.pill--you { background: #dbe6f0; color: #2b4a63; }

/* ------------------------------------------------------------------
   [hidden] must win.
   Several rules here set display:flex / inline-flex on elements that
   are toggled with the `hidden` attribute (the admin-bar actions, the
   view sections, .abtn buttons). An author-level display rule beats
   the UA stylesheet's [hidden]{display:none}, which left the admin bar
   controls visible on the sign-in screen. This puts that right.
   ------------------------------------------------------------------ */
[hidden] { display: none !important; }

/* ---------- Show / hide password ---------- */
.pw-wrap { position: relative; display: block; }

/* Leave room so the toggle never sits on top of the text.
   Needs to out-specify `.admin-field input[type="password"]` above,
   which sets the shared padding — hence the attribute selectors. */
.admin-field .pw-wrap input[type="password"],
.admin-field .pw-wrap input[type="text"] {
  padding-right: 44px;
}

.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  place-items: center;
  line-height: 0;
}
.pw-toggle:hover { color: var(--ink); background: var(--sand-soft); }
.pw-toggle:focus-visible { outline: 2px solid var(--clay); outline-offset: 1px; }
.pw-toggle svg { width: 18px; height: 18px; }

/* ---------- Admin section menu ---------- */
.admin-menu { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-menu__item {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(251, 246, 236, 0.72);
  background: transparent;
  border: none;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.admin-menu__item:hover { color: var(--cream); background: rgba(251, 246, 236, 0.1); }
.admin-menu__item.is-active { color: #fff; background: var(--canyon); }
.admin-menu__item:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }

.admin-account { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Explanatory copy above a settings form */
.admin-note {
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 70ch;
  margin-bottom: 22px;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .admin-bar .container { flex-wrap: wrap; gap: 10px; }
  .admin-bar__actions { width: 100%; justify-content: space-between; }
}

/* ---------- Photo toolbar (select all / bulk delete) ---------- */
.photo-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
}
.photo-toolbar .spacer { flex: 1; }
.photo-toolbar__count { font-size: 0.86rem; color: var(--muted); }
.photo-toolbar .abtn { padding: 8px 16px; font-size: 0.86rem; }

.drag-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 14px;
  margin-bottom: -4px;
}

/* ---------- Drag and drop reordering ---------- */
.photo-card { cursor: grab; }
.photo-card:active { cursor: grabbing; }
.photo-card.is-dragging { opacity: 0.4; }

/* Insertion marker: a bar on the edge the card would land against,
   which reads more clearly than moving items around under the cursor. */
.photo-card.drop-before::before,
.photo-card.drop-after::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--canyon);
  border-radius: 2px;
  z-index: 3;
}
.photo-card.drop-before::before { left: -8px; }
.photo-card.drop-after::after { right: -8px; }

.photo-card.is-selected { outline: 2px solid var(--canyon); outline-offset: 1px; }

/* Selection checkbox sits over the image */
.photo-card__select {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  width: 20px;
  height: 20px;
  accent-color: var(--canyon);
  cursor: pointer;
  background: #fff;
  border-radius: 4px;
}

/* Cover badge moves aside so it never sits under the checkbox */
.photo-card .cover-flag { z-index: 2; }
