/* === LibraryBrowserPopup base styles (table + preview layout) === */
/* Extracted from collection-editor-unified.css for reuse across pages */

/* ---- Filters container ---- */
.library-browser-popup .lbp-filters-container {
  padding: 0 14px;
  flex-shrink: 0;
}

.library-browser-popup .lbp-table-header {
  padding: 0 0 0.25rem;
}
.library-browser-popup .lbp-table-search-pill {
  margin: 0;
}
.library-browser-popup .lbp-table-search-input {
  margin: 0;
}

/* Dropdowns row */
.library-browser-popup .lbp-dropdowns-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 6px;
}

/* Type dropdown */
.library-browser-popup .lbp-type-dropdown {
  position: relative;
  z-index: 10;
}

.library-browser-popup .library-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm, 4px);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.library-browser-popup .library-dropdown-trigger:hover {
  background: rgba(0, 168, 255, 0.15);
  border-color: rgba(0, 168, 255, 0.3);
}

.library-browser-popup .library-filter-dropdown.open .library-dropdown-trigger {
  background: rgba(0, 168, 255, 0.2);
  border-color: rgba(0, 168, 255, 0.5);
  box-shadow: 0 0 8px rgba(0, 168, 255, 0.3);
}

.library-browser-popup .library-dropdown-label {
  color: rgba(255, 255, 255, 0.5);
}

.library-browser-popup .library-dropdown-value {
  color: white;
}

.library-browser-popup .library-dropdown-chevron {
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.library-browser-popup .library-filter-dropdown.open .library-dropdown-chevron {
  transform: rotate(180deg);
}

.library-browser-popup .library-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 140px;
  background: var(--color-bg-base-mid, #0c0c0e);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 0.25rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  z-index: 100;
}

.library-browser-popup .library-filter-dropdown.open .library-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.library-browser-popup .library-dropdown-option {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 4px);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.library-browser-popup .library-dropdown-option:hover {
  background: rgba(0, 168, 255, 0.15);
  color: white;
}

.library-browser-popup .library-dropdown-group {
  position: relative;
}

.library-browser-popup .library-dropdown-option.has-submenu {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.library-browser-popup .library-dropdown-option.has-submenu .submenu-chevron {
  margin-left: 0.5rem;
  opacity: 0.5;
  font-size: 0.85em;
}

.library-browser-popup .library-dropdown-submenu {
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 160px;
  background: var(--color-bg-base-mid, #0c0c0e);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 0.25rem;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-4px);
  transition: all 0.15s ease;
  z-index: 101;
}

.library-browser-popup .library-dropdown-group:hover > .library-dropdown-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.library-browser-popup .library-dropdown-option .check-icon {
  display: inline-block;
  width: 14px;
  margin-right: 0.35rem;
  opacity: 0;
  font-size: 0.75rem;
  color: rgba(0, 168, 255, 0.9);
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.library-browser-popup .library-dropdown-option.selected .check-icon {
  opacity: 1;
}

.library-browser-popup .library-filter-dropdown.multi-select.open .library-dropdown-menu {
  opacity: 1;
  visibility: visible;
}

/* ---- Topic filter bar ---- */
.library-browser-popup .discovery-bar-section {
  padding: 0;
  margin-bottom: 0;
}

.library-browser-popup .lbp-topic-filter-section {
  padding: 0.25rem 0 0.5rem;
  margin: 0;
  min-height: 36px;
  position: relative;
  z-index: 5;
}

.library-browser-popup .lbp-topic-filter-section .discovery-bar-wrapper {
  display: flex;
  padding: 0;
}

.library-browser-popup .lbp-topic-filter-section .discovery-bar {
  display: flex;
  align-items: center;
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md, 8px);
  padding: 0.5rem 0.75rem;
  min-height: 36px;
}

.library-browser-popup .lbp-topic-filter-section .discovery-links-wrapper {
  display: flex;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  align-items: center;
}

.library-browser-popup .lbp-topic-filter-section .discovery-links {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0;
}

.library-browser-popup .lbp-topic-filter-section .discovery-links::-webkit-scrollbar {
  display: none;
}

.library-browser-popup .lbp-topic-filter-section .discovery-link {
  display: inline-flex;
  font-size: 0.75rem;
  margin: 0;
}

.library-browser-popup .lbp-topic-filter-section .discovery-search-input {
  margin: 0;
}

.library-browser-popup .lbp-topic-filter-section .active-filters-row {
  padding: 0.4rem 0 0;
  margin-top: 0;
}

/* ---- Body: table + preview side by side ---- */
.library-browser-popup .lbp-body {
  display: flex;
  flex: 1;
  min-height: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Table panel (left — 50%) */
.library-browser-popup .lbp-table-panel {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  max-width: 50%;
  display: flex;
  flex-direction: column;
}

.library-browser-popup .lbp-table-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.library-browser-popup .lbp-table-scroll::-webkit-scrollbar {
  display: none;
}

.library-browser-popup .lbp-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 2px;
  font-size: 12px;
}

.library-browser-popup .lbp-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  background: transparent;
}

.library-browser-popup .lbp-table th:first-child { padding-left: 14px; }

.library-browser-popup .lbp-col-check { width: 30px; }
.library-browser-popup .lbp-col-name { overflow: hidden; }
.library-browser-popup .lbp-col-type { width: 80px; white-space: nowrap; }

.library-browser-popup .lbp-table td {
  padding: 7px 8px;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.015);
  transition: background 0.15s ease;
}

.library-browser-popup .lbp-table td:first-child { padding-left: 14px; border-radius: 6px 0 0 6px; }
.library-browser-popup .lbp-table td:last-child { border-radius: 0 6px 6px 0; }

.library-browser-popup .lbp-table tbody tr {
  cursor: pointer;
}

.library-browser-popup .lbp-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.06);
}

.library-browser-popup .lbp-table tbody tr.hovered td {
  background: rgba(255, 255, 255, 0.04);
}

.library-browser-popup .lbp-table tbody tr.selected td {
  background: rgba(0, 168, 255, 0.12);
}

.library-browser-popup .lbp-table tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 0 #00a8ff;
}

/* Row name */
.library-browser-popup .lbp-row-name {
  display: block;
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Row type badge */
.library-browser-popup .lbp-row-type {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.library-browser-popup .lbp-row-type svg {
  width: 13px;
  height: 13px;
  min-width: 13px;
  flex-shrink: 0;
}

.library-browser-popup .lbp-row-type.twitter { color: #1da1f2; }
.library-browser-popup .lbp-row-type.youtube { color: #ff0000; }
.library-browser-popup .lbp-row-type.tiktok { color: #00f2ea; }
.library-browser-popup .lbp-row-type.instagram { color: #e4405f; }
.library-browser-popup .lbp-row-type.espn { color: #d00; }
.library-browser-popup .lbp-row-type.substack { color: #ff6719; }
.library-browser-popup .lbp-row-type.generic { color: #6b7280; }
.library-browser-popup .lbp-row-type.uploaded_media { color: rgba(255,255,255,0.7); }

/* Checkbox for multi-select */
.library-browser-popup .lbp-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  font-size: 11px;
  color: transparent;
  transition: all 0.15s ease;
}

.library-browser-popup .lbp-check.checked {
  background: #00a8ff;
  border-color: #00a8ff;
  color: #fff;
}

/* Preview panel (right — 50%) */
.library-browser-popup .lbp-preview-panel {
  flex: 0 0 50%;
  width: 50%;
  min-width: 0;
  max-width: 50%;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.library-browser-popup .lbp-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 200px;
  color: rgba(255, 255, 255, 0.3);
  gap: 10px;
  text-align: center;
  padding: 16px;
  font-size: 12px;
}

.library-browser-popup .lbp-preview-empty svg { opacity: 0.4; }

.library-browser-popup .lbp-preview-content {
  padding: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

.library-browser-popup .lbp-preview-content > * {
  max-width: 100%;
  box-sizing: border-box;
}

/* Loading / empty / load more */
.library-browser-popup .lbp-loading,
.library-browser-popup .lbp-empty {
  text-align: center;
  padding: 20px 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.library-browser-popup .lbp-load-more {
  text-align: center;
  padding: 8px 0;
}

.library-browser-popup .lbp-load-more-btn {
  padding: 5px 14px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.library-browser-popup .lbp-load-more-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Multi-select footer */
.library-browser-popup .lbp-footer {
  padding: 8px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.library-browser-popup .lbp-add-selected-btn {
  width: 100%;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  background: #00a8ff;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.library-browser-popup .lbp-add-selected-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.library-browser-popup .lbp-add-selected-btn:not(:disabled):hover {
  opacity: 0.85;
}
