/* IBM i Source Import - Supplemental Styles
 * Base styles (step indicator, cards, forms, progress, review, and the
 * library tree / filter bar / pagination) come from ibmi-import.css.
 * This file adds styles unique to the Import Sources tool: the extra
 * source-file level in the tree, library-body toolbar (refresh), and the
 * library row's text/delete/error decorations.
 */

/* =============================================================================
   Field hints (Ask CoderFlow coverage)
   ============================================================================= */

/* Branch selector lives in a right-aligned flex header; let its hint wrap to
   its own line below the control rather than sitting inline after the select. */
.branch-selector-header {
  flex-wrap: wrap;
}

.branch-selector-header .form-hint {
  flex-basis: 100%;
  text-align: right;
  margin: 2px 0 0;
}

/* The Add Libraries dialog body stacks block children; render its hint as a
   block above the textarea with a little breathing room. */
.dialog-body .form-hint {
  display: block;
  margin: 0 0 10px;
}

/* =============================================================================
   Step 2: Library tree — per-library row additions
   ============================================================================= */

.library-text {
  flex: 1;
  color: var(--color-text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-header.invalid {
  background: var(--color-danger-bg, rgba(239, 68, 68, 0.08));
}

.library-header.invalid:hover {
  background: var(--color-danger-bg, rgba(239, 68, 68, 0.12));
}

.library-header .library-delete-btn {
  margin-left: auto;
  flex-shrink: 0;
}

.library-header .validating {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 12px;
}

.btn-icon-sm {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--color-text-muted, #94a3b8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-icon-sm:hover {
  background: var(--color-surface-hover, #f1f5f9);
  color: var(--color-text-secondary, #64748b);
}

.btn-icon-sm.btn-delete:hover {
  background: var(--color-danger-bg, rgba(239, 68, 68, 0.1));
  color: var(--color-danger, #ef4444);
}

.table-empty-state {
  text-align: center;
  padding: 32px;
  color: var(--color-text-muted);
  font-size: 14px;
}

/* =============================================================================
   Step 2: Library body — toolbar (refresh) + source file rows + member rows
   ============================================================================= */

.library-body-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface-muted, #eef1f6);
}

.library-body-toolbar .refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.library-body-toolbar .refresh-btn svg {
  width: 14px;
  height: 14px;
}

.library-body-error {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--color-danger, #b91c1c);
}

.source-file-list {
  padding: 4px 0;
}

.source-file-row {
  border-top: 1px solid var(--color-border);
}

.source-file-row:first-child {
  border-top: none;
}

.source-file-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 36px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  transition: background 0.15s;
}

.source-file-header:hover {
  background: var(--color-surface-hover, rgba(0, 0, 0, 0.03));
}

.source-file-checkbox {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.source-file-checkbox input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  width: 15px;
  height: 15px;
}

.source-file-name {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
}

.source-file-count {
  font-size: 12px;
  color: var(--color-text-muted);
}

.source-file-selected {
  font-size: 12px;
  color: var(--color-accent, var(--color-primary));
  font-weight: 600;
}

.source-file-body {
  background: var(--color-surface, #fff);
  border-top: 1px solid var(--color-border);
}

/* Member filter bar / list / pagination sit inside source-file-body. Indent
   one level deeper than library-body's equivalents (which target the single
   level used by the Build Rules tool). */
.source-file-body .filter-bar {
  padding-left: 72px;
}

.source-file-body .object-row {
  padding-left: 72px;
}

.source-file-body .pagination-bar {
  padding-left: 72px;
}

/* =============================================================================
   Add Libraries Dialog
   ============================================================================= */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog {
  background: var(--color-surface, #fff);
  border-radius: var(--radius-large, 20px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.dialog-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.dialog-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px;
  line-height: 1;
}

.dialog-close:hover {
  color: var(--color-text);
}

.dialog-body {
  padding: 20px 24px;
}

.dialog-body p {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.dialog-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-family: var(--font-mono, 'Fira Code', monospace);
  font-size: 13px;
  resize: vertical;
  background: var(--color-surface, #fff);
  color: var(--color-text);
}

.dialog-body textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(63, 114, 255, 0.12);
}

.dialog-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =============================================================================
   Step 3: Import progress
   ============================================================================= */

.import-phase {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text);
}

.progress-bar-indeterminate {
  width: 20% !important;
  animation: indeterminate 3s ease-in-out infinite;
}

@keyframes indeterminate {
  0%   { margin-left: 0;   }
  50%  { margin-left: 80%; }
  100% { margin-left: 0;   }
}
