/* data-popup.css — Hoverable popup for deposited data */

/* --- Trigger link styling --- */
.data-popup-ref {
  color: var(--link, #256);
  text-decoration: none;
  border-bottom: 1px dotted var(--link, #256);
  cursor: pointer;
}
.data-popup-ref:hover {
  border-bottom-style: solid;
}

/* --- Popup container --- */
.data-popup {
  position: absolute;
  z-index: 1001;
  display: flex;
  flex-direction: column;

  width: 480px;
  max-width: calc(100vw - 32px);
  max-height: 85vh;

  background: var(--bg, #fcfcf8);
  border: 3px double #ccc;
  box-shadow: 1px 2px 8px 0 #ccc;

  opacity: 1;
  transition: none;

  font-family: 'IBM Plex Mono', 'Menlo', monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.data-popup.fading {
  opacity: 0;
  transition: opacity 0.25s ease-in 0.1s;
}

.data-popup.focused {
  border-color: #aaa;
  box-shadow: 1px 2px 8px 0 #aaa;
}

/* --- Title bar --- */
.data-popup-title-bar {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 1.6rem;
  padding: 0.2rem 0.5rem;
  border-bottom: 1px solid #ddd;
  background-color: #fff;
  background-image: radial-gradient(circle, #e6e6e6 1px, transparent 1px);
  background-size: 8px 8px;
  user-select: none;
}

.data-popup.focused .data-popup-title-bar {
  background-image: radial-gradient(circle, #fff 1px, transparent 1px);
  background-color: #e6e6e6;
}

.data-popup-title {
  flex: 1 1 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: #aaa;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-popup.focused .data-popup-title {
  color: #555;
}

.data-popup-pin,
.data-popup-expand,
.data-popup-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.3rem;
  line-height: 1;
  color: #bbb;
  transition: color 0.15s;
}
.data-popup-pin:hover,
.data-popup-expand:hover,
.data-popup-close:hover {
  color: #555;
}

.data-popup.pinned .data-popup-pin {
  color: #b33;
}

/* --- Tab bar --- */
.data-popup-tabs {
  display: flex;
  flex: 0 0 auto;
  border-bottom: 1px solid #ddd;
  background: #f5f5f2;
  padding: 0;
  gap: 0;
}

.data-popup-tab {
  flex: 1 1 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.4em 0.6em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.data-popup-tab:hover {
  color: #444;
}

.data-popup-tab.active {
  color: #256;
  border-bottom-color: #256;
}

.data-popup-download {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0.4em 0.7em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  color: #256;
  text-decoration: none;
  border-left: 1px solid #ddd;
  margin-left: auto;
  white-space: nowrap;
}
.data-popup-download:hover {
  background: #e8eef4;
}

/* --- Content area --- */
.data-popup-content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.75em;
  min-height: 0;
}

/* --- Item list (reuses protocol-item pattern) --- */
.data-item-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.data-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #f8f8f5;
  border: 1px solid #e0e0d8;
  border-radius: 3px;
  padding: 0.35em 0.6em;
  font-family: 'IBM Plex Mono', 'Menlo', monospace;
  font-size: 0.78rem;
  color: #444;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  line-height: 1.4;
}

.data-item:hover {
  background: #eef2f8;
  border-color: #b0c0d0;
}

.data-item.active {
  background: #e0eaf4;
  border-color: #6090c0;
  color: #234;
}

/* --- Detail area --- */
.data-detail {
  margin-top: 0.5em;
}

/* --- CSV table --- */
.data-info {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.4em;
}

.data-table-wrapper {
  overflow-x: auto;
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 3px;
}

.data-table {
  border-collapse: collapse;
  font-size: 0.75rem;
  white-space: nowrap;
  width: 100%;
}

.data-table th,
.data-table td {
  padding: 0.25em 0.5em;
  border: 1px solid #e8e8e4;
  text-align: left;
}

.data-table th {
  background: #f0f0ec;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table tbody tr:nth-child(even) {
  background: #fafaf8;
}

/* --- Code cells --- */
.data-code-cell {
  margin: 0.5em 0;
}

.data-code-cell pre {
  margin: 0;
  padding: 0.6em;
  background: #f8f8f5;
  border: 1px solid #e0e0d8;
  border-radius: 3px;
  overflow-x: auto;
  font-size: 0.78rem;
}

.data-md-cell {
  margin: 0.5em 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 0.82rem;
  color: #444;
}

.data-md-cell h3,
.data-md-cell h4,
.data-md-cell h5 {
  margin: 0.6em 0 0.3em;
}

/* --- Expanded state --- */
.data-popup.expanded {
  max-height: 90vh;
}

/* --- Fullscreen state --- */
.data-popup.fullscreen {
  position: fixed;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border: none;
  box-shadow: none;
  z-index: 10000;
}

.data-popup.fullscreen .data-popup-content {
  max-height: none;
}
