/* Plugin: edengallery — Image viewer + lightbox */

.edengallery-window {
  position: fixed;
  display: flex;
  flex-direction: column;
  background: rgba(10, 12, 18, 0.97);
  border: 1px solid rgba(88, 200, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 24px rgba(88, 200, 255, 0.10);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e8edf3;

  --egal-bg: #0a0c12;
  --egal-bg-card: #11151c;
  --egal-bg-input: #161b24;
  --egal-border: #2a3140;
  --egal-text: #e8edf3;
  --egal-text-muted: #8a96a8;
  --egal-text-dim: #5a6678;
  --egal-accent: #58c8ff;
  --egal-danger: #ef4444;
}
.edengallery-window.edengallery-window-maximized { border-radius: 0; box-shadow: none; }

.edengallery-window-titlebar {
  display: flex; align-items: center; height: 32px; padding: 0 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--egal-border);
  cursor: grab; user-select: none; flex-shrink: 0;
}
.edengallery-window-title {
  font-size: 13px; font-weight: 600; margin-left: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.edengallery-window-body {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
  position: relative; background: var(--egal-bg);
}
.edengallery-window-body.egal-dropping {
  outline: 3px dashed var(--egal-accent);
  outline-offset: -10px;
}

/* Toolbar */
.edengallery-window .egal-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--egal-bg-card);
  border-bottom: 1px solid var(--egal-border);
  flex-shrink: 0;
}
.edengallery-window .egal-select,
.edengallery-window .egal-search {
  padding: 6px 10px;
  background: var(--egal-bg-input);
  border: 1px solid var(--egal-border);
  color: var(--egal-text);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
}
.edengallery-window .egal-dir-select { min-width: 200px; }
.edengallery-window .egal-search { width: 160px; }
.edengallery-window .egal-toolbar-spacer { flex: 1; }
.edengallery-window .egal-btn {
  padding: 6px 12px;
  background: var(--egal-bg-input);
  border: 1px solid var(--egal-border);
  color: var(--egal-text);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.edengallery-window .egal-btn:hover { border-color: var(--egal-accent); color: var(--egal-accent); }
.edengallery-window .egal-btn.active { border-color: var(--egal-accent); color: var(--egal-accent); background: rgba(88, 200, 255, 0.12); }

/* Grid */
.edengallery-window .egal-grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  align-content: start;
}
.edengallery-window .egal-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 12px;
  color: var(--egal-text-dim);
  font-size: 13px;
}

.edengallery-window .egal-thumb {
  background: var(--egal-bg-card);
  border: 1px solid var(--egal-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  flex-direction: column;
}
.edengallery-window .egal-thumb:hover {
  border-color: var(--egal-accent);
  box-shadow: 0 0 0 1px var(--egal-accent);
}
.edengallery-window .egal-thumb-imgwrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #050608;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.edengallery-window .egal-thumb-imgwrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.edengallery-window .egal-thumb-loading {
  font-size: 24px;
  color: var(--egal-text-dim);
}
.edengallery-window .egal-thumb-name {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--egal-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'JetBrains Mono', monospace;
}

/* Status bar */
.edengallery-window .egal-statusbar {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 12px;
  background: var(--egal-bg-card);
  border-top: 1px solid var(--egal-border);
  font-size: 11px;
  color: var(--egal-text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

/* Lightbox */
.edengallery-window .egal-lightbox {
  position: absolute;
  inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
}
.edengallery-window .egal-lb-backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 6, 8, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.edengallery-window .egal-lb-img {
  position: relative;
  max-width: calc(100% - 80px);
  max-height: calc(100% - 80px);
  object-fit: contain;
  z-index: 1;
  border-radius: 6px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
}
.edengallery-window .egal-lb-close,
.edengallery-window .egal-lb-prev,
.edengallery-window .egal-lb-next {
  position: absolute;
  background: rgba(17, 21, 28, 0.85);
  color: var(--egal-text);
  border: 1px solid var(--egal-border);
  border-radius: 50%;
  width: 44px; height: 44px;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.edengallery-window .egal-lb-close:hover,
.edengallery-window .egal-lb-prev:hover,
.edengallery-window .egal-lb-next:hover {
  border-color: var(--egal-accent);
  color: var(--egal-accent);
}
.edengallery-window .egal-lb-close { top: 16px; right: 16px; }
.edengallery-window .egal-lb-prev  { left: 16px; top: 50%; transform: translateY(-50%); }
.edengallery-window .egal-lb-next  { right: 16px; top: 50%; transform: translateY(-50%); }
.edengallery-window .egal-lb-caption {
  position: absolute;
  bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(17, 21, 28, 0.85);
  color: var(--egal-text);
  border: 1px solid var(--egal-border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  z-index: 2;
  white-space: nowrap;
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Context menu */
.egal-ctxmenu {
  z-index: 99999;
  background: rgba(17, 21, 28, 0.97);
  border: 1px solid #2a3140;
  border-radius: 8px;
  padding: 4px;
  min-width: 180px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  user-select: none;
}
.egal-ctx-item {
  padding: 7px 12px;
  font-size: 12px;
  color: #e8edf3;
  border-radius: 4px;
  cursor: pointer;
}
.egal-ctx-item:hover {
  background: rgba(88, 200, 255, 0.10);
  color: #58c8ff;
}
.egal-ctx-item.danger:hover {
  background: rgba(239, 68, 68, 0.10);
  color: #ef4444;
}
