/* ==========================================================================
   pages/keyword-research.css — Bulk CSV upload UI (v2.1)
   BEM scope: .kw-bulk-*, .bulk-modal-*, .kw-bulk-progress, .kw-bulk-table
   ========================================================================== */

/* === Bulk Upload button row (appended below single-keyword form) === */

.kw-bulk-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.kw-bulk-btn {
  font-size: 12px;
  padding: 7px 14px;
}

/* === Modal overlay === */

.bulk-modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.18s ease;
}

.bulk-modal {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border: 1px solid var(--border-m);
  border-radius: var(--rl);
  padding: 22px;
  width: 100%;
  max-width: 540px;
  max-height: 84vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.bulk-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.bulk-modal__title {
  font-family: var(--fh);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.bulk-modal__close {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--text-m);
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
}

.bulk-modal__close:hover {
  background: var(--surface3);
  color: var(--text);
}

/* === Dropzone === */

.bulk-modal__dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 36px 20px;
  border: 1.5px dashed var(--border-m);
  border-radius: var(--rl);
  background: var(--surface2);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
  text-align: center;
}

.bulk-modal__dropzone:hover {
  border-color: var(--accent);
}

.bulk-modal__dropzone--dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.bulk-modal__dropzone-icon {
  font-size: 32px;
  margin-bottom: 4px;
  opacity: 0.85;
}

.bulk-modal__dropzone-title {
  font-family: var(--fh);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.bulk-modal__dropzone-sub {
  font-size: 12px;
  color: var(--text-d);
}

.bulk-modal__file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.bulk-modal__hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-d);
  text-align: center;
}

.bulk-modal__hint strong {
  color: var(--text-m);
}

.bulk-modal__template {
  margin-top: 14px;
  background: transparent;
  border: 0;
  color: var(--accent);
  font-family: var(--fb);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 0;
  width: 100%;
  text-align: left;
}

.bulk-modal__template:hover {
  color: var(--accent2);
  text-decoration: underline;
}

.bulk-modal__format {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
}

.bulk-modal__format-title {
  font-family: var(--fm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-d);
  margin-bottom: 8px;
}

.bulk-modal__format-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--text-m);
  line-height: 1.5;
}

.bulk-modal__format-list code {
  background: var(--surface3);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--fm);
  font-size: 11px;
}

/* === Preview (after CSV parsed) === */

.bulk-modal__preview {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 0.5px solid var(--border);
}

.bulk-modal__preview.is-hidden { display: none; }

.bulk-modal__preview-error {
  color: var(--red);
  background: var(--red-dim);
  border: 0.5px solid var(--red);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.bulk-modal__preview-ok {
  color: var(--green);
  font-family: var(--fh);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.bulk-modal__preview-sub {
  font-size: 12px;
  color: var(--text-d);
  margin-bottom: 10px;
}

.bulk-modal__preview-list {
  margin: 0 0 8px 0;
  padding-left: 22px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}

.bulk-modal__preview-list li {
  font-family: var(--fm);
  font-size: 12px;
}

.bulk-modal__preview-more {
  font-size: 12px;
  color: var(--accent2);
  font-style: italic;
  margin-bottom: 12px;
}

.bulk-modal__preview-controls {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bulk-modal__loc-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--fm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-d);
}

.bulk-modal__loc-select {
  background: var(--surface2);
  border: 1px solid var(--border-m);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-family: var(--fb);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.bulk-modal__cta-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* === Bulk progress bar === */

.kw-bulk-progress {
  margin: 16px 0 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-m);
  border-radius: var(--rl);
}

.kw-bulk-progress.is-hidden { display: none; }

.kw-bulk-progress--done    { border-color: var(--green); }
.kw-bulk-progress--cancelled { border-color: var(--amber); }

.kw-bulk-progress__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.kw-bulk-progress__label {
  font-family: var(--fh);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.kw-bulk-progress__count {
  font-family: var(--fm);
  font-size: 12px;
  color: var(--text-m);
}

.kw-bulk-progress__bar {
  height: 8px;
  background: var(--surface3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.kw-bulk-progress__bar-fill {
  display: block;
  height: 100%;
  width: var(--bar-width, 0%);
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.25s;
}

.kw-bulk-progress--done .kw-bulk-progress__bar-fill {
  background: var(--green);
}

.kw-bulk-progress--cancelled .kw-bulk-progress__bar-fill {
  background: var(--amber);
}

.kw-bulk-progress__cta {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* === Bulk results table === */

.kw-bulk-results {
  margin-bottom: 20px;
}

.kw-bulk-results__title {
  font-family: var(--fh);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.kw-bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.kw-bulk-table th {
  text-align: left;
  padding: 8px 10px;
  font-family: var(--fm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-d);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}

.kw-bulk-table td {
  padding: 8px 10px;
  border-bottom: 0.5px solid var(--border);
  font-family: var(--fm);
  color: var(--text-m);
}

.kw-bulk-table tbody tr:hover {
  background: var(--surface2);
}

.kw-bulk-cell__kw {
  color: var(--text);
  font-family: var(--fb);
  max-width: 320px;
  word-break: break-word;
}

.kw-bulk-cell--hi { color: var(--green); font-weight: 700; }
.kw-bulk-cell--md { color: var(--amber); font-weight: 700; }
.kw-bulk-cell--lo { color: var(--red);   font-weight: 700; }
.kw-bulk-cell--err { color: var(--red); font-style: italic; font-size: 11px; }

.kw-bulk-redo {
  font-size: 11px;
  padding: 4px 10px;
}
