/* CSS styles for the album management modal dialog */
/* ===== ALBUM MANAGEMENT MODAL ===== */
.album-management-modal {
  color: #fff;
  margin: 0;
  width: 80vw;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
}

.album-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5em;
}

.album-header h2 {
  color: #fff;
  margin: 0;
  font-size: 1.5em;
}

.back-button {
  background: transparent;
  border: 1px solid #666;
  color: #faea0e;
  padding: 0.4em 0.8em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.back-button:hover,
.back-button:focus {
  background: rgba(250, 234, 14, 0.1);
  border-color: #faea0e;
  outline: none;
}

.header-buttons {
  display: flex;
  gap: 1em;
  align-items: center;
}

#showAddAlbumBtn {
  margin-right: 20px;
}

.add-album-section {
  display: none;
  margin-bottom: 2em;
  padding: 1em;
  /* Match the brighter background used by .album-card.editing so the
     Add-Album section visually stands out from the surrounding non-editing
     album cards (which sit at #333). */
  background: #505050;
  border-radius: 8px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
}

.section-header h3 {
  color: #fff;
  margin: 0;
}

.cancel-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.2em;
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1em;
  margin-bottom: 1em;
}

.form-group {
  margin-bottom: 1em;
}

.form-group label {
  color: #fff;
  font-size: 14px;
  display: block;
  margin-bottom: 0.5em;
}

/* The rule above is an author rule, so it beats the UA stylesheet's
   [hidden] { display: none } — a label carrying the hidden attribute would
   stay on screen. Same shape as the .video-player-* rules. */
.edit-album-invoke-forget-password-row[hidden] {
  display: none;
}

/* .form-group input is 100% wide, which is not what a checkbox wants. */
.edit-album-invoke-forget-password-row input[type="checkbox"] {
  width: auto;
  margin-right: 0.4em;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.5em;
  border-radius: 4px;
  border: 1px solid #888;
  background: #444;
  color: #fff;
}

.form-group textarea {
  resize: vertical;
}

/* Pixel-dimension input only needs room for four digits and the spinner
   controls — overrides the full-width default applied to every input
   inside ``.form-group``. */
.form-group input.edit-album-min-image-dimension {
  width: 6em;
}

.form-hint {
  display: block;
  margin-top: 0.4em;
  color: #bbb;
  font-size: 12px;
  line-height: 1.3;
}

.form-buttons {
  display: flex;
  gap: 0.5em;
}

.album-card {
  background: #333;
  border-radius: 8px;
  margin-bottom: 1em;
  padding: 1em;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.album-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.album-details {
  display: grid;
  grid-template-columns: 1.5fr 1fr auto;
  gap: 1em;
  align-items: start;
}

.album-name {
  color: #fff;
  margin: 0 0 0.5em 0;
  font-size: 1.1em;
}

.album-key {
  color: #aaa;
  font-size: 0.9em;
  margin-bottom: 0.3em;
}

.album-description {
  color: #ccc;
  font-size: 0.9em;
  margin-bottom: 0.3em;
}

.album-paths {
  color: #aaa;
  font-size: 0.85em;
  margin-bottom: 0.5em;
}

.album-path-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5em;
  gap: 0.5em;
}

.album-path-input {
  flex: 1;
  background: #222;
  color: #faea0e;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 8px;
}

.open-folder-btn,
.remove-path-btn {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  padding: 4px;
}

.open-folder-btn:hover,
.remove-path-btn:hover {
  background: rgba(250, 234, 14, 0.1);
  border-radius: 4px;
}

.indexing-section {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 200px;
}

.index-controls {
  display: flex;
  /* flex-start, not center: the status text wraps to two or three lines,
     and centring the buttons against it floated them down out of line with
     Edit/Delete in the next grid cell (which sits at the top, per
     .album-details' align-items: start). */
  align-items: flex-start;
  gap: 0.5em;
  margin-bottom: 0.5em;
}

/* Mirrors .action-buttons.vertical — same direction, same gap, same
   right-alignment — so Update Index lines up with Edit and Rebuild Index
   with Delete. stretch rather than flex-end so the two buttons share the
   column's width instead of ragging by the couple of pixels their labels
   differ by. */
.index-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  align-items: stretch;
}

.index-status {
  color: #aaa;
  font-size: 0.9em;
}

.index-status.scanning {
  color: #636ceb;
}
.index-status.downloading {
  color: #9c27b0 !important;
}
.index-status.indexing {
  color: #ff9800 !important;
}
.index-status.completed {
  color: green !important;
}
/* Completed, but something was skipped. Needs both the !important and the
   extra class: .index-status.completed is also !important, so only higher
   specificity can beat it — an inline style cannot. */
.index-status.completed.with-warning {
  color: #ff9800 !important;
}
.index-status.error {
  color: #b00020 !important;
}
.index-status.umapping {
  color: #2196f3 !important;
}

.action-buttons {
  display: flex;
  gap: 0.5em;
  margin-top: 1em;
  justify-content: flex-end;
}

.action-buttons.vertical {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  justify-content: flex-start;
  align-items: flex-end;
  margin-top: 0;
}

.action-buttons.vertical button {
  width: auto;
  min-width: 80px;
  align-self: flex-end;
}

.album-card.editing {
  /* background: #353535 !important; */
  background: #505050 !important;
  box-shadow: 0 0 8px #222;
  transition: background 0.2s;
}

.edit-form {
  display: none;
}

.edit-form h5 {
  color: #fff;
  margin-top: 0;
}

.progress-container {
  display: none;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.progress-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.3em;
}

.progress-bar-track {
  flex: 1;
  height: 8px;
  background: #555;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4caf50, #2196f3);
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s infinite;
}

.progress-text {
  color: #fff;
  font-size: 0.85em;
  min-width: 40px;
  text-align: right;
}

.estimated-time {
  color: #aaa;
  font-size: 0.8em;
  text-align: right;
  min-height: 1.2em;
}

/* ===== BUTTON STYLES ===== */
.btn-primary {
  background: #4caf50;
  border: none;
  color: #fff;
  padding: 0.5em 1em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

/* Byte-size + pixel-dimension gates on one line in the album editor. */
.min-image-gates {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.min-image-gates input {
  width: 5em;
}

.min-image-gate-unit {
  color: #aaa;
  font-size: 0.9em;
}

/* Header "Update All" button: shaped like .btn-primary, coloured like the
   per-album .btn-index buttons it fans out to. */
.btn-update-all {
  background: #2196f3;
  border: none;
  color: #fff;
  padding: 0.5em 1em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}

.btn-update-all:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-secondary {
  background: #666;
  border: none;
  color: #fff;
  padding: 0.5em 1em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-edit {
  background: #ff9800;
  border: none;
  color: #fff;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
}

.btn-delete {
  background: #f44336;
  border: none;
  color: #fff;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
}

.btn-index {
  background: #2196f3;
  border: none;
  color: #fff;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  white-space: nowrap;
}

/* Red, like .btn-delete: this discards work the user waited for. */
.btn-rebuild {
  background: #f44336;
  border: none;
  color: #fff;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  white-space: nowrap;
}

.btn-rebuild:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-cancel {
  display: none;
  background: #f44336;
  border: none;
  color: #fff;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
}

#showAddAlbumBtn {
  transform: translateX(-3px);
}

#albumsScrollContainer {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .album-management-modal {
    width: 95vw;
    max-height: 90vh;
    padding: 1em;
  }

  .album-card {
    font-size: 0.9em;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

#addDirBtn {
  background: #0a6a0a;
  color: white;
}

#addDirBtn:hover {
  background: #0a8a0a;
}

.edit-album-paths-container.input-error {
  border: 2px solid #b00020;
  border-radius: 4px;
  padding: 4px;
}

/* ── InvokeAI board-album source controls ────────────────────────────── */

.album-source-radios {
  display: flex;
  gap: 1.5em;
  flex-wrap: wrap;
}

.album-source-radios .radio-label {
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 0;
  font-weight: normal;
  color: #fff;
}

/* Radios/checkboxes must not inherit the 100%-width applied to every
   input inside .form-group. */
.album-source-radios input[type="radio"],
.invoke-board-checklist input[type="checkbox"] {
  width: auto;
}

.invoke-root-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.invoke-board-checklist {
  max-height: 10em;
  overflow-y: auto;
  border: 1px solid #888;
  border-radius: 4px;
  background: #444;
  padding: 0.5em;
}

.invoke-board-checklist .board-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.25em;
  font-weight: normal;
  color: #fff;
}

.invoke-board-checklist .board-checklist-empty {
  color: #bbb;
  font-style: italic;
}
