/* Wyszukiwarka (obok „Dodaj zdjęcie” lub w bocznej kolumnie) + modal podglądu */
#editorial-photo-toolbar-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin-bottom: 0.65rem;
  box-sizing: border-box;
}

#editorial-photo-toolbar-wrap #editorial-photo-search-bar.editorial-photo-search-bar--toolbar {
  flex: 1 1 220px;
  max-width: min(100%, 520px);
  margin-bottom: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}

#editorial-photo-toolbar-wrap #editorial-photo-search-bar .editorial-photo-search-title {
  flex: 0 0 auto;
}

#editorial-photo-toolbar-wrap #editorial-photo-search-bar input[type='search'] {
  flex: 1 1 160px;
  min-width: 120px;
}

#editorial-photo-toolbar-wrap #editorial-photo-search-bar button {
  align-self: center;
}

#editorial-photo-search-bar {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.65rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  border: 1px solid hsl(var(--border, 214 32% 31%) / 0.65);
  background: hsl(var(--card, 222 47% 11%) / 0.75);
  color: hsl(var(--card-foreground, 210 40% 98%));
  font: 13px/1.4 system-ui, -apple-system, sans-serif;
}

#editorial-photo-search-bar .editorial-photo-search-title {
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  opacity: 0.95;
}

#editorial-photo-search-bar .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#editorial-photo-search-bar input[type='search'] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid hsl(var(--input, 214 32% 31%));
  background: hsl(var(--background, 222 47% 11%));
  color: hsl(var(--foreground, 210 40% 98%));
}

#editorial-photo-search-bar button {
  align-self: flex-start;
  padding: 0.4rem 0.65rem;
  border-radius: 6px;
  border: 1px solid hsl(var(--border, 214 32% 31%));
  background: hsl(var(--secondary, 217 33% 17%));
  color: inherit;
  cursor: pointer;
  font: inherit;
}

#editorial-photo-search-bar button:hover {
  filter: brightness(1.08);
}

/* Nad warstwą Radix Dialog (z-50) — bez ekstremalnego z-index (psuje klik / focus w niektórych przeglądarkach). */
#editorial-photo-view-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  isolation: isolate;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  pointer-events: auto;
}

#editorial-photo-view-dialog {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1200px);
  max-height: 94vh;
  width: 100%;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #334155;
  pointer-events: auto;
}

#editorial-photo-view-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.95);
  color: #f8fafc;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

#editorial-photo-view-stage {
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: min(72vh, 820px);
  overflow: auto;
  background: #020617;
  padding: 0.5rem;
}

#editorial-photo-view-stage img {
  display: block;
  max-width: 100%;
  height: auto;
  transform-origin: center center;
  transition: transform 0.12s ease-out;
}

#editorial-photo-view-zoom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: #1e293b;
  font-size: 12px;
  border-bottom: 1px solid #334155;
}

#editorial-photo-view-zoom input[type='range'] {
  flex: 1;
  max-width: 200px;
}

#editorial-photo-view-meta {
  padding: 0.65rem 0.85rem;
  font-size: 12px;
  line-height: 1.45;
  border-bottom: 1px solid #334155;
  max-height: 5.5rem;
  overflow-y: auto;
}

#editorial-photo-view-form {
  padding: 0.65rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 38vh;
  overflow-y: auto;
  font-size: 13px;
}

#editorial-photo-view-form .epv-article-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  width: 100%;
  min-width: 0;
}

#editorial-photo-view-form .epv-article-row select.editorial-ui-select {
  flex: 1 1 12rem;
  min-width: 0;
}

#editorial-photo-view-form a.editorial-photo-article-link {
  flex: 0 0 auto;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #93c5fd;
  text-decoration: underline;
  white-space: nowrap;
}

#editorial-photo-view-form a.editorial-photo-article-link:hover {
  color: #bfdbfe;
}

#editorial-photo-view-form label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-weight: 600;
}

#editorial-photo-view-form input[type='text'],
#editorial-photo-view-form textarea {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #f8fafc;
  max-width: 100%;
}

/* Spójny wygląd z selectami w edycji materiału (wysokie, nie systemowe) */
#editorial-photo-view-form select.editorial-ui-select,
#editorial-photo-modal-article-wrap select.editorial-ui-select {
  font: inherit;
  max-width: 100%;
  min-height: 2.35rem;
  padding: 0.5rem 2rem 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid #475569;
  background-color: #1e293b;
  color: #f8fafc;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 1rem) calc(50% - 0.1rem), calc(100% - 0.65rem) calc(50% - 0.1rem);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

#editorial-photo-view-form select.editorial-ui-select:focus,
#editorial-photo-modal-article-wrap select.editorial-ui-select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}

#editorial-photo-view-form textarea {
  min-height: 3.2rem;
  resize: vertical;
}

#editorial-photo-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

#editorial-photo-view-actions button {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #64748b;
  background: #334155;
  color: #f1f5f9;
  cursor: pointer;
  font: inherit;
}

#editorial-photo-view-actions button.primary {
  background: #2563eb;
  border-color: #1d4ed8;
}
