/* ================= BASE ================= */
body {
    margin: 0;
    font-family: Arial, sans-serif;
}

/* ================= HEADER ================= */
#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1f2937;
    color: white;
    padding: 10px 15px;
}

.title {
    font-weight: bold;
}

.status {
    font-size: 13px;
}

/* ================= APP LAYOUT ================= */
#app {
    display: flex;
    height: calc(100vh - 40px);
    overflow: hidden;
}


/* ================= MAIN CONTENT ================= */
#main {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
}
/* ================= MODAL CONTENT ================= */
.modal-content {
    background: white;
    padding: 20px;
    width: 320px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 6px;
    box-sizing: border-box;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}


/* ================= IMAGE PANEL ================= */
#imagePanel {
    flex: 2;
    resize: horizontal;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 6px 10px;
    background: #f9fafb;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}

#imgWrapper {
    position: relative;
    flex: 1;
    overflow: auto;
    user-select: none;
}

#targetImg {
    position: relative;
    z-index: 1;
    cursor: none;
}

/* ================= DATA PANEL ================= */
#dataPanel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #ddd;
}

.dataTables_wrapper {
    width: 100%;
    overflow: hidden;
}

table.dataTable {
    width: 100% !important;
}

/* ================= TABS ================= */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
}

.tab {
    padding: 8px 12px;
    cursor: pointer;
    border: none;
    background: #f3f4f6;
}

.tab.active {
    background: white;
    border-bottom: 2px solid #007bff;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: auto;
}

.tab-content.active {
    display: block;
}

/* ================= MARKERS ================= */
.drag-line {
    position: absolute;
    height: 1px;
    transform-origin: left center;
    z-index: 10;
    pointer-events: none;
}

.origin-dot {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    pointer-events: none;
}

.marker.dragging {
    cursor: grabbing;
    opacity: 0.85;
}

.marker {
    position: absolute;

    padding:4px;

    transform: translate(-50%, -50%) ;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid #000;
    color: white;
    font-weight: bold;
    font-size: 14px;

    cursor: pointer;
    z-index: 15;

    user-select: none;

    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.marker span {
    
}

.marker.cont { background: #007bff; }
.marker.loop { background: #dc3545; }
.marker.manual { color: #28a745 !important; }

.marker.selected {
    outline: 3px solid yellow;
}

/* ================= PREVIEW ================= */
.preview-marker {
    position: absolute;
    background: white;
    color: black;
    font-size: 14px;
    border-radius: 50%;
    font-family: sans-serif;
    padding: 4px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    font-weight: bold;
    z-index: 30;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    border: 1px solid #000;
}

/* ================= GUIDE LINES ================= */
.guide-line {
    position: absolute;
    background: rgba(0,150,255,0.7);
    pointer-events: none;
    z-index: 20;
}

.guide-line.horizontal {
    height: 1px;
    width: 100%;
}

.guide-line.vertical {
    width: 1px;
    height: 100%;
}

/* ================= TABLE HIGHLIGHT ================= */
.mapped-row {
    background-color: #d4edda !important;  /* ✅ light green */
}
.selected-row, .mapped-row.selected-row {
    background: yellow !important;
}
.next-row {
    outline: 2px solid orange;
    background: #FFD580 !important;
}

/* ================= PDF VIEWER ================= */
#pdfViewer {
  overflow: hidden;
  position: relative;
  cursor: grab;
}

#pdfViewer:active {
  cursor: grabbing;
}

#pdf-canvas,
#overlay {
  position: absolute;
  top: 0;
  left: 0;
}

#overlay {
  pointer-events: none;
}

#zoom-indicator {
  font-size: 12px;
  color: #555;
  margin-left: 10px;
  display: inline-block;
}

/* ================= SECTIONS ================= */
.section-item {
  padding: 6px 10px;
  margin: 4px 0;
  background: #eee;
  cursor: pointer;
  border-radius: 4px;
}

.section-item:hover {
  background: #ccc;
}

#marker-layer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.marker {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ✅ item */
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
}

/* ✅ hover */
.file-item:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

/* ✅ active file */
.file-item.active {
  background: #2563eb;
  color: white;
  border-color: #1d4ed8;
}

/* ✅ file name */
.file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ✅ badge (rows count or type) */
.file-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
}

/* ✅ active badge */
.file-item.active .file-badge {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* ✅ optional icon */
.file-icon {
  margin-right: 6px;
  opacity: 0.6;
}

.next-measurement {
  background-color: rgba(34, 197, 94, 0.15); /* soft green */
  border-left: 4px solid #22c55e;
  font-weight: 500;
}

.next-measurement td:first-child::before {
  content: "➤ ";
  color: #22c55e;
  font-weight: bold;
}

.selected-measurement {
  background-color: rgba(59, 130, 246, 0.2);
  border-left: 4px solid #3b82f6;
  font-weight: 600;
}

.selected-measurement td:first-child::before {
  content: "➤ ";
  color: #ea12bb;
  font-weight: bold;
}

/* ================= SIDEBAR ================= */

#sidebar {
  width: 260px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  overflow-x: hidden;
  overflow-y: scroll;
}

/* container */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 16px;
}

/* ================= HEADER ================= */

.sidebar-header {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

/* ================= BLOCK ================= */

.sidebar-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* section title */
.block-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #9ca3af;
  letter-spacing: 0.5px;
}

/* ================= TOOLBAR (VERTICAL) ================= */

.toolbar-vertical {
  display: flex;
  flex-direction: column;
  gap: 8px;

  width: 100%;        /* ✅ ensures children align */
  box-sizing: border-box;
}

/* button base */
.tool-btn {
  display: flex;

  align-items: center;
  gap: 10px;

  width: 100%;
  box-sizing: border-box;

  padding: 8px 10px;

  border: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 6px;

  cursor: pointer;
  font-size: 13px;

  /* ✅ CRITICAL FIX */
  max-width: 100%;
}

.tool-btn input {
  display: none;
}

label.tool-btn {
  display: flex;   /* ✅ FORCE block behavior */
  width: 100%;     /* ✅ ensure proper sizing */
}


/* icon */
.tool-btn i {
  width: 18px;
  text-align: center;
  color: #6b7280;
}

/* label */
.tool-btn span {
  flex: 1;
  text-align: left;
}

/* hover */
.tool-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* primary action */
.tool-btn.primary {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.tool-btn.primary i {
  color: white;
}

.tool-btn.primary:hover {
  background: #1d4ed8;
}

/* active press */
.tool-btn:active {
  transform: scale(0.98);
}

.tool-btn.danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.tool-btn.danger i {
  color: #991b1b;
}

.tool-btn.danger:hover {
  background: #fecaca;
}


/* ================= FILE LIST ================= */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

/* file item */
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.file-item:hover {
  background: #f3f4f6;
}

.file-item.active {
  background: #e0f2fe;
}

/* icon */
.file-icon {
  width: 16px;
  color: #9ca3af;
}

/* text container */
.file-text {
  flex: 1;
  min-width: 0;
}

/* ✅ long filename fix */
.file-name {
  font-size: 13px;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* metadata */
.file-meta {
  font-size: 11px;
  color: #6b7280;
}

/* ================= SECTIONS ================= */

.section-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.section-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.section-item:hover {
  background: #f3f4f6;
}

.section-item.active {
  background: #e0f2fe;
}

/* badge */
.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
}

/* ================= ACTION BUTTON ================= */

.action-btn {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  font-size: 13px;
}

.action-btn:hover {
  background: #f3f4f6;
}

.action-btn.danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

/* ================= EMPTY ================= */

.empty {
  font-size: 12px;
  color: #9ca3af;
  font-style: italic;
}
