/**
 * NTMK Smart Importer Styles
 * Split grid layout with drag-drop zone, live WYSIWYG editor and click-to-correct pills
 */

.importer-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* Header */
.importer-header {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.35);
  color: #f8fafc;
}

.importer-header .header-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #b45309;
  background: rgba(245, 158, 11, 0.15);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.importer-header .header-title {
  font-size: 2rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.importer-header .header-desc {
  font-size: 0.95rem;
  color: #94a3b8;
  margin: 0;
  max-width: 680px;
  line-height: 1.6;
}

/* 2-Column Layout */
.importer-layout-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .importer-layout-grid {
    grid-template-columns: 1fr;
  }
}

.importer-card {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 22px;
  backdrop-filter: blur(12px);
  color: #f8fafc;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
}

.btn-sample-paste {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.importer-textarea {
  width: 100%;
  height: 280px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  resize: vertical;
}
.importer-textarea:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.3);
}

.importer-textarea:focus {
  border-color: #d97706;
}

/* Drop zone */
.importer-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
  color: #94a3b8;
  margin-bottom: 16px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}
.importer-drop-zone:hover {
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
  color: #c084fc;
}

.importer-drop-zone input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Meta config */
.import-meta-config {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.config-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim, #64748b);
}

.import-select, .import-input {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-color, #ffffff);
  color: var(--text-color, #1e293b);
  font-size: 0.85rem;
  outline: none;
}

.btn-parse-trigger {
  width: 100%;
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.25);
  transition: all 0.15s ease;
}

.btn-parse-trigger:hover {
  transform: translateY(-1px);
}

/* Preview Col */
.preview-sticky-card {
  position: sticky;
  top: 84px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 22px;
  backdrop-filter: blur(12px);
  color: #f8fafc;
}

.preview-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color, #f1f5f9);
  margin-bottom: 14px;
}

.parsed-stat-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: #059669;
  background: rgba(5, 150, 105, 0.1);
  padding: 3px 8px;
  border-radius: 6px;
}

.parsed-list-container {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 18px;
}

.preview-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim, #94a3b8);
}

.preview-empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

.parsed-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #b45309;
  padding: 4px 8px;
  background: rgba(245, 158, 11, 0.08);
  border-radius: 6px;
  margin-top: 8px;
}

.parsed-q-card {
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  padding: 14px;
  background: var(--bg-alt, #f8fafc);
}

.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.q-num {
  font-size: 0.82rem;
  font-weight: 800;
  color: #d97706;
}

.btn-del-q {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-del-q:hover {
  color: #dc2626;
}

.q-text-editable, .q-passage-box {
  padding: 8px;
  border-radius: 6px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  font-size: 0.9rem;
  color: var(--text-color, #1e293b);
  line-height: 1.45;
  outline: none;
  margin-bottom: 10px;
}

.parsed-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

@media (max-width: 600px) {
  .parsed-options-grid {
    grid-template-columns: 1fr;
  }
}

.parsed-opt-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s;
}

.parsed-opt-pill:hover {
  border-color: #d97706;
}

.parsed-opt-pill.opt-is-correct {
  background: rgba(5, 150, 105, 0.08);
  border-color: #059669;
  font-weight: 700;
  color: #065f46;
}

.opt-key {
  font-weight: 700;
}

.opt-val {
  flex-grow: 1;
}

.correct-tick {
  font-size: 0.72rem;
  background: #059669;
  color: #ffffff;
  padding: 1px 5px;
  border-radius: 4px;
}

/* TF Statements */
.tf-statements-edit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tf-stmt-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--card-bg, #ffffff);
  border-radius: 6px;
  border: 1px solid var(--border-color, #cbd5e1);
  font-size: 0.82rem;
}

.stmt-key {
  font-weight: 700;
}

.stmt-val {
  flex-grow: 1;
}

.tf-toggle-btns {
  display: flex;
  gap: 4px;
}

.btn-tf-pick {
  border: 1px solid var(--border-color, #cbd5e1);
  background: transparent;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-tf-pick.active-dung {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}

.btn-tf-pick.active-sai {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
}

/* Actions bar */
.importer-actions-bar {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color, #f1f5f9);
}

.btn-save-system {
  flex: 2;
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(4, 120, 87, 0.25);
}

.btn-save-system:disabled, .btn-export-json:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-export-json {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border-color, #cbd5e1);
  color: var(--text-color, #334155);
  border-radius: 8px;
  padding: 11px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.importer-header .title-icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.3) 0%, rgba(14, 165, 233, 0.15) 100%);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #38bdf8;
}
