﻿/* Consolidated Mapping Page Styles (Preview + Mapping + Review shared) */
:root { --mp-border:#d1d5db; --mp-border-soft:#e5e7eb; --mp-border-strong:#c3c8ce; --mp-bg:#ffffff; --mp-bg-sub:#f6f8fa; --mp-blue:#0a61ff; --mp-blue-hover:#0459d9; --mp-blue-light:#e8f1ff; --mp-blue-dark:#0649c4; --mp-text:#1f2937; --mp-muted:#66737f; --mp-radius-lg:16px; --mp-preview-col:220px; --mp-preview-active:#e9f3ff; --mp-ok:#1f9d55; --mp-warn:#ff9800; --mp-error:#dc2626; --ab-footer-offset:84px; }

/* Ensure the whole page scrolls (not inner panels) and last content is visible above fixed footer */
html, body { min-height:100%; height:auto; }
body { background:#fafbfc; overflow-y:auto !important; padding-bottom:0; }

/* Force page-level scrolling even with sidebar layout rules from base CSS */
body.ab-has-sidebar #ab-main,
body.ab-has-sidebar .ab-main-content { height:auto; min-height:100vh; overflow:visible; }
body.ab-has-sidebar.ab-sidebar-collapsed #ab-main,
body.ab-has-sidebar.ab-sidebar-collapsed .ab-main-content { height:auto !important; min-height:100vh; overflow:visible; }

/* Main wrapper leaves space for footer (JS updates --ab-footer-offset at runtime) */
#ab-main { display:flex; flex-direction:column; min-height:100vh; height:auto; overflow:visible; padding-bottom:var(--ab-footer-offset); }
#ab-main.ab-main-content { padding-bottom:var(--ab-footer-offset) !important; }
#ab-main > .flex-grow-1 { flex:1 1 auto; display:flex; flex-direction:column; min-height:0; overflow:visible; }

/* Header / Steps */
.ab-map-header-shell { background:#fff; border-bottom:1px solid var(--mp-border); box-shadow:0 1px 0 rgba(0,0,0,.04); }
.ab-map-header { min-height:64px; display:flex; align-items:center; gap:26px; padding:0 32px; }
.ab-map-header .ab-file-name { font-size:1.05rem; font-weight:600; margin:0; display:flex; align-items:center; gap:.7rem; }
.ab-map-header a { text-decoration:none; }
.ab-map-header-actions { margin-left:auto; display:flex; align-items:center; gap:24px; }
/* Breadcrumbs - Fixed spacing and styling */
.ab-steps-bar, .ab-steps-bar-simple { 
  display:flex; 
  align-items:center; 
  gap:24px; 
  margin-left:8px; 
  font-size:.85rem; 
}

.ab-step, .ab-step-simple { 
  position:relative; 
  display:flex; 
  align-items:center; 
  gap:6px; 
  text-decoration:none; 
  color:#6c757d; 
  font-weight:500; 
  padding:18px 0 16px; 
  transition:color 0.2s ease;
}

/* Remove vertical line separator */
.ab-step + .ab-step:before, 
.ab-step-simple + .ab-step-simple:before { 
  display:none;
}

/* Active step - bold and blue */
.ab-step-active, 
.ab-step-simple.active { 
  color:var(--mp-blue); 
  font-weight:700;
}

/* Clickable steps when completed (blue color) */
.ab-step-simple.completed {
  color:var(--mp-blue);
  font-weight:600;
}

.ab-step-simple.completed:hover {
  color:var(--mp-blue-hover);
  text-decoration:none;
}

/* Disabled steps */
.ab-step-disabled, 
.ab-step-simple.disabled { 
  color:#b8bec5; 
  cursor:default; 
}

/* Step number styling */
.ab-step-num {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  border-radius:50%;
  font-size:.75rem;
  font-weight:600;
}

/* Active step number */
.ab-step-simple.active .ab-step-num {
  background:var(--mp-blue);
  color:#fff;
}

/* Completed step number */
.ab-step-simple.completed .ab-step-num {
  background:transparent;
  color:var(--mp-blue);
}

/* Disabled step number */
.ab-step-simple.disabled .ab-step-num {
  background:transparent;
  color:#b8bec5;
}

/* Force page-level scrolling even with sidebar layout rules from base CSS */
body.ab-has-sidebar #ab-main,
body.ab-has-sidebar .ab-main-content { height:auto; min-height:100vh; overflow:visible; }
body.ab-has-sidebar.ab-sidebar-collapsed #ab-main,
body.ab-has-sidebar.ab-sidebar-collapsed .ab-main-content { height:auto !important; min-height:100vh; overflow:visible; }

/* Main wrapper leaves space for footer (JS updates --ab-footer-offset at runtime) */
#ab-main { display:flex; flex-direction:column; min-height:100vh; height:auto; overflow:visible; padding-bottom:var(--ab-footer-offset); }
#ab-main.ab-main-content { padding-bottom:var(--ab-footer-offset) !important; }
#ab-main > .flex-grow-1 { flex:1 1 auto; display:flex; flex-direction:column; min-height:0; overflow:visible; }

/* Header / Steps */
.ab-map-header-shell { background:#fff; border-bottom:1px solid var(--mp-border); box-shadow:0 1px 0 rgba(0,0,0,.04); }
.ab-map-header { min-height:64px; display:flex; align-items:center; gap:26px; padding:0 32px; }
.ab-map-header .ab-file-name { font-size:1.05rem; font-weight:600; margin:0; display:flex; align-items:center; gap:.7rem; }
.ab-map-header a { text-decoration:none; }
.ab-map-header-actions { margin-left:auto; display:flex; align-items:center; gap:24px; }
.ab-steps-bar, .ab-steps-bar-simple { display:flex; align-items:center; gap=34px; margin-left:8px; font-size:.85rem; }
.ab-step, .ab-step-simple { position:relative; display:flex; align-items:center; gap:6px; text-decoration:none; color:#6c757d; font-weight:500; padding:18px 0 16px; }
.ab-step + .ab-step:before, .ab-step-simple + .ab-step-simple:before { content:""; position:absolute; left:-18px; top:50%; transform:translateY(-50%); width:1px; height:22px; background:#e5e7ea; }
.ab-step-active, .ab-step-simple.active { color:var(--mp-blue); font-weight:600; }
.ab-step-disabled, .ab-step-simple.disabled { color:#b8bec5; cursor:default; }

/* Flat layout wrapper */
#ab-map-page { display:flex; flex-direction:column; gap:34px; }
/* Remove inner scroll from mapping blocks; rely on page scroll */
.ab-mapping-scroll { max-height:none; overflow:visible; padding-bottom:0; }

/* Preview */
.ab-preview-block { background:var(--mp-bg); border:none; border-radius:14px; padding:0; overflow:hidden; }
.ab-preview-head { padding:.85rem 1rem .75rem; display:flex; align-items:center; gap:18px; border-bottom:1px solid var(--mp-border-strong); background:#fff; }
.ab-preview-title { font-size:.95rem; font-weight:600; color:#111827; }
.ab-preview-tools { margin-left:auto; display:flex; align-items:center; gap:14px; font-size:.75rem; }
/* Preview: horizontal scroll is allowed when columns overflow (helps at high zoom) */
.ab-preview-scroll { overflow-x:auto; overflow-y:hidden; }
.ab-preview-scroll::-webkit-scrollbar{height:8px;}
.ab-preview-scroll::-webkit-scrollbar-thumb{background:#b8c0ca;border-radius:4px;}
.ab-preview-scroll:hover::-webkit-scrollbar-thumb{background:#94a3b8;}
.ab-preview-table { width:auto; min-width:100%; border-collapse:separate; border-spacing:0; font-size:.82rem; table-layout:fixed; }
.ab-preview-table thead th, .ab-preview-table tbody td { width:var(--mp-preview-col); max-width:var(--mp-preview-col); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ab-preview-table thead th.ab-status-head, .ab-preview-table tbody td.ab-status-cell { width:56px; max-width:56px; min-width:56px; padding:0; box-sizing:border-box; }
/* Make status column sticky so it does not compress visually when horizontal scroll appears */
.ab-preview-scroll .ab-preview-table thead th.ab-status-head,
.ab-preview-scroll .ab-preview-table tbody td.ab-status-cell { position:sticky; left:0; z-index:5; background:#f1f6ff; }
.ab-preview-scroll .ab-preview-table tbody td.ab-status-cell { background:#fff; z-index:4; }
/* Add subtle separator after sticky column */
.ab-preview-scroll .ab-preview-table thead th.ab-status-head:after,
.ab-preview-scroll .ab-preview-table tbody td.ab-status-cell:after { content:""; position:absolute; top:0; right:0; width:1px; height:100%; background:#e3e9f0; }
/* Preserve active row highlight across sticky cell - only background, no individual cell border */
.ab-preview-table tbody tr.ab-preview-row-active td.ab-status-cell { background:var(--mp-preview-active) !important; }
/* Updated alignment for status head to match standard header cell height */
.ab-preview-table thead th.ab-status-head { padding:.55rem 0 !important; text-align:center; display:table-cell; vertical-align:middle; line-height:0; }
/* Bigger checkbox + centered click target */
.ab-preview-table thead th.ab-status-head input[type=checkbox],
.ab-preview-table tbody td.ab-status-cell input[type=checkbox]{ width:19px; height:19px; margin:0; cursor:pointer; position:relative; top:0; }
/* Increase focus visibility */
.ab-preview-table thead th.ab-status-head input[type=checkbox]:focus-visible,
.ab-preview-table tbody td.ab-status-cell input[type=checkbox]:focus-visible{ outline:2px solid var(--mp-blue); outline-offset:2px; border-radius:4px; }
/* Body checkbox cell keep consistent vertical align */
.ab-preview-table tbody td.ab-status-cell { text-align:center; vertical-align:middle; }
/* Slight padding inside sticky cell for touch targets */
.ab-preview-table thead th.ab-status-head > *,
.ab-preview-table tbody td.ab-status-cell > * { margin-top:2px; }
/* Remove earlier flex centering override if present */
.ab-preview-table thead th { background:#f1f6ff; color:#374151; font-weight:600; padding:.55rem .65rem; font-size:.64rem; letter-spacing:.5px; border-bottom:1px solid #d7dde4; border-right:1px solid #e3e9f0; }
.ab-preview-table thead th:last-child { border-right:1px solid #e3e9f0; }
.ab-preview-table tbody td { padding:.55rem .65rem; border-bottom:1px solid #e3e9f0; border-right:1px solid #e5e9ee; background:#fff; }
.ab-preview-table tbody td:last-child { border-right:none; }
.ab-preview-table tbody tr:hover td { background:#f4f9ff; }
.ab-preview-table tbody tr:hover td.ab-status-cell { background:#f4f9ff !important; }
.ab-preview-table tbody tr.ab-preview-row-active td { background:var(--mp-preview-active) !important; }
.ab-preview-table tbody tr.ab-preview-row-active { box-shadow:inset 0 0 0 2px var(--mp-blue); }
.ab-status-cell { text-align:center; }
.ab-status-icon { font-size:15px; line-height:1; display:inline-block; margin:0 6px; }
.ab-status-icon.ok { color:var(--mp-ok); }
.ab-status-icon.warn { color:var(--mp-warn); }
.ab-preview-footer { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:.65rem .75rem; border-top:1px solid #d7dde4; font-size:.7rem; color:var(--mp-muted); background:#fff; }
.ab-pager { display:flex; align-items:center; gap:.25rem; }
.ab-preview-footer #ab-preview-pager { display:inline-flex; align-items:center; gap:.25rem; flex-wrap:wrap; visibility:visible; }
.ab-preview-footer #ab-preview-pager .btn { padding:.25rem .6rem; border:1px solid #d0d5db; background:#fff; color:#1f2937; border-radius:6px; font-size:.6rem; cursor:pointer; }
.ab-preview-footer #ab-preview-pager .btn:hover:not(:disabled):not(.active) { background:#f0f4f8; }
.ab-preview-footer #ab-preview-pager .btn.active { background:var(--mp-blue); color:#fff; border-color:var(--mp-blue); cursor:pointer; }
.ab-preview-footer #ab-preview-pager .btn:disabled { opacity:.45; }
.ab-pager .btn { padding:.25rem .6rem; border:1px solid #d0d5db; background:#fff; color:#1f2937; border-radius:6px; font-size:.6rem; cursor:pointer; }
.ab-pager .btn:hover:not(:disabled):not(.active) { background:#f0f4f8; }
.ab-pager .btn.active { background:var(--mp-blue); color:#fff; border-color:var(--mp-blue); cursor:pointer; }
.ab-pager .btn:disabled { opacity:.45; }

/* Template button */
.ab-btn-template { font-size:.7rem; padding:.45rem .85rem; border-radius:8px; background:#fff; border:1px solid var(--mp-blue); color:var(--mp-blue); font-weight:500; }
.ab-btn-template:hover { background:var(--mp-blue-light); }
.ab-btn-template.ab-btn-template-selected { background:var(--mp-blue-light); color:var(--mp-blue); }

/* Mapping section */
.ab-map-controls { display:flex; align-items:center; justify-content:space-between; gap:18px; margin:6px 0 8px; }
.ab-map-title { display:flex; align-items:center; gap:14px; }
.ab-map-title h6 { margin:0; font-size:1.05rem; font-weight:600; }
#ab-filter-group { display:inline-flex; gap:.25rem; }
.ab-mapping-container { background:#fff; border-radius:16px; padding:0; overflow:visible; }
.ab-mapping-head { font-size:.7rem; letter-spacing:.55px; font-weight:600; color:#4c5560; border-bottom:1px solid #d7dde4; background:#f5f7fa; display:flex; }
.ab-mapping-head > div { padding:.7rem 1rem; white-space:nowrap; }
#ab-mapping-table { width:100%; border-collapse:separate; border-spacing:0; font-size:.95rem; padding:0 .7rem; }
#ab-mapping-table td {  padding: 0.7rem 0.7rem .6rem; vertical-align:top; border-top:1px dashed var(--mp-border-soft); white-space:nowrap; background:#fff; font-size:.95rem; }
#ab-mapping-table tr:first-child td { border-top:none; }
#ad-mapping-table tr:hover td { background:#f5f9ff; }
#ab-mapping-table td:first-child { font-weight:600; }
#ab-mapping-table td:first-child .ab-user-field-sample { font-weight:400; font-size:.9rem; }

/* Result table (review) dashed separators */
#ab-result-mapping-table { width:100%; border-collapse:separate; border-spacing:0; font-size:.95rem; padding:0 .7rem; }
#ab-result-mapping-table td { padding: 0.7rem 0.7rem .6rem; vertical-align:middle; border-top:1px dashed var(--mp-border-soft); white-space:nowrap; background:#fff; font-size:.95rem; }
#ab-result-mapping-table tr:first-child td { border-top:none; }

/* Arrow / selects stack */
.ab-select-stack { position:relative; }
.ab-select-stack:before { content:""; position:absolute; left:16px; top:22px; bottom:22px; width:1px; background:var(--mp-border-soft); }
.ab-select-stack .ab-select-item { display:flex; align-items:center; gap:.5rem; position:relative; }
.ab-select-stack .ab-select-item + .ab-select-item { margin-top:.55rem; }
.ab-select-stack .ab-select-item:last-of-type:after { content:""; position:absolute; left:16px; bottom:22px; width:1px; height:22px; background:#fff; }
.ab-select-item-arrow { width:32px; min-width:32px; display:flex; justify-content:center; align-items:center; color:#b4b9c0; font-size:.9rem; flex-shrink:0; }
.ab-select-item-arrow i { line-height:1; }

/* AI Confidence Badge - Color-coded percentage without icon */
.ab-select-item-arrow .ab-ai-conf { 
  margin-left:4px; 
  font-size:.7rem; 
  font-weight:600; 
  white-space:nowrap; 
  display:inline-flex; 
  align-items:center; 
  gap:4px;
  padding:3px 8px;
  border-radius:6px;
  position:relative;
  cursor:help;
  transition:all 0.2s ease;
}

/* High confidence (80-100%) - Green */
.ab-select-item-arrow .ab-ai-conf.ab-conf-high {
  color:#15803d;
  background:#dcfce7;
  border:1px solid #86efac;
}

/* Medium confidence (70-79%) - Yellow/Orange */
.ab-select-item-arrow .ab-ai-conf.ab-conf-medium {
  color:#b45309;
  background:#fef3c7;
  border:1px solid #fde047;
}

/* Low confidence (0-69%) - Red */
.ab-select-item-arrow .ab-ai-conf.ab-conf-low {
  color:#b91c1c;
  background:#fee2e2;
  border:1px solid #fca5a5;
}

/* Hover effect */
.ab-select-item-arrow .ab-ai-conf:hover {
  transform:translateY(-1px);
  box-shadow:0 2px 8px rgba(0,0,0,0.1);
}

/* AI Confidence Tooltip */
.ab-ai-conf-tooltip {
  position:fixed;
  background:#ffffff;
  color:#1f2937;
  padding:16px 20px;
  border-radius:12px;
  font-size:0.8rem;
  line-height:1.6;
  width:auto;
  min-width:280px;
  max-width:380px;
  white-space:normal;
  z-index:9999;
  box-shadow:0 12px 32px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
  border:1px solid #e2e8f0;
  pointer-events:none;
  opacity:0;
  transition:opacity 0.2s ease;
  box-sizing:border-box;
}

.ab-ai-conf-tooltip.show {
  opacity:1;
}

.ab-ai-conf-tooltip-title {
  font-weight:600;
  margin-bottom:14px;
  font-size:0.82rem;
  color:#111827;
  line-height:1.5;
  white-space:normal;
}

.ab-ai-conf-tooltip-range {
  display:flex;
  align-items:center;
  gap:12px;
  margin:10px 0;
  font-size:0.75rem;
  white-space:nowrap;
}

.ab-ai-conf-tooltip-badge {
  padding:5px 14px;
  border-radius:6px;
  font-weight:600;
  min-width:90px;
  text-align:center;
  font-size:0.72rem;
  letter-spacing:0.3px;
  flex-shrink:0;
  display:inline-block;
}

.ab-ai-conf-tooltip-badge.high {
  color:#15803d;
  background:#dcfce7;
  border:1px solid #86efac;
}

.ab-ai-conf-tooltip-badge.medium {
  color:#b45309;
  background:#fef3c7;
  border:1px solid #fde047;
}

.ab-ai-conf-tooltip-badge.low {
  color:#b91c1c;
  background:#fee2e2;
  border:1px solid #fca5a5;
}

.ab-ai-conf-tooltip-label {
  color:#374151;
  flex:1 1 auto;
  line-height:1.5;
  font-size:0.75rem;
}

/* Responsive tooltip positioning */
@media (max-width:1400px) {
  .ab-ai-conf-tooltip {
    min-width:260px;
  }
}

/* Note: Select element styles removed - now using searchable select component */
/* See searchable-select.css for the new dropdown component styles */
.ab-add-mapping-select i { color:#6b7280; }
.ab-add-mapping-select:hover i { color:var(--mp-blue); }
.ab-remove-mapping-select i { font-size:.9rem;}

/* Filter groups (preview + result) */
.ab-map-filter-group .btn { background:#f5f7fa; border:1px solid #d0d6dd; color:#374151; font-size:.65rem; font-weight:500; padding:.35rem .7rem; border-radius:6px; line-height:1.1; }
.ab-map-filter-group .btn + .btn { margin-left:.25rem; }
.ab-map-filter-group .btn.active { background:var(--mp-blue); color:#fff; border-color:var(--mp-blue); }
.ab-map-filter-group .btn:not(.active):hover { background:#eef4ff; }

/* Results */
.ab-result-cell { font-size:.8rem; }
.ab-result-cell .ab-result-name { font-weight:600; font-size:.95rem; }
.ab-result-cell .ab-user-field-sample { font-size:.9rem; }
.ab-result-skip { opacity:.75; }
.ab-result-pair { display:flex; flex-direction:column; position:relative; }
.ab-result-error { color:var(--mp-error); cursor:pointer; position:relative; user-select:none; }
/* JavaScript-based tooltip for errors - more reliable across platforms including macOS */
.ab-error-tooltip {
  position: absolute;
  background: #fff;
  color: var(--mp-error);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  line-height: 1.2;
  min-width: 160px;
  max-width: 280px;
  white-space: pre-wrap;
  z-index: 9999;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
  border: 1px solid #e5e9ee;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* Fallback CSS tooltip for browsers that don't support JavaScript (kept for compatibility) */
.ab-result-error:hover:after { 
  content: attr(data-error); 
  position: absolute; 
  left: 0; 
  top: 100%; 
  margin-top: 6px; 
  background: #fff; 
  color: var(--mp-error); 
  padding: 8px 10px; 
  border-radius: 8px; 
  font-size: 0.75rem; 
  line-height: 1.2; 
  min-width: 160px; 
  max-width: 280px; 
  white-space: pre-wrap; 
  z-index: 30; 
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12); 
  border: 1px solid #e5e9ee; 
  pointer-events: none;
}

/* Hide CSS tooltip when JavaScript tooltip is present */
body:has(.ab-error-tooltip) .ab-result-error:hover:after {
  display: none;
}

/* Samples */
.ab-user-field-sample { font-size:.9rem; color:#6c757d; margin-top:2px; max-width:330px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

 /* Field column name */
.ab-field-name { font-weight:600; font-size:.95rem; max-width:280px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

 /* Buttons */
.ab-ai-map-btn.btn { background:transparent; border:1px solid transparent; color:var(--mp-blue); font-weight:500; padding:.55rem 1rem; border-radius:10px; display:inline-flex; align-items:center; gap:.45rem; font-size:.85rem; cursor:pointer; }
.ab-ai-map-btn.btn:hover:not(:disabled) { background:#e9f2ff; color:var(--mp-blue-hover); }
.ab-ai-map-btn.btn:disabled { opacity:.65; cursor:not-allowed; }
.ab-action-primary.btn { background:var(--mp-blue); border-color:var(--mp-blue); box-shadow:0 2px 4px rgba(10,97,255,.25); }
.ab-action-primary.btn:hover { background:var(--mp-blue-hover); border-color:var(--mp-blue-hover); }
.ab-action-secondary.btn { padding:.55rem 1.4rem; }
/* Outline style variant for review footer edit mapping */
#ab-map-footer .btn.btn-primary { background:#fff; color:var(--mp-blue); border:1px solid var(--mp-blue); box-shadow:none; }
#ab-map-footer .btn.btn-primary:hover { background:var(--mp-blue-light); }

/* Fixed footer */
#ab-map-footer { position:fixed; left:0; right:0; bottom:0; background:#fff; border-top:1px solid var(--mp-border-strong); padding:12px 48px 14px; display:flex; align-items:center; gap:12px; z-index:120; box-shadow:0 -2px 6px -2px rgba(0,0,0,.06); }
/* Adjust footer position when sidebar is visible */
body.ab-has-sidebar #ab-map-footer { left:15rem; }
body.ab-has-sidebar.ab-sidebar-collapsed #ab-map-footer { left:4rem; }

@media (max-width: 1024px) {
  #ab-map-footer { padding:10px 24px 12px; }
}

@media (max-width: 760px) {
  #ab-map-footer { padding:8px 16px 10px; flex-wrap:wrap; gap:8px; }
  #ab-map-footer button { font-size:.8rem; padding:.45rem 1rem; }
}

@media (max-width:575.98px) {
  body.ab-has-sidebar #ab-map-footer,
  body.ab-has-sidebar.ab-sidebar-collapsed #ab-map-footer { left:0; }
}

/* Hide transformations modal by default to avoid it expanding the page; show via .show */
.ab-trx-modal { position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(0,0,0,.35); z-index:1500; }
.ab-trx-modal.show { display:flex; }
.ab-trx-card { width:min(980px, 95vw); max-height:86vh; background:#fff; border-radius:14px; box-shadow:0 20px 50px rgba(0,0,0,.25); display:flex; flex-direction:column; overflow:hidden; }
.ab-trx-body { padding:16px; overflow:auto; }

/* Validation state */
.ab-select-invalid .form-select { border-color:#fd7e14; box-shadow:0 0 0 2px rgba(253,126,20,.2); }

/* Gear button */
.ab-gear-btn { border:none; background:transparent; color:#9aa2aa; padding:0 .25rem; cursor:pointer; }
.ab-gear-btn:hover:not(:disabled) { color:var(--mp-blue); }
.ab-gear-btn.active { color:var(--mp-blue); }
.ab-gear-btn:disabled { color:#d1d5db; cursor:not-allowed; opacity:0.5; }
/* Processing overlay */
.ab-processing-overlay { position:fixed; inset:0; display:none; align-items:center; justify-content:center; z-index:1100; backdrop-filter:blur(3px); background:rgba(255,255,255,.55); }
.ab-processing-wrap { display:flex; flex-direction:column; align-items:center; gap:16px; }
.ab-progress-ring { --p:0%; width:140px; height:140px; border-radius:50%; background:conic-gradient(var(--mp-blue) var(--p), #e6ecf3 0); display:grid; place-items:center; }
.ab-progress-ring > div { width:108px; height:108px; border-radius:50%; background:#fff; display:flex; align-items:center; justify-content:center; font-size:28px; font-weight:700; color:var(--mp-blue); }

/* Utility / text */
.text-muted { color:#6b7280 !important; }

/* Template modals */
#ab-template-modal.show, #ab-template-choice-modal.show, #ab-template-create-modal.show { display:flex; }

/* --- Responsive fixes for result column overflow --- */
@media (max-width: 1280px){
  #ab-mapping-table td:nth-child(3),
  #ab-result-mapping-table td:nth-child(3){ white-space:normal; }
  .ab-result-cell{ max-width:100%; overflow:hidden; }
  .ab-result-cell .ab-user-field-sample{ white-space:normal; word-break:break-word; }
}
@media (max-width: 760px){
  /* Mobile stack already applies; ensure wrapping + avoid overflow */
  #ab-mapping-table td:nth-child(3),
  #ab-result-mapping-table td:nth-child(3){ white-space:normal; }
  .ab-result-pair{ flex-direction:column; align-items:flex-start; }
  .ab-result-cell .ab-user-field-sample{ width:100%; white-space:normal; word-break:break-word; }
  /* Align mobile pseudo labels directly above dropdowns (skip arrow + gear width) */
  #ab-mapping-table tbody tr td:nth-child(2)::before { left:60px !important; }
  #ab-mapping-table tbody tr td:nth-child(3)::before { left:6px; }
}

/* ===== Mapping table adaptive refinements ===== */
#ab-mapping-table td { vertical-align:middle; white-space:normal; }
#ab-mapping-table td:nth-child(1) { max-width:330px; }
#ab-mapping-table td:nth-child(2) { max-width:580px; }
#ab-mapping-table td:nth-child(3) { max-width:420px; }

.ab-select-stack { overflow:visible; }
#ab-mapping-table td:nth-child(2) .ab-select-stack { display:block; padding:4px 0; }
#ab-mapping-table td:nth-child(2) .ab-select-stack .ab-select-item { align-items:center; flex-wrap:nowrap; }
@media (max-width:760px){
  #ab-mapping-table td:nth-child(2) .ab-select-stack .ab-select-item { flex-wrap:wrap; }
}
.ab-field-name, #ab-mapping-table td:first-child .ab-user-field-sample { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ab-result-cell .ab-user-field-sample { white-space:normal; word-break:break-word; }

#ab-mapping-table td:nth-child(2) .ab-select-stack, #ab-result-mapping-table td:nth-child(2) .ab-select-stack { display:flex; flex-direction:column; justify-content:center; padding-top:4px; padding-bottom:4px; }
#ab-mapping-table td:nth-child(2) .ab-select-stack:before, #ab-result-mapping-table td nth-child(2) .ab-select-stack:before { top:12px; bottom:12px; }
#ab-mapping-table td:nth-child(2) .ab-select-stack .ab-select-item, #ab-result-mapping-table td:nth-child(2) .ab-select-stack .ab-select-item { align-items:center; }

.ab-result-cell { display:flex; flex-wrap:wrap; align-items:center; gap:10px 18px; }
.ab-result-pair { justify-content:center; }

.ab-merged-field-list .ab-user-field-sample { white-space:nowrap; text-overflow:ellipsis; overflow:hidden; max-width:260px; display:inline-block; vertical-align:middle; }

@media (max-width:1400px){
  #ab-mapping-table td:nth-child(1){ max-width:280px; }
  #ab-mapping-table td:nth-child(2){ max-width:500px; }
  #ab-mapping-table td:nth-child(3){ max-width:360px; }
}
@media (max-width:1100px){
  #ab-mapping-table td:nth-child(2){ max-width:440px; }
}

@media (max-width:760px){
  #ab-mapping-table td { vertical-align:top; }
  #ab-mapping-table td:nth-child(2) .ab-select-stack { justify-content:flex-start; }
  .ab-result-cell { justify-content:flex-start; gap:6px 12px; }
  .ab-field-name, #ab-mapping-table td:first-child .ab-user-field-sample { white-space:normal; }
  /* Remove vertical connector & masking stub to eliminate tiny artifact near arrow on mobile */
  #ab-mapping-table .ab-select-stack:before,
  #ab-mapping-table .ab-select-stack .ab-select-item:last-of-type:after { display:none; }
  /* Allow content to align without extra left space */
  #ab-mapping-table td:nth-child(2) .ab-select-stack { padding-left:0; }
  .ab-select-item-arrow { width:auto; min-width:28px; display:flex; gap:.25rem; }
  .ab-select-item-arrow .ab-ai-conf { margin-left:2px; }
}

/* --- Vertical stacking for result column items (override) --- */
#ab-mapping-table .ab-result-cell,
#ab-result-mapping-table .ab-result-cell { display:flex; flex-direction:column; align-items:flex-start; gap:8px; }
#ab-mapping-table .ab-result-cell .ab-result-pair,
#ab-result-mapping-table .ab-result-cell .ab-result-pair { width:100%; }
/* Ensure sample text wraps properly */
#ab-mapping-table .ab-result-cell .ab-user-field-sample,
#ab-result-mapping-table .ab-result-cell .ab-user-field-sample { white-space:normal; }

/* ===== Moved from Mapping.cshtml: New Column Modal and Merge Modal base styles ===== */
/* New Column Modal */
#ab-new-col-modal.ab-simple-modal { position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(17,24,39,.45); z-index:2200; backdrop-filter:blur(2px); }
#ab-new-col-modal .ab-simple-modal-dialog { width:100%; max-width:420px; background:#fff; border-radius:14px; box-shadow:0 10px 40px -4px rgba(0,0,0,.28),0 0 0 1px rgba(0,0,0,.06); animation: abNewColFade .18s ease-out; display:flex; flex-direction:column; }
#ab-new-col-modal .ab-simple-modal-header { padding:14px 18px; border-bottom:1px solid #edf1f5; }
#ab-new-col-modal .ab-simple-modal-body { padding:18px; }
#ab-new-col-modal .ab-simple-modal-footer { padding:14px 18px; border-top:1px solid #edf1f5; }
#ab-new-col-modal input#ab-new-col-input:focus { box-shadow:0 0 0 .2rem rgba(13,110,253,.15); }
#ab-new-col-modal .text-danger { font-size:.7rem; }

/* AI Row Selection Modal - shared ab-simple-modal styles */
.ab-simple-modal { position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(17,24,39,.45); z-index:2200; backdrop-filter:blur(2px); }
.ab-simple-modal .ab-simple-modal-dialog { width:100%; background:#fff; border-radius:14px; box-shadow:0 10px 40px -4px rgba(0,0,0,.28),0 0 0 1px rgba(0,0,0,.06); animation: abNewColFade .18s ease-out; display:flex; flex-direction:column; max-height:90vh; }
.ab-simple-modal .ab-simple-modal-header { padding:14px 18px; border-bottom:1px solid #edf1f5; }
.ab-simple-modal .ab-simple-modal-body { padding:18px; overflow:auto; }
.ab-simple-modal .ab-simple-modal-footer { padding:14px 18px; border-top:1px solid #edf1f5; }
/* Animation */
@keyframes abNewColFade { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }

/* Merge modal */
#ab-merge-modal { position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:rgba(17,24,39,.45); z-index:2300; backdrop-filter:blur(2px); }
#ab-merge-modal.show { display:flex; }
.ab-merge-dialog { width:100%; max-width:960px; max-height:90vh; background:#fff; border-radius:14px; box-shadow:0 12px 48px -8px rgba(0,0,0,.35),0 0 0 1px rgba(0,0,0,.06); display:flex; flex-direction:column; animation:abNewColFade .18s ease-out; }
.ab-merge-header { padding:14px 18px; border-bottom:1px solid #edf1f5; display:flex; align-items:center; gap:.5rem; }
.ab-merge-body { padding:18px; overflow:auto; }
.ab-merge-footer { padding:14px 18px; border-top:1px solid #edf1f5; }
.ab-merge-cols { display:flex; gap:0; border:1px solid #eef2f6; border-radius:8px; overflow:hidden; min-height:320px; }
.ab-merge-cols-left, .ab-merge-cols-right { flex:1 1 50%; display:flex; flex-direction:column; }
.ab-merge-cols-left { background:#fafbfc; border-right:1px solid #eef2f6; }
.ab-merge-pane-title { padding:10px 14px; font-weight:600; letter-spacing:.5px; text-transform:uppercase; }
.ab-merge-src-list, .ab-merge-selected-list { flex:1 1 auto; overflow:auto; }
.ab-merge-src-item { padding:10px 14px; border-top:1px solid #eef2f6; display:flex; flex-direction:column; gap:2px; cursor:pointer; position:relative; }
.ab-merge-src-item:hover { background:#eef6ff; }
.ab-merge-src-item.active { background:#e0efff; }
.ab-merge-src-item input { position:absolute; left:10px; top:12px; }
.ab-merge-src-item .ab-merge-src-name { padding-left:22px; font-weight:600; font-size:.8rem; text-transform:uppercase; color:#55616d; }
.ab-merge-src-item .ab-merge-src-val { padding-left:22px; font-size:.85rem; font-weight:500; }
.ab-merge-selected-card { margin:12px 14px 0 14px; border:1px solid #e1e7ef; background:#fff; border-radius:10px; padding:10px 14px; display:flex; flex-direction:column; gap:4px; position:relative; }
.ab-merge-selected-card:first-child { margin-top:14px; }
.ab-merge-handle { cursor:grab; font-size:.9rem; color:#66727f; position:absolute; left:10px; top:10px; }
.ab-merge-remove { position:absolute; right:10px; top:10px; color:#d92d20; cursor:pointer; }
.ab-merge-selected-name { font-weight:600; font-size:.75rem; letter-spacing:.5px; text-transform:uppercase; color:#55616d; padding-left:20px; }
.ab-merge-selected-val { font-weight:500; padding-left:20px; }
.ab-merge-preview { background:#eef4ff; border:1px solid #d3e3ff; padding:12px 16px; border-radius:10px; font-weight:500; min-height:44px; display:flex; align-items:center; }

/* Merge modal result preview */
.ab-merge-result-display .ab-result-pair { display:flex; flex-direction:column; gap:4px; }
.ab-merge-result-display .ab-result-name { font-weight:600; font-size:.85rem; color:#374151; }
.ab-merge-result-display .ab-user-field-sample { font-size:.8rem; color:#6b7280; padding:8px 12px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:6px; font-family:ui-monospace, 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace; }

/* Merged target display in table */
.ab-merged-target-display { 
  font-size:.8rem; 
  font-weight:600; 
  padding:.5rem .75rem; 
  background:#f8fafc; 
  border:1px solid #e2e8f0; 
  border-radius:6px; 
  color:#374151;
  max-width:240px;
  min-width:140px;
}
.ab-merged-target-display.text-primary { 
  background:#eff6ff; 
  border-color:#bfdbfe; 
  color:var(--mp-blue); 
}

@media (max-width:760px){ 
  #ab-merge-modal .ab-merge-cols{flex-direction:column; height:auto; max-height:none;} 
  #ab-merge-modal .ab-merge-cols-left{flex:0 0 auto; max-width:none; border-right:none; border-bottom:1px solid #e5e9ef;} 
  #ab-merge-modal #ab-merge-target{width:160px;}
}

/* Mapping page column cell overrides to mirror MappingResult layout and constrain content */
#ab-mapping-table tbody tr td:nth-child(2){position:relative; overflow:hidden;}
#ab-mapping-table tbody tr td:nth-child(3){overflow:hidden;}
#ab-mapping-table tbody tr td:nth-child(2) .ab-select-stack{display:flex;flex-direction:column;justify-content:center;gap:.45rem;padding:4px 0;min-height:100%;overflow:visible;}
#ab-mapping-table tbody tr td:nth-child(2) .ab-select-stack .ab-select-item{display:flex;align-items:center;gap:.5rem;margin:0;flex-wrap:nowrap;}
#ab-mapping-table .ab-select-stack:before,
#ab-mapping-table .ab-select-stack .ab-select-item:last-of-type:after{display:none !important;}
#ab-mapping-table .ab-select-item-arrow{width:auto; min-width:32px; flex-shrink:0; display:flex; align-items:center; gap:.25rem;}
#ab-mapping-table .ab-select-item .form-select{max-width:240px;min-width:140px;flex:0 0 auto;width:auto;padding-right:2rem;}
@media (max-width:760px){
  #ab-mapping-table tbody tr td:nth-child(2) .ab-select-stack .ab-select-item{flex-wrap:wrap;}
  #ab-mapping-table .ab-select-item .form-select{min-width:120px;max-width:100%;flex:1 1 auto;}
  #ab-mapping-table tbody tr td:nth-child(2)::before{left:60px !important;}
  #ab-mapping-table .ab-select-item-arrow{width:auto; min-width:28px;}
}

/* Required fields styling in dropdowns */
select.ab-column-select option[data-required="true"] {
  font-weight: 500;
  position: relative;
}

/* Required field text can be grayed out when disabled, but asterisk stays red */
select.ab-column-select option[data-required="true"]:disabled {
  color: #6b7280 !important; /* Gray out the field name when disabled */
}

/* Asterisk styling - always red regardless of disabled state */
.ab-asterisk-red {
  color: #dc3545 !important; /* Bootstrap danger color - always red */
  font-weight: bold !important;
}

/* Override any disabled styling for the asterisk specifically */
select.ab-column-select option[data-required="true"]:disabled .ab-asterisk-red,
select.ab-column-select option:disabled .ab-asterisk-red {
  color: #dc3545 !important; /* Force red asterisk even when disabled */
}

/* Ensure disabled options are grayed out but asterisk remains red */
select.ab-column-select option:disabled {
  color: #6b7280 !important;
  opacity: 1; /* Remove default opacity to control color manually */
}

/* Force asterisk color in disabled options */
select.ab-column-select option:disabled .ab-asterisk-red {
  color: #dc3545 !important;
  opacity: 1 !important;
}

/* Alternative approach for better browser compatibility */
.ab-required-field-option {
  font-weight: 500;
}

/* Ensure required field options can be styled properly when disabled */
select.ab-column-select option[data-required="true"] {
  background-color: inherit;
}

select.ab-column-select option[data-required="true"]:disabled {
  background-color: inherit;
}

/* Force red color for asterisk in all states - highest priority */
.ab-asterisk-red {
  color: #dc3545 !important;
  font-weight: bold !important;
}

/* Additional specificity for asterisk styling */
select option .ab-asterisk-red,
select.ab-column-select option .ab-asterisk-red,
select.form-select option .ab-asterisk-red {
  color: #dc3545 !important;
  font-weight: bold !important;
}

/* ===== Cross-platform dropdown option styling ===== */
/* Note: macOS browsers (Safari, Chrome) don't support color styling on native <option> elements.
   Text prefixes (+ and ✕) are added via JavaScript for cross-platform visibility.
   These styles provide color on supported browsers as enhancement. */

/* Default option color - black/dark for regular fields */
select.ab-column-select option,
select.form-select option {
  color: #1f2937;
  font-weight: normal;
}

/* Create new option and custom fields - blue color on supported platforms */
select.ab-column-select option.ab-option-create-new,
select.form-select option.ab-option-create-new,
select.ab-column-select option.ab-option-custom,
select.form-select option.ab-option-custom,
.ab-column-select option.text-primary,
select option.text-primary {
  color: #0a61ff !important;
  font-weight: 500;
}

/* Skip column option - red color on supported platforms */
select.ab-column-select option.ab-option-skip,
select.form-select option.ab-option-skip,
.ab-column-select option.text-danger,
select option.text-danger {
  color: #dc3545 !important;
  font-weight: 500;
}

/* Skip column selected - red text styling for the select element itself */
select.ab-column-select.ab-skip-selected,
select.form-select.ab-skip-selected {
  color: #dc3545 !important;
  font-weight: 500;
}

/* Override: options inside skip-selected select should keep their own colors */
select.ab-column-select.ab-skip-selected option,
select.form-select.ab-skip-selected option {
  color: #1f2937;
  font-weight: normal;
}
select.ab-column-select.ab-skip-selected option.ab-option-create-new,
select.ab-column-select.ab-skip-selected option.ab-option-custom,
select.form-select.ab-skip-selected option.ab-option-create-new,
select.form-select.ab-skip-selected option.ab-option-custom {
  color: #0a61ff !important;
  font-weight: 500;
}
select.ab-column-select.ab-skip-selected option.ab-option-skip,
select.form-select.ab-skip-selected option.ab-option-skip {
  color: #dc3545 !important;
  font-weight: 500;
}

/* Additional/new column selected - blue text styling for the select element itself */
select.ab-column-select.ab-additional-selected,
select.form-select.ab-additional-selected {
  color: var(--mp-blue, #0a61ff) !important;
  font-weight: 500;
}

/* Override: options inside additional-selected select should keep their own colors */
select.ab-column-select.ab-additional-selected option,
select.form-select.ab-additional-selected option {
  color: #1f2937;
  font-weight: normal;
}
select.ab-column-select.ab-additional-selected option.ab-option-create-new,
select.ab-column-select.ab-additional-selected option.ab-option-custom,
select.form-select.ab-additional-selected option.ab-option-create-new,
select.form-select.ab-additional-selected option.ab-option-custom {
  color: #0a61ff !important;
  font-weight: 500;
}
select.ab-column-select.ab-additional-selected option.ab-option-skip,
select.form-select.ab-additional-selected option.ab-option-skip {
  color: #dc3545 !important;
  font-weight: 500;
}
