/* Front-end admin UI */
.dm-hotspot {
  position: fixed;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  z-index: 99980;
  cursor: default;
  background: transparent;
}

.dm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  background: rgba(26, 28, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.dm-overlay[hidden],
.dm-panel[hidden],
.dm-drawer[hidden],
.dm-bar[hidden] {
  display: none !important;
}

.dm-modal {
  width: min(100%, 380px);
  background: #fff;
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}

.dm-modal h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display, sans-serif);
  font-size: 1.35rem;
}

.dm-modal .dm-hint {
  margin: 0 0 1rem;
  color: #646970;
  font-size: 0.9rem;
}

.dm-modal .field {
  margin-bottom: 0.85rem;
}

.dm-modal .field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
  color: #50575e;
}

.dm-modal .field input,
.dm-drawer .field input,
.dm-drawer .field select,
.dm-drawer .field textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  font: inherit;
}

.dm-error {
  color: #b32d2e;
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
  min-height: 1.2em;
}

.dm-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.dm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.95rem;
  border-radius: 4px;
  border: 1px solid transparent;
  font-family: var(--font-display, sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  background: #f0f0f1;
  color: #1d2327;
}

.dm-btn-primary {
  background: #ff7a07;
  color: #fff;
  border-color: #ff7a07;
}

.dm-btn-danger {
  background: #fff;
  color: #b32d2e;
  border-color: #b32d2e;
}

.dm-btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.dm-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99985;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  background: #1a1c1e;
  color: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  font-family: var(--font-display, sans-serif);
}

body.dm-admin-on {
  padding-top: 52px;
}

/* Front-admin sessions never show the WP toolbar */
body.dm-front-admin-session #wpadminbar {
  display: none !important;
}

body.dm-front-admin-session.admin-bar {
  margin-top: 0 !important;
  padding-top: 52px;
}

html.dm-front-admin-session {
  margin-top: 0 !important;
}

.dm-bar-left,
.dm-bar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dm-bar-brand {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.dm-bar-brand span {
  color: #ff7a07;
}

.dm-bar-user {
  font-size: 0.8rem;
  opacity: 0.75;
}

.dm-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.dm-toggle input {
  accent-color: #ff7a07;
}

.dm-panel {
  position: fixed;
  top: 52px;
  right: 0;
  bottom: 0;
  width: min(100%, 380px);
  z-index: 99986;
  background: #fff;
  border-left: 1px solid #dcdcde;
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
}

.dm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #dcdcde;
}

.dm-panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.dm-panel-list {
  flex: 1;
  overflow: auto;
  padding: 0.5rem;
}

.dm-vehicle-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
}

.dm-vehicle-row:hover {
  background: #f6f7f7;
  border-color: #dcdcde;
}

.dm-vehicle-row img {
  width: 56px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  background: #e8eaed;
}

.dm-vehicle-row strong {
  display: block;
  font-size: 0.88rem;
  line-height: 1.25;
}

.dm-vehicle-row small {
  color: #646970;
}

.dm-drawer {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99988;
  background: rgba(26, 28, 30, 0.45);
  display: flex;
  justify-content: flex-end;
}

.dm-drawer-inner {
  width: min(100%, 480px);
  height: 100%;
  background: #fff;
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.dm-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #dcdcde;
}

.dm-drawer-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.dm-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 1rem;
}

.dm-drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.dm-drawer-grid .full {
  grid-column: 1 / -1;
}

.dm-image-uploader .dm-image-note {
  margin: 0.25rem 0 0.75rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #50575e;
}

.dm-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.dm-image-empty {
  margin: 0;
  padding: 1rem;
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.85rem;
  color: #646970;
  background: #f6f7f7;
  border: 1px dashed #c3c4c7;
}

.dm-image-item {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #1a1c1e;
  border: 1px solid #dcdcde;
}

.dm-image-item.is-featured {
  border-color: #ff7a07;
  box-shadow: inset 0 0 0 2px #ff7a07;
}

.dm-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dm-image-badge {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
  background: #ff7a07;
}

.dm-image-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.35rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}

.dm-btn-tiny {
  padding: 0.2rem 0.45rem !important;
  font-size: 0.7rem !important;
  line-height: 1.2 !important;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: transparent !important;
}

.dm-btn-tiny:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

.dm-image-upload-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dm-upload-label {
  cursor: pointer;
  margin: 0;
}

.dm-image-status {
  font-size: 0.82rem;
  color: #646970;
}

.dm-drawer-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-top: 1px solid #dcdcde;
  background: #f6f7f7;
}

.dm-drawer-foot .dm-foot-right {
  display: flex;
  gap: 0.5rem;
}

body.dm-edit-mode .vehicle-card {
  outline: 2px dashed rgba(255, 122, 7, 0.85);
  outline-offset: 3px;
  cursor: pointer;
}

body.dm-edit-mode .vehicle-card::after {
  content: "Edit";
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: #ff7a07;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-display, sans-serif);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  pointer-events: none;
}

body.dm-edit-mode .vehicle-card {
  position: relative;
}

body.dm-edit-mode [data-vehicle-detail-page] {
  outline: 2px dashed rgba(255, 122, 7, 0.5);
  outline-offset: -4px;
}

.dm-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  background: #1a1c1e;
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.dm-toast[hidden] {
  display: none !important;
}

@media (max-width: 600px) {
  .dm-drawer-grid {
    grid-template-columns: 1fr;
  }
}
