/* Admin portal styles. Every rule is scoped under `.admin` because Propshaft
   links all stylesheets globally — these must never affect the public site. */

.admin {
  font-family: "Raleway", Arial, sans-serif;
  color: var(--color-four);
  background: var(--color-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header / nav / footer */
.admin-header {
  background: #fff;
  border-bottom: 1px solid var(--color-three);
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.admin-logo img {
  height: 38px;
  width: auto;
  display: block;
}

.admin-nav {
  display: flex;
  gap: 1.5rem;
  margin-right: auto;
}

.admin-nav a {
  font-weight: 600;
  color: var(--color-four);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.admin-nav a:hover {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.admin-logout {
  color: var(--color-four);
  text-decoration: none;
  font-size: 0.9em;
}

.admin-logout:hover {
  color: var(--color-primary);
}

.admin-main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.admin-footer {
  background: var(--color-three);
  color: var(--color-four);
  text-align: center;
  padding: 1.5rem;
  margin-top: 2rem;
}

/* Headings (Playfair comes from the global h1-h6 rule in main.css) */
.admin h1 {
  font-size: 2rem;
  margin: 0 0 1.5rem;
}

.admin h2 {
  font-size: 1.3rem;
  margin: 0 0 1rem;
}

.admin-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.admin-page-head h1 {
  margin: 0;
}

.admin-muted {
  color: #888;
  font-size: 0.9em;
}

/* Button helpers (base .btn / .btn-primary / .btn-secondary-dark come from main.css) */
.admin .btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.8em;
  margin-top: 0;
}

.admin .btn-danger {
  background: #b23b3b;
  color: #fff;
}

/* Forms */
.admin-field {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-three);
  border-radius: 4px;
  font: inherit;
  background: #fff;
}

.admin-field:focus {
  outline: none;
  border-color: var(--color-primary);
}

textarea.admin-field {
  min-height: 6rem;
  resize: vertical;
}

/* Lists (galleries index, placements) */
.admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-three);
  border-radius: 6px;
  background: #fff;
}

.admin-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-three);
}

.admin-list li:last-child {
  border-bottom: none;
}

.admin-list a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.admin-list a:hover {
  text-decoration: underline;
}

.admin-placement-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Photo grid + thumbnails (roughly half the previous size) */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
}

.admin-thumb {
  position: relative;
  border: 1px solid var(--color-three);
  border-radius: 6px;
  overflow: hidden;
  background: var(--color-three);
  aspect-ratio: 1 / 1;
}

.admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-thumb-action {
  position: absolute;
  top: 4px;
  right: 4px;
}

/* Upload dropzone */
.admin-dropzone {
  border: 2px dashed var(--color-primary);
  border-radius: 8px;
  background: var(--color-secondary);
  padding: 2.5rem 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
  transition: background 0.15s, border-color 0.15s;
}

.admin-dropzone.is-dragover {
  background: var(--color-three);
  border-color: var(--color-four);
}

.admin-dropzone h2 {
  margin: 0 0 0.5rem;
}

/* Gallery builder (two columns: in-gallery and pool) */
.admin-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.admin-builder-col {
  border: 1px solid var(--color-three);
  border-radius: 8px;
  background: #fff;
  padding: 1rem;
}

.admin-builder-col h2 {
  margin-top: 0;
}

.admin-builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
  align-content: start; /* pack rows at the top so the empty area below is droppable */
  min-height: 320px;    /* always leave a large drop target, even when nearly empty */
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
}

.admin-builder .admin-thumb {
  cursor: grab;
}

.admin-builder .sortable-ghost {
  opacity: 0.4;
}

.admin-builder .sortable-drag {
  opacity: 0.9;
}

@media (max-width: 768px) {
  .admin-builder {
    grid-template-columns: 1fr;
  }
}
