/*
 * Styling for the admin area. Everything is scoped under `.admin` so the
 * public pages (home.css / pages.css) stay untouched.
 *
 * House rule: no rounded corners anywhere in here.
 */

.admin {
  --admin-bg: #f4f2f0;
  --admin-surface: #ffffff;
  --admin-border: #ddd7d3;
  --admin-sidebar-bg: #221e1e;
  --admin-sidebar-muted: rgba(255, 255, 255, 0.55);
  --admin-sidebar-width: 250px;
  --admin-muted: #6f6663;

  background-color: var(--admin-bg);
  color: #241f1f;
}

/* Square corners, everywhere ---------------------------------------------- */

.admin,
.admin *,
.admin *::before,
.admin *::after {
  border-radius: 0 !important;
}

/* Sidebar ----------------------------------------------------------------- */

.admin-sidebar {
  width: var(--admin-sidebar-width);
  /* Bootstrap forces a transparent background on `.offcanvas-lg` above the
     breakpoint, so the sidebar colours need to win that fight. */
  background-color: var(--admin-sidebar-bg) !important;
  color: #fff;
}

.admin-sidebar .offcanvas-body {
  background-color: var(--admin-sidebar-bg) !important;
}

@media (min-width: 992px) {
  .admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    flex: 0 0 var(--admin-sidebar-width);
  }

  .admin-sidebar .offcanvas-body {
    flex-grow: 1;
    overflow-y: auto;
  }
}

.admin-sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar-brand .logo {
  max-width: 44px;
}

.admin-sidebar-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--admin-sidebar-muted);
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-nav-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.admin-nav-link.active {
  background-color: rgba(255, 255, 255, 0.1);
  border-left-color: var(--intense-color);
  color: #fff;
  font-weight: 600;
}

.admin-nav-link i {
  font-size: 1.05rem;
  width: 1.25rem;
  text-align: center;
}

.admin-sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar-footer a {
  color: var(--admin-sidebar-muted);
  text-decoration: none;
}

.admin-sidebar-footer a:hover {
  color: #fff;
}

/* Topbar and page header -------------------------------------------------- */

.admin-topbar {
  background-color: var(--admin-surface);
  border-bottom: 1px solid var(--admin-border);
}

.admin-main {
  min-width: 0;
  max-width: 100%;
}

/* Bootstrap ships no min-width utility; flex children need one to be able to
   shrink below their content width (wide tables, long titles). */
.admin .min-w-0 {
  min-width: 0;
}

.admin-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--admin-muted);
}

.admin-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
}

/* Panels ------------------------------------------------------------------ */

.admin-panel {
  background-color: var(--admin-surface);
  border: 1px solid var(--admin-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.admin-panel-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  font-weight: 600;
}

.admin-panel-body {
  padding: 1.25rem;
}

/* Tables ------------------------------------------------------------------ */

.admin-table {
  margin-bottom: 0;
}

.admin-table > thead th {
  background-color: #faf8f7;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--admin-muted);
  padding: 0.7rem 1.25rem;
  white-space: nowrap;
}

.admin-table > tbody td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid #eee9e6;
  vertical-align: middle;
}

.admin-table > tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table > tbody tr:hover {
  background-color: #faf8f7;
}

.admin-table a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.admin-table a:hover {
  color: var(--intense-color);
  text-decoration: underline;
}

.admin-table .admin-row-actions {
  text-align: right;
  white-space: nowrap;
}

/* Stat tiles -------------------------------------------------------------- */

.admin-stat {
  display: block;
  background-color: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-top: 3px solid var(--intense-color);
  padding: 1.1rem 1.25rem;
  color: inherit;
  text-decoration: none;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.admin-stat:hover {
  box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  color: inherit;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.admin-stat-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--admin-muted);
}

/* Definition lists on show pages ------------------------------------------ */

.admin-definitions {
  margin: 0;
}

.admin-definitions dt {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--admin-muted);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.admin-definitions dd {
  margin-bottom: 1.25rem;
}

.admin-definitions dd:last-child {
  margin-bottom: 0;
}

.admin-definitions dd :last-child {
  margin-bottom: 0;
}

/* Forms ------------------------------------------------------------------- */

.admin .form-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--admin-muted);
}

.admin .form-control:focus,
.admin .form-select:focus {
  border-color: var(--intense-color);
  box-shadow: 0 0 0 0.15rem rgba(187, 39, 27, 0.15);
}

.admin trix-editor {
  min-height: 10rem;
  background-color: #fff;
  border-color: var(--admin-border);
}

.admin trix-toolbar .trix-button-group {
  border-color: var(--admin-border);
}

.admin .field_with_errors {
  display: contents;
}

.admin .field_with_errors .form-control,
.admin .field_with_errors .form-select {
  border-color: var(--intense-color);
}

/* Thumbnails -------------------------------------------------------------- */

.admin-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border: 1px solid var(--admin-border);
}

/* Empty state ------------------------------------------------------------- */

.admin-empty {
  padding: 3rem 1.25rem;
  text-align: center;
  color: var(--admin-muted);
}

.admin-empty i {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}

/* Reordering the attached images of a record. */
.image-order-list {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.image-order-item {
  position: relative;
  border: 2px solid transparent;
  border-radius: .5rem;
  padding: .25rem;
  cursor: grab;
  background: #fff;
}

.image-order-item.is-hero {
  border-color: var(--bs-primary, #b5332a);
}

.image-order-item.dragging {
  opacity: .4;
}

.image-order-thumb {
  display: block;
  width: 7rem;
  height: 7rem;
  object-fit: cover;
  border-radius: .35rem;
  pointer-events: none;
}

.image-order-hero-label {
  display: none;
  position: absolute;
  top: .5rem;
  left: .5rem;
  padding: .1rem .4rem;
  border-radius: .25rem;
  font-size: .7rem;
  background: var(--bs-primary, #b5332a);
  color: #fff;
}

.image-order-item.is-hero .image-order-hero-label {
  display: block;
}

.image-order-buttons {
  display: flex;
  justify-content: center;
  gap: .25rem;
  margin-top: .25rem;
}

.image-order-item.is-removing {
  opacity: .45;
  border-color: var(--bs-danger, #dc3545);
}

.image-order-remove {
  display: block;
  margin-top: .25rem;
  font-size: .75rem;
  color: #6c757d;
  text-align: center;
  cursor: pointer;
}

.admin-thumb-sm {
  width: 3rem;
  height: 3rem;
}
