body {
  font-family: 'Inter', sans-serif;
  overscroll-behavior: none;
  overflow: hidden; /* Prevent body scroll */
}

/* Base styles for AI-generated widget content */
.widget-body h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.widget-body button, .widget-body .button {
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 0.2s;
}
.widget-body button:hover, .widget-body .button:hover {
  background-color: #e5e7eb;
}
.widget-body textarea {
    width: 100%;
    min-height: 200px;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem;
    font-family: 'Roboto Mono', monospace;
}
.widget-body canvas {
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: #f9fafb;
}


/* New endless canvas layout */
#workspace {
  position: absolute;
  inset: 0;
  background-color: #f9fafb; /* bg-gray-50 */
  cursor: grab;
  overflow: hidden;
}
#workspace:active {
  cursor: grabbing;
}

#canvas-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  will-change: transform;
  transition: transform 0.1s ease-out; /* Smooth out zooming */
}

.widget-card {
    position: absolute;
    background-color: white;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    /* Let the canvas layer handle the cursor */
    cursor: default;
}

.widget-header {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #f9fafb;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    cursor: grab;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.widget-header:active {
    cursor: grabbing;
}
.widget-body {
    padding: 1rem;
    flex-grow: 1;
    overflow: auto;
}

#chat-panel {
    position: absolute;
    top: 1rem;
    left: 1rem;
    bottom: 1rem;
    z-index: 20;
    width: 384px; /* max-w-md */
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border: 1px solid #e5e7eb;
}

/* Loading Spinner */
.spinner-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(4px);
    border-radius: 0.5rem;
}
.spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #d1d5db;
    border-bottom-color: #3b82f6;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
