/* philtext/static/philtext/css/import_text.css */

/* ── Layout ─────────────────────────────────────────────────────────────── */

.import-text-page {
  max-width: 720px;
}

.import-text-page h2 {
  font-family: var(--font-ui);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-text);
  margin: 0 0 1.8rem 0;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--accent-soft-bg);
}

/* ── Form sections ───────────────────────────────────────────────────────── */

.form-section {
  margin-bottom: 2rem;
}

.form-section-title {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--label);
  margin: 0 0 1rem 0;
}

/* ── Field rows ──────────────────────────────────────────────────────────── */

.field-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.1rem;
}

.field-row label {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 0.3rem;
}

.field-row input[type="text"],
.field-row input[type="number"],
.field-row select {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--input-bg);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  box-sizing: border-box;
}

.field-row input:focus,
.field-row select:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 2px rgba(61,61,122,0.12);
}

.field-row.field-inline {
  flex-direction: row;
  gap: 1rem;
}

.field-row.field-inline > div {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.field-row.field-inline label {
  margin-bottom: 0.3rem;
}

/* ── Author section ──────────────────────────────────────────────────────── */

.author-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.author-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  background: var(--surface-card-2);
  border: 1px solid var(--line-mid);
  border-radius: 5px;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  font-family: var(--font-ui);
  color: var(--text-soft);
}

.author-item-name {
  flex: 1;
  font-weight: 500;
}

.author-item-role {
  font-size: 0.78rem;
  color: var(--label);
  background: var(--control-hover-bg);
  border-radius: 10px;
  padding: 0.1rem 0.55rem;
}

.author-item-remove {
  background: none;
  border: none;
  color: #aa2222;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.2rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.author-item-remove:hover { opacity: 1; }

/* ── Author search ───────────────────────────────────────────────────────── */

.author-search-wrap {
  position: relative;
  margin-bottom: 0.8rem;
}

.author-search-input {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  width: 100%;
  box-sizing: border-box;
  background: var(--input-bg);
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.author-search-input:focus {
  outline: none;
  border-color: var(--focus-border);
  box-shadow: 0 0 0 2px rgba(61,61,122,0.12);
}

.author-autocomplete {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--surface-card);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.author-autocomplete.open { display: block; }

.autocomplete-item {
  padding: 0.5rem 0.8rem;
  font-size: 0.88rem;
  font-family: var(--font-ui);
  cursor: pointer;
  color: var(--text-soft);
  transition: background 0.1s;
}

.autocomplete-item:hover,
.autocomplete-item.focused {
  background: var(--control-hover-bg);
}

/* ── New author form ─────────────────────────────────────────────────────── */

.new-author-toggle {
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--accent-text);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-bottom: 0.8rem;
  display: inline-block;
}

.new-author-toggle:hover { color: var(--accent-text-hover); }

.new-author-form {
  background: var(--surface-card-2);
  border: 1px solid var(--line-mid);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.8rem;
  display: none;
}

.new-author-form.open { display: block; }

.new-author-form .form-section-title {
  margin-bottom: 0.8rem;
}

.author-role-select {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--ink);
  margin-top: 0.6rem;
}

.btn-add-author {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.4rem 1rem;
  border-radius: 5px;
  border: 1px solid var(--focus-border);
  background: var(--surface-card);
  color: var(--accent-text);
  cursor: pointer;
  margin-top: 0.7rem;
  transition: background 0.15s, color 0.15s;
}

.btn-add-author:hover {
  background: var(--accent-soft-hover-bg);
  color: var(--accent-soft-text);
}

/* ── Submit button ───────────────────────────────────────────────────────── */

#import-form .form-actions {
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line-mid);
}

#import-form .btn-submit {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1.8rem;
  border-radius: 5px;
  border: none;
  background: var(--accent-soft-bg);
  color: var(--accent-soft-text);
  cursor: pointer;
  transition: background 0.15s;
}

#import-form .btn-submit:hover { background: var(--accent-soft-hover-bg); }

#import-form .btn-submit:disabled {
  background: var(--text-faint);
  cursor: not-allowed;
}

/* ── Validation errors ───────────────────────────────────────────────────── */

.field-error {
  font-size: 0.78rem;
  color: #aa2222;
  margin-top: 0.25rem;
}
.form-error-banner {
  background: var(--danger-surface);
  border: 1px solid var(--danger-border);
  border-radius: 5px;
  color: var(--danger-text);
  font-size: .88rem;
  padding: .6rem 1rem;
  margin-bottom: 1rem;
}