/**
 * media-picker.css — the "choose an image from your library" overlay
 * (window.CBMediaPicker, js/media-picker.js — Video Studio R2.1).
 * Same explicit palette as video-tools.css (mounted outside the outreach
 * dashboard's token scope). Sits ABOVE the Polish tray (4600 > 4000).
 */

.cbmp-overlay {
  position: fixed; inset: 0; z-index: 4600;
  background: rgba(13, 8, 25, 0.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.cbmp-modal {
  background: #ffffff; color: #15172b;
  width: 100%; max-width: 720px; max-height: min(640px, calc(100vh - 40px));
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(13, 8, 25, 0.35);
  display: flex; flex-direction: column;
  animation: cbmp-pop 0.2s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes cbmp-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .cbmp-modal { animation: none; } }

.cbmp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 10px; flex: none;
}
.cbmp-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.cbmp-close {
  flex: none; border: none; background: transparent; font-size: 22px; line-height: 1;
  color: #9ca3af; cursor: pointer; min-width: 32px; min-height: 32px;
}
.cbmp-close:hover { color: #374151; }

.cbmp-toolbar {
  display: flex; gap: 8px; padding: 0 18px 12px; flex: none;
}
.cbmp-toolbar input[type="search"] {
  flex: 1; min-width: 0;
  border: 1px solid #d0d3e0; border-radius: 8px; padding: 8px 12px;
  font-size: 13px; font-family: inherit;
}
.cbmp-toolbar input[type="search"]:focus { outline: none; border-color: #6a4cf1; }
.cbmp-upload-btn {
  flex: none; border: 1px solid #d0d3e0; border-radius: 8px; background: #fff;
  color: #374151; font-size: 12.5px; font-weight: 600; padding: 8px 14px;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}
.cbmp-upload-btn:hover { border-color: #6a4cf1; color: #6a4cf1; }

.cbmp-grid {
  flex: 1; min-height: 200px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; padding: 2px 18px 14px;
  align-content: start;
}
.cbmp-thumb {
  aspect-ratio: 16 / 10; padding: 0; overflow: hidden;
  border: 2px solid transparent; border-radius: 10px;
  background: #f3f4f6; cursor: pointer;
}
.cbmp-thumb:hover { border-color: #6a4cf1; }
.cbmp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cbmp-note { grid-column: 1 / -1; font-size: 12.5px; color: #6b7280; padding: 24px 0; text-align: center; }
.cbmp-note.error { color: #c0423a; }
.cbmp-status { flex: none; font-size: 12px; color: #6b7280; padding: 0 18px 12px; min-height: 16px; }
.cbmp-status.error { color: #c0423a; }

@media (max-width: 480px) {
  .cbmp-overlay { padding: 0; align-items: flex-end; }
  .cbmp-modal { max-width: 100%; border-radius: 16px 16px 0 0; }
  .cbmp-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
