/* WebMCP Sheets - Custom Spreadsheet CSS */

:root {
  --grid-border: #e2e8f0;
  --header-bg: #f8fafc;
  --header-text: #475569;
  --header-active-bg: #e2e8f0;
  --human-cursor-border: #2563eb;
  --human-cursor-bg: rgba(37, 99, 235, 0.08);
  --agent-cursor-border: #9333ea;
  --agent-cursor-bg: rgba(147, 51, 234, 0.12);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Spreadsheet Grid */
.sheet-grid-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.cell-header-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 30;
  background-color: var(--header-bg);
  border-right: 1px solid var(--grid-border);
  border-bottom: 1px solid var(--grid-border);
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  height: 26px;
}

.col-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: var(--header-bg);
  color: var(--header-text);
  font-weight: 600;
  font-size: 11px;
  text-align: center;
  border-right: 1px solid var(--grid-border);
  border-bottom: 1px solid var(--grid-border);
  height: 26px;
  user-select: none;
}

.col-header.header-highlight {
  background-color: #dbeafe;
  color: #1d4ed8;
  border-bottom: 2px solid #2563eb;
}

.row-header {
  position: sticky;
  left: 0;
  z-index: 10;
  background-color: var(--header-bg);
  color: var(--header-text);
  font-weight: 500;
  font-size: 11px;
  text-align: center;
  border-right: 1px solid var(--grid-border);
  border-bottom: 1px solid var(--grid-border);
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  user-select: none;
}

.row-header.header-highlight {
  background-color: #dbeafe;
  color: #1d4ed8;
  border-right: 2px solid #2563eb;
}

.sheet-cell {
  position: relative;
  border-right: 1px solid var(--grid-border);
  border-bottom: 1px solid var(--grid-border);
  padding: 2px 6px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  background-color: #ffffff;
  cursor: cell;
  transition: background-color 0.1s ease;
}

/* Human Cursor */
.sheet-cell.human-active {
  box-shadow: inset 0 0 0 2px var(--human-cursor-border);
  z-index: 5;
}

.sheet-cell.human-selected {
  background-color: var(--human-cursor-bg);
}

/* Fill handle on active human cell */
.sheet-cell.human-active::after {
  content: '';
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 7px;
  height: 7px;
  background-color: var(--human-cursor-border);
  border: 1px solid #ffffff;
  cursor: crosshair;
  z-index: 6;
}

/* Agent Cursor & Co-Presence */
.sheet-cell.agent-active {
  box-shadow: inset 0 0 0 2px var(--agent-cursor-border) !important;
  background-color: var(--agent-cursor-bg) !important;
  z-index: 8;
  animation: agentPulse 2s infinite ease-in-out;
}

@keyframes agentPulse {
  0% {
    box-shadow: inset 0 0 0 2px var(--agent-cursor-border), 0 0 0 0 rgba(147, 51, 234, 0.4);
  }
  50% {
    box-shadow: inset 0 0 0 2px var(--agent-cursor-border), 0 0 0 4px rgba(147, 51, 234, 0.2);
  }
  100% {
    box-shadow: inset 0 0 0 2px var(--agent-cursor-border), 0 0 0 0 rgba(147, 51, 234, 0);
  }
}

/* Agent floating badge */
.agent-cell-badge {
  position: absolute;
  top: -24px;
  left: -2px;
  background-color: #9333ea;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 25;
  white-space: nowrap;
}

/* Floating WebMCP Dev blue widget */
.webmcp-corner-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background-color: #2563eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  z-index: 100;
  transition: transform 0.2s, background-color 0.2s;
}

.webmcp-corner-widget:hover {
  transform: scale(1.08);
  background-color: #1d4ed8;
}
