/* ============================================================
   FMI Masonry Gallery - Lightbox Collections v1.0
   "Add to lightbox" dropdown from image detail modal
   ============================================================ */

/* ── PLUS BUTTON WRAPPER ── */
/* ── LIGHTBOX DROPDOWN ── 
   The dropdown is appended inside .fmi-mg-modal-actions (the grid container).
   modal-actions is position:relative so the dropdown anchors to the full button block. */

/* ── DROPDOWN ── */
.fmi-mg-lb-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  width: auto;
  min-width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  z-index: 100;
  overflow: hidden;
}

/* ── SEARCH ── */
.fmi-mg-lb-search-wrap {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 12px 12px 0 0;
}

.fmi-mg-lb-search-wrap .fmi-mg-lb-search-icon {
  flex-shrink: 0;
}

.fmi-mg-lb-search {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  color: #333;
  width: 100%;
  padding: 0;
  margin: 0;
  line-height: 1.4;
}

.fmi-mg-lb-search::placeholder {
  color: #999;
}

/* ── LIST ── */
.fmi-mg-lb-list-wrap {
  max-height: 260px;
  overflow-y: auto;
  padding: 8px 0;
}

.fmi-mg-lb-list-label {
  padding: 4px 16px 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── LIGHTBOX ROW (item + delete) ── */
.fmi-mg-lb-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
}

.fmi-mg-lb-row .fmi-mg-lb-item {
  flex: 1;
  padding: 10px 8px 10px 16px;
}

.fmi-mg-lb-delete-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  padding: 0;
  outline: none;
}

.fmi-mg-lb-delete-btn:hover {
  color: #e55;
  background: rgba(220, 50, 50, 0.08);
}

/* ── LIGHTBOX ITEM ── */
.fmi-mg-lb-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
  font-family: 'Poppins', sans-serif;
  outline: none;
  box-shadow: none;
}

.fmi-mg-lb-item:hover {
  background: #f7f7f7;
}

.fmi-mg-lb-item:focus {
  outline: none;
  box-shadow: none;
}

.fmi-mg-lb-item.adding {
  opacity: 0.7;
  pointer-events: none;
}

.fmi-mg-lb-item.added {
  background: rgba(124, 92, 252, 0.06);
}

/* Thumbnail */
.fmi-mg-lb-item-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: #eee;
}

.fmi-mg-lb-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fmi-mg-lb-item-thumb-empty {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e8e4f0 0%, #ddd 100%);
}

/* Info */
.fmi-mg-lb-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fmi-mg-lb-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fmi-mg-lb-item-count {
  font-size: 12px;
  color: #999;
}

/* Check mark — hidden by default, shown on .added */
.fmi-mg-lb-item-check {
  display: none;
  flex-shrink: 0;
}

.fmi-mg-lb-item.added .fmi-mg-lb-item-check {
  display: block;
}

/* ── EMPTY / LOADING ── */
.fmi-mg-lb-empty {
  padding: 20px 16px;
  text-align: center;
  color: #999;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
}

.fmi-mg-lb-loading {
  text-align: center;
  padding: 16px;
  color: #7c5cfc;
  font-size: 18px;
}

/* ── CREATE NEW ── */
.fmi-mg-lb-create-wrap {
  border-top: 1px solid #eee;
  padding: 12px 16px;
}

.fmi-mg-lb-create-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  padding: 0;
  outline: none;
  box-shadow: none;
  transition: color 0.15s;
}

.fmi-mg-lb-create-btn:hover {
  color: #7c5cfc;
}

.fmi-mg-lb-create-btn:focus {
  outline: none;
  box-shadow: none;
}

.fmi-mg-lb-create-form {
  display: flex;
  gap: 8px;
}

.fmi-mg-lb-create-input {
  flex: 1;
  border: 1.5px solid #7c5cfc;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  outline: none;
  color: #333;
  background: #fff;
  box-shadow: none;
}

.fmi-mg-lb-create-input:focus {
  outline: none;
  border-color: #6a4ce0;
  box-shadow: 0 0 0 3px rgba(124, 92, 252, 0.1);
}

.fmi-mg-lb-create-submit {
  padding: 8px 14px;
  background: #7c5cfc;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  outline: none;
  box-shadow: none;
}

.fmi-mg-lb-create-submit:hover {
  background: #6a4ce0;
}

.fmi-mg-lb-create-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── TOAST ── */
.fmi-mg-lb-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1a1a2e;
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  z-index: 200000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.fmi-mg-lb-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── DROPDOWN POSITIONING ── */
/* .fmi-mg-modal-actions is position:relative, so dropdown anchors below the full button grid */

/* Ensure actions grid has relative positioning for dropdown */
.fmi-mg-modal-actions {
  position: relative;
}

/* ── RESPONSIVE ── */

/* On mobile, dropdown goes full-width of the actions container */
@media (max-width: 768px) {
  .fmi-mg-lb-dropdown {
    left: 0;
    right: 0;
    width: auto;
  }

  .fmi-mg-lb-toast {
    left: 20px;
    right: 20px;
    transform: translateX(0) translateY(10px);
    text-align: center;
    justify-content: center;
  }

  .fmi-mg-lb-toast.visible {
    transform: translateX(0) translateY(0);
  }
}

/* Landscape layout — dropdown stays full-width of actions */
.fmi-mg-modal-content.landscape-image .fmi-mg-lb-dropdown {
  left: 0;
  right: 0;
  width: auto;
}


/* Info panel needs visible overflow so dropdown can float above metadata */
.fmi-mg-modal-info {
  overflow: visible !important;
}

/* ── LIGHTBOX PANEL ── */

.fmi-lb-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 110000;
  visibility: hidden;
  pointer-events: none;
  transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, visibility 0s linear 0.4s;
}

.fmi-lb-panel-overlay.active {
  visibility: visible;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, visibility 0s linear 0s;
}

/* Panel: starts off-screen right + slightly scaled down */
.fmi-lb-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: #fff;
  z-index: 110001;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 60px rgba(0, 0, 0, 0.22), -2px 0 8px rgba(0, 0, 0, 0.08);
  transform: translateX(110%) scale(0.97);
  transform-origin: right center;
  opacity: 0;
  /* Spring-like: fast start, gentle overshoot settle */
  transition:
    transform 0.48s cubic-bezier(0.22, 1, 0.36, 1),
    opacity   0.32s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.48s ease;
  will-change: transform, opacity;
}

.fmi-lb-panel.active {
  transform: translateX(0) scale(1);
  opacity: 1;
}

/* Staggered entrance for list rows */
.fmi-lb-list-panel.active .fmi-lb-list-row {
  animation: fmi-lb-row-in 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(1)  { animation-delay: 0.12s; }
.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(2)  { animation-delay: 0.17s; }
.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(3)  { animation-delay: 0.22s; }
.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(4)  { animation-delay: 0.27s; }
.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(5)  { animation-delay: 0.30s; }
.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(6)  { animation-delay: 0.33s; }
.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(7)  { animation-delay: 0.35s; }
.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(8)  { animation-delay: 0.37s; }
.fmi-lb-list-panel.active .fmi-lb-list-row:nth-child(n+9){ animation-delay: 0.38s; }

@keyframes fmi-lb-row-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Header slides in from slightly above */
.fmi-lb-panel .fmi-lb-panel-header {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.3s ease 0.1s, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
}
.fmi-lb-panel.active .fmi-lb-panel-header {
  opacity: 1;
  transform: translateY(0);
}

/* Header */
.fmi-lb-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.fmi-lb-panel-back,
.fmi-lb-list-close {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1.5px solid #7c5cfc;
  background: transparent;
  color: #7c5cfc;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 14px 5px 10px;
  border-radius: 50px;
  transition: background 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  outline: none;
  white-space: nowrap;
}

.fmi-lb-panel-back:hover,
.fmi-lb-list-close:hover {
  background: #7c5cfc;
  color: #ffffff;
}

.fmi-lb-panel-back:hover svg,
.fmi-lb-list-close:hover svg {
  stroke: #ffffff;
}

.fmi-lb-panel-title {
  flex: 1;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fmi-lb-panel-count {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  color: #999;
  flex-shrink: 0;
}

/* Body / grid */
.fmi-lb-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.fmi-lb-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.fmi-lb-panel-loading,
.fmi-lb-panel-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 0;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: #999;
}

/* Image cards */
.fmi-lb-panel-card {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
  cursor: pointer;
}

.fmi-lb-panel-card-img {
  width: 100%;
  height: 100%;
}

.fmi-lb-panel-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.fmi-lb-panel-card:hover .fmi-lb-panel-card-img img {
  transform: scale(1.04);
}

/* Remove button */
.fmi-lb-panel-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  padding: 0;
  outline: none;
}

.fmi-lb-panel-card:hover .fmi-lb-panel-remove {
  opacity: 1;
}

.fmi-lb-panel-remove:hover {
  background: rgba(220,50,50,0.85);
}

/* Prevent body scroll when panel is open */
body.fmi-lb-panel-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .fmi-lb-panel {
    width: 100vw;
  }
  .fmi-lb-panel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Lightbox List Panel (nav button → My Lightboxes) ─────────────────── */
.fmi-lb-list-panel .fmi-lb-list-panel-grid {
  padding: 12px 0;
}

.fmi-lb-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s ease;
}

.fmi-lb-list-row:hover {
  background: #f8f8f8;
}

.fmi-lb-list-row-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  color: #1a1a1a;
}

.fmi-lb-list-row-count {
  font-size: 12px;
  color: #888;
  font-family: 'Poppins', sans-serif;
  white-space: nowrap;
}

.fmi-lb-list-row-arrow {
  color: #bbb;
  flex-shrink: 0;
}

/* Trash button on list row */
.fmi-lb-list-row-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #ccc;
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease;
  outline: none;
}

.fmi-lb-list-row-delete:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.06);
}

.fmi-lb-list-row-delete:focus {
  outline: none;
}

