@import '@rozenite/ui/styles.css';

/*
 * The dev host is built from the vite-plugin package, while the shared
 * stylesheet is owned by @rozenite/ui. Include its source explicitly so
 * Tailwind emits the utilities used inside shared components (PluginShell,
 * PluginHeader, and Split) as well as the ones used by the host itself.
 */
@source '../../../ui/src';

@layer base {
  html,
  body,
  #root {
    height: 100%;
    margin: 0;
  }

  body {
    overflow: hidden;
  }
}

.dev-host {
  height: 100dvh;
  overflow: hidden;
}

.dev-host-body {
  min-height: 0;
  overflow: hidden !important;
}

.dev-host-header {
  min-height: 3.25rem;
}

.dev-host-header-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.125rem;
}

.dev-host-header-subtitle {
  max-width: 30rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dev-host-panel-select {
  width: min(16rem, 32vw);
}

.dev-host-main-split {
  min-height: 0;
  flex: 1;
}

.dev-host-preview {
  height: 100%;
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--background);
}

.dev-host-iframe {
  display: block;
  height: 100%;
  width: 100%;
  border: 0;
  background: var(--background);
}

.dev-host-devtools {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.dev-host-pane {
  display: flex;
  height: 100%;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  background: var(--background);
}

.dev-host-pane-header {
  display: flex;
  min-height: 2.75rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  padding: 0.625rem 0.875rem;
}

.dev-host-pane-title {
  color: var(--foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dev-host-pane-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dev-host-scroll {
  min-height: 0;
  flex: 1;
}

.dev-host-message-table {
  min-width: 42rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dev-host-direction-in {
  color: #22c55e;
}

.dev-host-direction-out {
  color: #f59e0b;
}

.dev-host-form,
.dev-host-flow-list,
.dev-host-details {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.dev-host-form {
  flex: 1;
}

.dev-host-field {
  display: grid;
  gap: 0.375rem;
}

.dev-host-label {
  color: var(--muted-foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
}

.dev-host-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: auto;
}

.dev-host-tabs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem 0;
}

.dev-host-tab-panel {
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.dev-host-flow-list {
  padding-top: 0.75rem;
}

.dev-host-flow-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
}

.dev-host-flow-name,
.dev-host-flow-title {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.dev-host-flow-runs {
  display: grid;
  gap: 0.75rem;
}

.dev-host-flow-state {
  display: grid;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.dev-host-flow-state[data-status='running'] {
  border-color: var(--primary);
}

.dev-host-flow-state[data-status='failed'] {
  border-color: var(--destructive);
}

.dev-host-flow-state-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dev-host-flow-state-result,
.dev-host-flow-state-error,
.dev-host-detail-value,
.dev-host-detail-payload {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--muted);
  padding: 0.625rem 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.dev-host-flow-state-error {
  color: var(--destructive);
}

.dev-host-detail-section {
  display: grid;
  gap: 0.375rem;
}

.dev-host-detail-payload {
  min-height: 4rem;
}

.dev-host-mobile-tabs {
  height: 100%;
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.dev-host-mobile-tab-list {
  flex-shrink: 0;
  padding: 0.5rem 0.75rem 0;
}

.dev-host-mobile-tab-panel {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.dev-host-mobile-tab-panel > .dev-host-pane {
  display: flex;
}

@media (max-width: 960px) {
  .dev-host-header {
    padding-inline: 0.75rem;
  }

  .dev-host-header-subtitle {
    display: none;
  }

  .dev-host-panel-select {
    width: min(12rem, 42vw);
  }

  .dev-host-message-table {
    min-width: 36rem;
  }
}
