/**
 * KVP Results Modal - Displays extracted key-value pairs with document preview
 * Matches the clean, professional design from the screenshot
 */

/* Modal Overlay */
.kvp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;  /* Hidden by default - won't block clicks */
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.kvp-modal-overlay.show {
  display: flex;  /* Show when active */
  opacity: 1;
}

/* Modal Container */
.kvp-modal {
  background: white;
  width: 95vw;
  height: 90vh;
  max-width: 1600px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.kvp-modal-overlay.show .kvp-modal {
  transform: scale(1);
}

/* Modal Header */
.kvp-modal-header {
  padding: 20px 30px;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  position: relative;
}

.kvp-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  text-align: center;
}

.kvp-modal-file-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kvp-file-nav-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  line-height: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
}

.kvp-file-nav-btn:hover:not(.disabled) {
  background: #f0f0f0;
  color: #333;
}

.kvp-file-nav-btn.disabled {
  opacity: 0.3;
  cursor: default;
}

/* Custom tooltip */
.kvp-file-nav-btn::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  white-space: nowrap;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 10;
}

.kvp-file-nav-btn:hover::after {
  opacity: 1;
}

/* File dropdown chevron button */
.kvp-file-dropdown-btn {
  background: none;
  border: none;
  font-size: 14px;
  color: #999;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.2s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kvp-file-dropdown-btn:hover,
.kvp-file-dropdown-btn.open {
  color: #333;
  background: #f0f0f0;
}

.kvp-file-dropdown-btn.open {
  transform: rotate(180deg);
}

/* File dropdown panel */
.kvp-file-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.1);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 12px;
}

.kvp-file-dropdown.open {
  opacity: 1;
  visibility: visible;
}

.kvp-file-dropdown-folder {
  font-family: var(--font-family-medium, sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: #333;
  text-align: center;
  padding: 0 4px 8px 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 10px;
}

.kvp-file-dropdown-search {
  display: flex;
  align-items: center;
  border: 2px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 6px 10px;
  gap: 8px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}

.kvp-file-dropdown-search:focus-within {
  border-color: var(--color-primary);
}

.kvp-file-dropdown-search input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font-family: var(--font-family-base);
  font-size: 13px;
  color: var(--color-text);
  min-width: 0;
}

.kvp-file-dropdown-search input::placeholder {
  color: rgba(0, 0, 0, 0.35);
  font-size: 12px;
}

.kvp-file-dropdown-search-icon {
  width: 14px;
  height: 14px;
  opacity: 0.35;
  flex-shrink: 0;
}

.kvp-file-dropdown-list {
  max-height: calc(4 * 38px);
  overflow-y: auto;
}

.kvp-file-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  font-family: var(--font-family-base);
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kvp-file-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.kvp-file-dropdown-empty {
  padding: 12px 10px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.4);
  text-align: center;
}

.kvp-modal-filetype-icon {
  position: absolute;
  left: 30px;
  width: 48px;
  height: 48px;
  opacity: 0.55;
}

.kvp-modal-header .kvp-modal-close {
  position: absolute;
  right: 30px;
}

.kvp-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.kvp-modal-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* Modal Body - Three Column Layout */
.kvp-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Sidebar - Page Thumbnails */
.kvp-modal-thumbnails {
  width: 110px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kvp-modal-thumbnails-header {
  height: 47px;
  min-height: 47px;
  background: white;
  border-bottom: 1px solid #e5e5e5;
  box-sizing: border-box;
}

#kvp-thumbnails-list {
  flex: 1;
  overflow-y: auto;
  background: #e8e8e8;
  padding: 12px 12px 15px;
}

.thumbnail-item {
  margin-bottom: 10px;
  cursor: pointer;
  border-radius: 4px;
  border: 2px solid #ddd;
  transition: all 0.2s;
  position: relative;
  background: white;
  overflow: visible;
}

.thumbnail-item:hover {
  border-color: #999;
}

.thumbnail-item.active {
  border-color: #7cb342;
  box-shadow: 0 2px 8px rgba(124, 179, 66, 0.3);
}

.thumbnail-item.has-error {
  border-color: #f44336;
}

.thumbnail-item.has-error::after {
  content: '!';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: #f44336;
  color: white;
  font-size: 12px;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}

.thumbnail-page-number {
  text-align: center;
  font-size: 10px;
  font-weight: 500;
  color: #5a8a20;
  background: rgba(124, 179, 66, 0.2);
  padding: 3px 0;
  border-radius: 0 0 2px 2px;
}

/* Center - Document Preview */
.kvp-modal-preview {
  flex: 0 0 50%;
  min-width: 0;
  min-height: 0;
  background: #FAF9F5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: none;
}

.preview-header {
  height: 47px;
  box-sizing: border-box;
  padding: 0 20px;
  background: white;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kvp-multidoc-banner {
  padding: 6px 20px;
  background: rgba(124, 179, 66, 0.12);
  color: #5a8a2a;
  font-family: 'n27medium', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid rgba(124, 179, 66, 0.2);
}

.preview-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kvp-zoom-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 8px;
  border: none;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}

.kvp-zoom-wrapper:hover {
  background: rgba(0, 0, 0, 0.06);
}

.preview-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kvp-zoom-icon {
  opacity: 0.65;
  flex-shrink: 0;
}

.kvp-zoom-select {
  font-family: var(--font-family-base, sans-serif);
  font-size: 12px;
  padding: 0;
  border: none;
  background: transparent;
  color: #666;
  cursor: pointer;
  outline: none;
}

.preview-pagination {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 14px;
  color: #666;
}

.preview-pagination button {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 18px;
  color: #666;
}

.preview-pagination button:hover:not(:disabled) {
  background: #e5e5e5;
  color: #333;
}

.preview-pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.preview-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAF9F5;
}

.preview-content.zoomed {
  align-items: flex-start;
  justify-content: flex-start;
}

.preview-content.zoomed img {
  flex-shrink: 0;
}

.preview-content img {
  max-width: calc(100% - 40px);
  max-height: calc(100% - 40px);
  width: auto;
  height: auto;
  display: block;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  background: white;
  image-rendering: -webkit-optimize-contrast;
}

/* Right Sidebar - Extracted Data */
.kvp-modal-data {
  flex: 1;
  min-width: 0;
  background: white;
  border-left: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.data-header {
  padding: 0;
  background: white;
}

.data-header h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}


/* Page metadata (sector + doc type) */
.kvp-page-meta {
  display: flex;
  align-items: center;
  padding: 8px 25px;
  background: #f9f9f9;
  font-size: 12px;
  color: #555;
  gap: 12px;
}

.kvp-page-meta:empty {
  display: none;
}

.kvp-meta-sector {
  width: 40%;
  min-width: 120px;
  max-width: 220px;
  flex-shrink: 0;
}

.kvp-meta-doctype {
  flex: 1;
}

.kvp-meta-label {
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.kvp-meta-value {
  font-size: 13px;
  color: #333;
  text-transform: capitalize;
}

.data-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Field Items */
.kvp-field-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 25px;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.2s;
}

.kvp-field-item:hover {
  background: #fafafa;
}

.kvp-copy-btn {
  flex-shrink: 0;
  align-self: flex-start;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: #aaa;
  cursor: pointer;
  padding: 0;
  margin-top: 2px;
  transition: color 0.15s;
}

.kvp-copy-btn:hover {
  color: #333;
}

.kvp-copy-btn.copied {
  color: #4caf50;
}

.kvp-copy-btn .copy-icon-svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: currentColor;
  transition: all 0.125s ease;
}

.kvp-field-label {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  width: 40%;
  min-width: 120px;
  max-width: 220px;
}

.kvp-field-page {
  font-size: 10px;
  color: #bbb;
  font-weight: 500;
}

.kvp-field-value {
  font-size: 13px;
  color: #333;
  font-weight: 400;
  line-height: 1.5;
  word-wrap: break-word;
  flex: 1;
  min-width: 0;
}

.kvp-field-value.empty {
  color: #ccc;
  font-style: italic;
}

.kvp-field-value.found {
  color: #333;
}

.kvp-field-value.uncertain {
  color: #ff9800;
}

/* Page number inside single value */
.kvp-field-value .kvp-field-page {
  font-size: 10px;
  color: #bbb;
  font-weight: 500;
  margin-left: 8px;
}

/* Multi-value list */
.kvp-field-value-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kvp-field-value.multi-value {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f9f9f9;
  border-radius: 4px;
  margin-bottom: 0;
}

.value-bullet {
  color: #7cb342;
  font-weight: bold;
  flex-shrink: 0;
}

.value-text {
  flex: 1;
}

/* Page number inside multi-value item */
.kvp-field-value.multi-value .kvp-field-page {
  font-size: 10px;
  color: #bbb;
  font-weight: 500;
  margin-left: auto;
}

.kvp-field-confidence {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 3px;
  background: #f5f5f5;
  color: #666;
}

.kvp-field-confidence.high {
  background: #e8f5e9;
  color: #4caf50;
}

.kvp-field-confidence.medium {
  background: #fff3e0;
  color: #ff9800;
}

.kvp-field-confidence.low {
  background: #ffebee;
  color: #f44336;
}

/* Stats Summary */
.kvp-stats-summary {
  padding: 20px 25px;
  background: #f9f9f9;
  border-bottom: 1px solid #e5e5e5;
}

.kvp-stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.kvp-stat-badge {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
}

.kvp-stat-badge.total {
  background: #e3f2fd;
  color: #1976d2;
}

.kvp-stat-badge.found {
  background: #e8f5e9;
  color: #4caf50;
}

.kvp-stat-badge.missing {
  background: #f5f5f5;
  color: #999;
}

.stat-number {
  display: block;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 2px;
}

.stat-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

/* Modal Footer */
.kvp-modal-footer {
  padding: 20px 30px;
  border-top: 1px solid #e5e5e5;
  background: #fafafa;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.kvp-reprocess-btn {
  padding: 10px 24px;
  background: white;
  border: 1px solid #7cb342;
  color: #7cb342;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.kvp-reprocess-btn:hover {
  background: #7cb342;
  color: white;
}

.kvp-modal-actions {
  display: flex;
  gap: 10px;
}

.kvp-export-btn {
  padding: 0.625rem 1.5rem;
  background: #7cb342;
  border: none;
  color: white;
  font-family: 'n27medium', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.kvp-export-btn:hover {
  background: #6da536;
}

.kvp-export-arrow {
  display: inline-block;
  font-size: 8px;
  margin-left: 4px;
  vertical-align: middle;
  transition: transform 0.2s ease;
}

.kvp-export-btn.open .kvp-export-arrow {
  transform: rotate(180deg);
}

/* Export Data Dropup */
.kvp-export-dropup {
  position: relative;
}

.kvp-export-dropup-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  min-width: 160px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  display: flex;
  flex-direction: column;
  padding: 4px 0;
}

.kvp-export-dropup-menu.open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.kvp-export-dropup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
  transition: background 0.1s;
  letter-spacing: -0.01em;
  margin: 0 4px;
  border-radius: 6px;
}

.kvp-export-dropup-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

.kvp-export-checkbox {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid #c7c7cc;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kvp-export-checkbox:checked {
  background: #7cb342;
  border-color: #7cb342;
}

.kvp-export-checkbox:checked::after {
  content: '';
  display: block;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  margin-top: -1px;
}

.kvp-export-download-btn {
  width: calc(100% - 8px);
  margin: 4px auto 4px;
  padding: 7px 14px;
  border: none;
  background: #7cb342;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 8px;
  letter-spacing: -0.01em;
}

.kvp-export-download-btn:hover {
  background: #6da536;
}

.kvp-export-download-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Empty State */
.kvp-empty-state {
  padding: 60px 40px;
  text-align: center;
  color: #999;
}

.kvp-empty-state-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.kvp-empty-state h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #666;
}

.kvp-empty-state p {
  margin: 0;
  font-size: 14px;
  color: #999;
}

/* Loading State */
.kvp-loading {
  padding: 60px 40px;
  text-align: center;
}

.kvp-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f0f0f0;
  border-top-color: #7cb342;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.kvp-loading p {
  margin: 0;
  font-size: 14px;
  color: #999;
}

/* Scrollbar Styling */
#kvp-thumbnails-list::-webkit-scrollbar,
.data-content::-webkit-scrollbar,
.preview-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#kvp-thumbnails-list::-webkit-scrollbar-track,
.data-content::-webkit-scrollbar-track,
.preview-content::-webkit-scrollbar-track {
  background: #f5f5f5;
}

#kvp-thumbnails-list::-webkit-scrollbar-thumb,
.data-content::-webkit-scrollbar-thumb,
.preview-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

#kvp-thumbnails-list::-webkit-scrollbar-thumb:hover,
.data-content::-webkit-scrollbar-thumb:hover,
.preview-content::-webkit-scrollbar-thumb:hover {
  background: #999;
}


/* V052 Multidoc Tabs */
.multidoc-tabs {
  display: flex;
  gap: 0;
  padding: 0 25px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.multidoc-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  font-family: var(--font-family-medium, sans-serif);
  font-size: 0.75rem;
  color: rgba(0, 0, 0, 0.45);
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.multidoc-tab:hover {
  color: rgba(0, 0, 0, 0.7);
}

.multidoc-tab.active {
  color: #1a1a1a;
  border-bottom-color: var(--primary, #7ba82e);
}

/* V048 Section Dividers */
.kvp-section {
  padding: 0;
}

.kvp-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 25px 8px;
  margin: 0;
}

/* V048 Table Styles */
.kvp-table-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 25px 4px;
}

.kvp-table-header-row .kvp-table-title {
  padding: 0;
  margin: 0;
}

.kvp-table-header-row .kvp-copy-btn {
  flex-shrink: 0;
}

.kvp-table-title {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  padding: 8px 25px 4px;
  margin: 0;
}

.kvp-table-wrapper {
  overflow-x: auto;
  padding: 0 25px 16px;
}

.kvp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.kvp-table th,
.kvp-table td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid #e5e5e5;
}

.kvp-table th {
  background: #f5f5f5;
  font-weight: 600;
  color: #555;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kvp-table tr:hover td {
  background: #fafafa;
}

/* Data Panel Tabs */
.data-tab-bar {
  display: flex;
  gap: 0;
  height: 47px;
  box-sizing: border-box;
  border-bottom: 1px solid #e5e5e5;
  align-items: stretch;
}

.data-panel-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: #aaa;
  cursor: pointer;
  transition: color 0.15s;
  letter-spacing: 0.1px;
}

.data-panel-tab:hover {
  color: #555;
}

.data-panel-tab.active {
  color: #333;
  font-weight: 600;
  border-bottom-color: #7cb342;
}

/* Clean Text header with copy button */
.kvp-raw-text-header {
  display: flex;
  justify-content: flex-end;
  padding: 10px 25px 0;
  background: white;
}

.kvp-raw-text-header .kvp-copy-text-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  background: white;
  border: 1px solid #ddd;
  color: #555;
  border-radius: 4px;
  width: auto;
  height: auto;
  cursor: pointer;
}

.kvp-raw-text-header .kvp-copy-text-btn:hover {
  background: #f5f5f5;
  border-color: #aaa;
  color: #333;
}

/* Clean Text / Raw Text Block */
.kvp-raw-text {
  margin: 0;
  padding: 20px 25px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: #333;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: white;
  border: none;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .kvp-modal-data {
    width: 320px;
  }

  .kvp-modal-thumbnails {
    width: 80px;
  }
}

@media (max-width: 768px) {
  .kvp-modal {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .kvp-modal-thumbnails {
    display: none;
  }

  .kvp-modal-data {
    width: 100%;
    border-left: none;
  }

  .kvp-modal-preview {
    display: none;
  }
}
