/* Deal Media Picker. Monochrome, deal-grouped, search + selection counter. */

/* Trigger button shown next to upload widgets. */
[data-deal-media-picker] {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  padding: 8px 14px;
  background: #fff; color: #000;
  border: 1.5px solid #000; border-radius: 999px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
[data-deal-media-picker]:hover:not(:disabled) { background: #000; color: #fff; }
[data-deal-media-picker]:disabled { opacity: .55; cursor: wait; }

.dmp-picks { margin-top: 8px; }

/* Modal overlay. */
.dmp-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.62);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  padding: 16px;
  animation: dmp-fade .15s ease-out;
}
@keyframes dmp-fade { from { opacity: 0; } to { opacity: 1; } }

.dmp-panel {
  background: #fff; color: #111;
  width: 100%; max-width: 1080px;
  max-height: 90vh; overflow: hidden;
  border-radius: 16px;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
}

.dmp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 14px;
}
.dmp-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.dmp-close {
  background: transparent; border: 0; font-size: 28px; line-height: 1;
  cursor: pointer; color: #555; padding: 0 6px;
}
.dmp-close:hover { color: #000; }

.dmp-sub {
  padding: 0 24px 12px;
  font-size: 13px; color: #666;
}

.dmp-search-wrap { padding: 4px 24px 14px; border-bottom: 1px solid #eee; }
.dmp-search {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid #d4d4d4;
  border-radius: 10px;
  background: #fff; color: #111;
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease;
}
.dmp-search:focus { border-color: #000; }
.dmp-search::placeholder { color: #999; }

/* Scrollable body containing deal sections. */
.dmp-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 24px;
  background: #fafafa;
}

/* Each deal is a section header + a grid of its media. */
.dmp-group { margin-bottom: 28px; }
.dmp-group:last-child { margin-bottom: 8px; }
.dmp-group-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e5e5;
}
.dmp-group-title {
  font-size: 14px; font-weight: 800; color: #111;
  letter-spacing: -0.005em;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dmp-group-count {
  font-size: 11px; font-weight: 700; color: #777;
  text-transform: uppercase; letter-spacing: 0.08em;
}

.dmp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.dmp-card {
  position: relative;
  border: 2px solid #e5e5e5; border-radius: 12px;
  overflow: hidden; cursor: pointer;
  background: #fff;
  transition: border-color .12s ease, transform .05s ease, box-shadow .12s ease;
  outline: none;
}
.dmp-card:hover { border-color: #999; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.06); }
.dmp-card:focus-visible { border-color: #000; box-shadow: 0 0 0 3px rgba(0,0,0,0.08); }
.dmp-card.selected {
  border-color: #000;
  box-shadow: 0 0 0 3px #000 inset;
}

.dmp-check {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; color: transparent;
  border: 2px solid #000;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
  pointer-events: none;
  transition: background .12s, color .12s;
}
.dmp-card.selected .dmp-check {
  background: #000; color: #fff;
}

.dmp-thumb {
  position: relative;
  aspect-ratio: 1; width: 100%;
  background: #f0f0f0;
}
.dmp-thumb img, .dmp-thumb video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.dmp-badge {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0,0,0,0.78); color: #fff;
  font-size: 10px; font-weight: 800;
  padding: 3px 8px; border-radius: 999px;
  letter-spacing: .06em;
}

/* Empty state. */
.dmp-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 48px 16px;
  color: #777;
}
.dmp-empty-icon { color: #d4d4d4; margin-bottom: 14px; }
.dmp-empty-title { font-size: 16px; font-weight: 700; color: #111; margin-bottom: 6px; }
.dmp-empty-sub { font-size: 13px; color: #777; }

/* Footer with selection counter + actions. */
.dmp-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid #eee;
  background: #fff;
}
.dmp-counter {
  font-size: 13px; font-weight: 700; color: #111;
}
.dmp-footer-actions { display: flex; gap: 10px; }
.dmp-cancel, .dmp-confirm {
  padding: 10px 22px; border-radius: 999px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit;
}
.dmp-cancel  { background: #fff; color: #000; border: 1.5px solid #111; }
.dmp-cancel:hover { background: #f5f5f5; }
.dmp-confirm { background: #000; color: #fff; border: 1.5px solid #000; }
.dmp-confirm:hover:not(:disabled) { background: #222; }
.dmp-confirm:disabled { opacity: .35; cursor: not-allowed; }

/* Picked cards re-use .au-card / .au-pill style. */
.dmp-picked-card .au-pill[data-state="done"] {
  background: #f3f3f3; color: #333;
}

/* Mobile: stack actions, smaller padding. */
@media (max-width: 600px) {
  .dmp-overlay { padding: 0; }
  .dmp-panel { max-height: 100vh; border-radius: 0; }
  .dmp-header { padding: 16px 16px 10px; }
  .dmp-sub, .dmp-search-wrap { padding-left: 16px; padding-right: 16px; }
  .dmp-body { padding: 12px 16px 16px; }
  .dmp-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dmp-footer { padding: 12px 16px; flex-direction: column; gap: 10px; align-items: stretch; }
  .dmp-footer-actions { justify-content: flex-end; }
}
