/**
 * Interactive Tables Styles
 */

.wp-block-table-wrapper {
  position: relative;
  margin: 2em 0;
}

.table-action-bar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  z-index: 10;
  opacity: 0;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  transform: translateY(-5px);
}

.wp-block-table-wrapper:hover .table-action-bar {
  opacity: 1;
  transform: translateY(0);
}

.table-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  color: #333;
  font-size: 14px;
  font-weight: 600;
  gap: 6px;
  line-height: 1;
}

.table-copy-btn:hover {
  background: #fff;
  border-color: #e60000;
  color: #e60000;
  box-shadow: 0 4px 12px rgba(230, 0, 0, 0.15);
}

.table-copy-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.table-copy-btn.copied {
  background: #4caf50;
  border-color: #4caf50;
  color: #fff;
}

/* Tooltip */
.table-copy-btn::after {
  content: "Copy table";
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  padding: 4px 8px;
  background: #333;
  color: #fff;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.table-copy-btn:hover::after {
  opacity: 1;
}

.table-copy-btn.copied::after {
  content: "Copied!";
}

@media screen and (max-width: 767px) {
  .table-action-bar {
    opacity: 1;
    transform: none;
    position: relative;
    top: 0;
    right: 0;
    margin-bottom: 10px;
    justify-content: flex-end;
  }
}
