/* philtext/static/philtext/css/manage_collections.css */

/* ── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.6rem;
}
.page-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--ink);
  font-weight: 600;
}

.breadcrumb {
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.breadcrumb a { color: var(--accent-text); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep { color: var(--line-strong); }

/* ── Create button ───────────────────────────────────────────────────────── */

/* ── Create panel ────────────────────────────────────────────────────────── */

/* ── Form groups ─────────────────────────────────────────────────────────── */
.form-group > label,
.form-group > label:first-child {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
}
.form-group input[type="text"],
.form-group textarea {
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--ink);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.15s;
  resize: vertical;
}
.form-group input[type="text"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--focus-border);
}

.form-group--inline {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
}
.form-group--inline input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--accent-soft-bg);
}
.label-inline {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.label-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 400;
}
.label-optional {
  font-size: 0.75rem;
  color: var(--text-faint);
  font-weight: 400;
}

/* ── Error list ──────────────────────────────────────────────────────────── */

/* ── Section title (list page) ───────────────────────────────────────────── */

/* ── Collections table ───────────────────────────────────────────────────── */
.collections-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.collections-table th {
  background: var(--surface-wash);
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 2px solid var(--line-mid);
  color: var(--text-soft);
  font-weight: 600;
  white-space: nowrap;
}
.collections-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.collections-table tr:hover td { background: var(--row-hover); }

.col-name-link {
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: none;
  display: block;
}
.col-name-link:hover { color: var(--accent-text-hover); text-decoration: underline; }

.col-desc {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-style: italic;
}

.count-cell {
  text-align: center;
  color: var(--text-mid);
  font-size: 0.88rem;
}

/* ── Visibility badges ───────────────────────────────────────────────────── */

/* ── Action buttons (inline) ─────────────────────────────────────────────── */
.actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.btn-action {
  display: inline-block;
  padding: 0.22rem 0.65rem;
  font-size: 0.8rem;
  border: 1px solid var(--control-border);
  border-radius: 4px;
  background: var(--control-bg);
  color: var(--accent-text);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-action:hover { background: var(--control-hover-bg); }
.btn-delete {
  border-color: #e0a0a0;
  color: #aa2222;
  background: transparent;
}
.btn-delete:hover { background: #fff0f0; }
.btn-add {
  border-color: #a0c8a0;
  color: #226622;
  background: transparent;
}
.btn-add:hover { background: #f0fff0; }

/* ── Detail page sections ────────────────────────────────────────────────── */
.detail-section {
  margin-bottom: 2.5rem;
  max-width: 720px;
}
.section-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-mid);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.section-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-wash);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
}

.edit-form {
  max-width: 520px;
}

.meta-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

/* ── Texts table (detail page) ───────────────────────────────────────────── */
.texts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.texts-table th {
  background: var(--surface-wash);
  text-align: left;
  padding: 0.45rem 0.8rem;
  border-bottom: 2px solid var(--line-mid);
  color: var(--text-soft);
  font-weight: 600;
  white-space: nowrap;
}
.texts-table td {
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.texts-table tr:hover td { background: var(--row-hover); }
.texts-table .actions-cell { display: table-cell; }

.text-link {
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 500;
}
.text-link:hover { color: var(--accent-text-hover); text-decoration: underline; }

.secondary-cell { color: var(--text-muted); font-size: 0.87rem; }

/* ── Add texts widget ────────────────────────────────────────────────────── */

.text-search-input {
  width: 100%;
  max-width: 380px;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: inherit;
  margin-bottom: 0.65rem;
  transition: border-color 0.15s;
}
.text-search-input:focus {
  outline: none;
  border-color: var(--focus-border);
}

.add-texts-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--line-mid);
  border-radius: 5px;
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
}

.add-text-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--control-hover-bg);
  background: var(--surface-card);
  transition: background 0.1s;
}
.add-text-row:last-child { border-bottom: none; }
.add-text-row:hover { background: var(--row-hover); }

.add-text-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.add-text-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Import jobs section (superadmin, manage_collections page) ────────────── */
.import-section {
  margin-top: 2.8rem;
  padding-top: 1.8rem;
  border-top: 2px solid var(--line-mid);
}
.import-section-header { margin-bottom: 1.4rem; }
.import-section-header h3 { margin: 0 0 0.4rem 0; font-size: 1.1rem; color: var(--ink); }
.import-section-desc {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-mid);
  max-width: 600px;
  line-height: 1.55;
}

.import-source-block {
  background: var(--surface-card-2);
  border: 1px solid var(--line-mid);
  border-radius: 6px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
}
.import-source-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.8rem;
}
.import-source-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  white-space: nowrap;
}
.import-source-desc {
  font-size: 0.83rem;
  color: var(--text-mid);
  flex: 1;
  min-width: 200px;
  line-height: 1.5;
}
.import-source-desc a { color: var(--accent-text); }
.import-source-desc em { color: var(--text-soft); font-style: normal; font-weight: 500; }

.import-source-block .btn-launch {
  padding: 0.35rem 1rem;
  background: var(--accent-soft-bg);
  color: var(--accent-soft-text);
  border: none;
  border-radius: 4px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.import-source-block .btn-launch:hover:not(:disabled) { background: var(--accent-soft-hover-bg); }
.import-source-block .btn-launch:disabled { background: var(--text-faint); cursor: default; }

.btn-cancel-import {
  padding: 0.25rem 0.7rem;
  background: none;
  border: 1px solid #cc4444;
  border-radius: 4px;
  color: #cc4444;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-left: 0.4rem;
}
.btn-cancel-import:hover { background: #fff0f0; }

.import-progress {
  margin: 0.8rem 0;
  max-width: 520px;
}
.import-progress .progress-status-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.progress-step { font-size: 0.8rem; color: var(--text-mid); }
.import-progress .progress-bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}
.import-progress .progress-bar-row progress { flex: 1; height: 6px; }
.import-progress .progress-pct { font-size: 0.78rem; color: var(--text-mid); min-width: 34px; text-align: right; }
.import-progress .progress-counts { font-size: 0.79rem; color: var(--text-mid); line-height: 1.8; }
.import-progress .progress-counts span { margin-right: 0.8rem; }