html, body {
  height: auto;
  overflow: auto;
}

body {
  font-family: Arial, sans-serif;
  margin: 20px;
  color: #333;
}

/* ---------------- HEADER ---------------- */
.header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.header input {
  padding: 8px;
  font-size: 16px;
  min-width: 260px;
}
.header button {
  padding: 8px 14px;
  font-size: 15px;
  cursor: pointer;
}

/* Buttons */
.upload-btn {
  background: #2f6fed;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
}
.save-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #ccc;
  border-top-color: #2f6fed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------------- STRUCTURE ---------------- */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.item-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.items-caption {
  font-size: 18px;
  font-weight: bold;
}

.items-container {
  min-height: 60px;
}

/* ---------------- ITEM ROW LAYOUT ---------------- */
.item-row {
  display: flex;
  flex-direction: column;   /* top line + thumbnails below */
  align-items: flex-start;
  width: 420px;
  padding: 6px 0;
  gap: 4px;                 /* space between main line and strip */
}

/* top line: label + tri switch */
.item-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Ensure label column doesn't stretch */
.item-label {
  flex: 0 0 180px;
  font-size: 14px;
}

/* ---------------- TRI-STATE SWITCH ---------------- */
.tri-switch {
  position: relative;
  width: 180px;
  height: 28px;
  background: #e5e5e5;
  border-radius: 14px;
  padding: 2px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  cursor: pointer;
}

.tri-zone {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: #333;
  user-select: none;
  z-index: 3;
}

.tri-switch-thumb {
  position: absolute;

  /* Center perfectly vertically */
  top: 50%;
  transform: translateY(-50%);

  width: 56px;
  height: 24px;
  border-radius: 12px;

  transition: left 0.2s ease, background 0.2s ease, border 0.2s ease;
  z-index: 2;
}
/* State 0: ignore — blue fill */
.tri0 {
  background: #2f6fed;
  border: 2px solid #2f6fed;
}

/* State 1: required — green outline */
.tri1 {
  background: transparent;
  border: 2px solid #28a745;
}

/* State 2: match — green fill */
.tri2 {
  background: #28a745;
  border: 2px solid #28a745;
}

/* ---------------- SMALL IMAGES ---------------- */
.small-images-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.small-image-box {
  border: 3px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.small-image-box.green { border-color: #28a745; }
.small-image-box.orange { border-color: #ffa500; }

.small-image {
  height: 120px;
  border-radius: 4px;
}

/* ---------------- LARGE IMAGE ---------------- */
.large-image-box {
  position: relative;
}

.large-image {
  max-width: 650px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.detections-layer {
  position: absolute;
  top: 0;
  left: 0;
}

.bbox {
  position: absolute;
  border: 3px solid;
  border-radius: 4px;
  pointer-events: none;
}

.bbox-label {
  position: absolute;
  top: -18px;
  left: 0;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 2px 4px;
  font-size: 12px;
  border-radius: 2px;
}

.bbox.blue  { border-color: #007bff; }
.bbox.green { border-color: #28a745; }
.bbox.yellow{ border-color: #ffc107; }

/* MATCH THUMBNAIL STRIP */
.match-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 0px; /* aligns under tri-switch */
}

.thumb-checkbox {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid #28a745;
  background: white;
  cursor: pointer;
  z-index: 10;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
  font-weight: bold;
  color: black;
  line-height: 1;
}

/* Included → show check mark */
.thumb-checkbox.checked {
  background: #28a745;
  color: white;
}

/* Checkmark symbol */
.thumb-checkbox.checked::after {
  content: "✓";
}

/* Excluded → show X */
.thumb-checkbox:not(.checked)::after {
  content: "✕";
}

.status-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 15px;
}

.status-text {
  font-size: 14px;
  color: #666;
  font-style: italic;
}

.profile-name-input {
  padding: 4px 8px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Ensure checkbox sits inside thumbnail */
.match-thumb {
  position: relative;   /* REQUIRED for absolute checkbox */
  width: 80px;
  height: 80px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #eee;
  background-repeat: no-repeat;
  overflow: hidden;
}

/* === PROFILE DROPDOWN === */
.styled-dropdown {
  margin-left: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f9f9f9;
  border: 1px solid #ccc;
  font-size: 15px;
  cursor: pointer;
  min-width: 200px;
  transition: all 0.15s ease-in-out;
}

.styled-dropdown:hover {
  background: #fff;
  border-color: #999;
}

.styled-dropdown:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 3px rgba(0, 123, 255, 0.3);
}

/* === PROFILE TEXT INPUT === */
.styled-input {
  margin-left: 0px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 15px;
  border: 1px solid #ccc;
  background: #fff;
  min-width: 200px;
  transition: all 0.2s ease;
}

.styled-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 4px rgba(0, 123, 255, 0.3);
}

/* === ALIGNMENT FOR HEADER INPUT + BUTTON === */
.profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-name-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.hybrid-input {
  padding-right: 34px; /* room for arrow */
  width: 260px;
}

.dropdown-arrow {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.7;
}

.dropdown-arrow:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.dropdown-panel {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  border: 1px solid #aaa;
  border-radius: 6px;
  background: white;
  z-index: 2000;
  box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.dropdown-item {
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.dropdown-item:hover {
  background: #eee;
}

.dropdown-empty {
  padding: 8px 10px;
  color: #777;
}

.revert-btn, .new-btn {
  padding: 6px 12px;
  background-color: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.revert-btn:hover:not([disabled]),
.new-btn:hover:not([disabled]) {
  background-color: #ddd;
}

.profile-combo {
  position: relative;
  width: 260px;
}

.profile-name-input {
  width: 100%;
  padding: 6px 30px 6px 8px;
  border: 1px solid #aaa;
  border-radius: 4px;
  font-size: 16px;
  box-sizing: border-box;
}

.profile-dropdown-arrow {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
}

.profile-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: white;
  border: 1px solid #aaa;
  border-radius: 4px;
  margin-top: 2px;
  box-shadow: 0px 3px 8px rgba(0,0,0,0.2);
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
}

.profile-dropdown-item {
  padding: 8px 10px;
  cursor: pointer;
}

.profile-dropdown-item:hover {
  background: #e7f1ff;
}

/**********************************************
 * SHARED INPUT + BUTTON STYLE
 **********************************************/
.profile-select,
.profile-name-input {
    width: 260px;
    height: 34px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    outline: none;
    font-size: 14px;
}

.profile-select:disabled,
.profile-name-input:disabled {
    background: #eee;
    cursor: not-allowed;
}

/**********************************************
 * BUTTON STYLE (all action buttons unified)
 **********************************************/
.action-btn,
.save-btn,
.revert-btn,
.new-profile-btn,
.upload-btn {
    background: #4a7bd7;
    border: none;
    padding: 6px 14px;
    height: 34px;
    border-radius: 6px;
    font-size: 14px;
    color: white;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.action-btn:hover,
.save-btn:hover,
.revert-btn:hover,
.new-profile-btn:hover,
.upload-btn:hover {
    background: #3a6ac4;
}

.action-btn:disabled,
.save-btn:disabled,
.revert-btn:disabled,
.new-profile-btn:disabled,
.upload-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/**********************************************
 * HEADER ROWS LAYOUT
 **********************************************/
.header-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 18px; /* space between rows */
}

/**********************************************
 * DROPDOWN MENU (profile selection)
 **********************************************/
.profile-dropdown-menu {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    margin-top: 4px;
    z-index: 20;
    width: 260px;
    max-height: 250px;
    overflow-y: auto;
}

.profile-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.profile-dropdown-item:hover {
    background: #eef3ff;
}

/**********************************************
 * STATUS AREA (spinner + text)
 **********************************************/
.status-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #ccc;
    border-top-color: #4a7bd7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.small-image-box {
  position: relative;
}

/* Wrapper so overlay can sit on top of the image */
.small-image-inner {
  position: relative;
}

/* Dark overlay on top of the thumbnail */
.image-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Simple circular spinner */
.image-upload-spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  animation: image-upload-spin 0.8s linear infinite;
}

@keyframes image-upload-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Optional: visually disable delete button while uploading */
.delete-btn.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Optional: slightly dim the box while uploading */
.small-image-box.is-uploading {
  opacity: 0.7;
}




