/* dev-shell React entry styles — mirrors the original dev-shell.css */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#app-iframe {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  transition: width 0.3s;
}

#agent-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100vh;
  visibility: hidden;
  pointer-events: none;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
  z-index: 1000;
}

#agent-panel.visible {
  visibility: visible;
  pointer-events: auto;
}

#toggle-btn {
  position: fixed;
  z-index: 9999;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: #595959;
  border: 1.5px solid #d9d9d9;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: right 0.3s, background 0.2s, color 0.2s;
}

#toggle-btn:hover {
  background: #e6f4ff;
  color: #1677ff;
  border-color: #1677ff;
}

#toggle-btn.active {
  background: #1677ff;
  color: #fff;
  border-color: #1677ff;
}

#inspect-btn,
#undo-btn,
#menu-btn {
  position: fixed;
  z-index: 9999;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: #595959;
  border: 1.5px solid #d9d9d9;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: right 0.3s, background 0.2s, color 0.2s;
}

#inspect-btn:hover {
  background: #e6f4ff;
  color: #1677ff;
  border-color: #1677ff;
}

#inspect-btn.active {
  background: #1677ff;
  color: #fff;
  border-color: #1677ff;
}

#undo-btn:hover {
  background: #fff7e6;
  color: #fa8c16;
  border-color: #fa8c16;
}

#menu-btn:hover {
  background: #e6f4ff;
  color: #1677ff;
  border-color: #1677ff;
}

#menu-btn.active {
  background: #1677ff;
  color: #fff;
  border-color: #1677ff;
}

#skill-menu-popup {
  position: fixed;
  bottom: 100px;
  z-index: 99998;
  width: 230px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  display: none;
  flex-direction: column;
  transition: right 0.3s;
}

#skill-menu-popup.open {
  display: flex;
}

#skill-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99997;
}

#skill-menu-backdrop.open {
  display: block;
}

.skill-menu-section {
  padding: 8px 0;
}

.skill-menu-section + .skill-menu-section {
  border-top: 1px solid #f0f0f0;
}

.skill-menu-group-label {
  padding: 6px 16px 4px;
  font-size: 12px;
  color: #999;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.skill-menu-item {
  padding: 10px 16px;
  font-size: 13px;
  color: #1a1a1a;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
}

.skill-menu-item:hover {
  background: #e6f4ff;
  color: #1677ff;
}

.skill-menu-item:disabled {
  color: #bfbfbf;
  cursor: not-allowed;
}

.skill-menu-item:disabled:hover {
  background: none;
  color: #bfbfbf;
}

/* ── Undo confirm ──────────────────────────────────────────────────────────── */
#undo-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

#undo-confirm-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  width: 280px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#undo-confirm-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

#undo-confirm-card p {
  margin: 0;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

.undo-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.undo-btn-cancel {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid #d9d9d9;
  background: #fff;
  color: #595959;
  cursor: pointer;
  font-size: 13px;
}

.undo-btn-cancel:hover {
  background: #f5f5f5;
}

.undo-btn-confirm {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  background: #fa8c16;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.undo-btn-confirm:hover {
  background: #d46b08;
}

div.chat-header {
  height: 65px !important;
}

/* ── Add Data Modal ──────────────────────────────────────────────────────── */
#add-data-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

#add-data-modal-card {
  background: #fff;
  border-radius: 12px;
  width: 540px;
  max-height: 88vh;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.add-data-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid #f0f0f0;
}

.add-data-modal-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

.add-data-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #999;
  line-height: 1;
  padding: 0 2px;
}

.add-data-modal-close:hover {
  color: #333;
}

.add-data-modal-tabs {
  display: flex;
  padding: 0 24px;
  gap: 4px;
  border-bottom: 1px solid #f0f0f0;
}

.add-data-modal-tab {
  padding: 10px 16px;
  font-size: 13px;
  border: none;
  background: none;
  cursor: pointer;
  color: #595959;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.add-data-modal-tab:hover {
  color: #1677ff;
}

.add-data-modal-tab.active {
  color: #1677ff;
  border-bottom-color: #1677ff;
  font-weight: 500;
}

.add-data-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.add-data-tab-panel {
  display: none;
}

.add-data-tab-panel.active {
  display: block;
}

.add-data-hint {
  font-size: 12px;
  color: #999;
  margin: 0 0 10px;
  line-height: 1.5;
}

.add-data-free-textarea {
  width: 100%;
  height: 200px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  resize: vertical;
  outline: none;
  color: #1a1a1a;
  font-family: inherit;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.add-data-free-textarea:focus {
  border-color: #1677ff;
}

.guided-question {
  margin-bottom: 14px;
}

.guided-question-label {
  font-size: 13px;
  color: #333;
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
}

.guided-optional-tag {
  font-size: 11px;
  color: #bbb;
  font-weight: 400;
  margin-left: 4px;
}

.guided-required-tag {
  font-size: 11px;
  color: #ff4d4f;
  font-weight: 400;
  margin-left: 4px;
}

.guided-hint-text {
  display: block;
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

.guided-question-input,
.guided-question-textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  outline: none;
  color: #1a1a1a;
  font-family: inherit;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.guided-question-input:focus,
.guided-question-textarea:focus {
  border-color: #1677ff;
}

.guided-question-textarea {
  resize: vertical;
  min-height: 58px;
}

.add-data-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 24px 18px;
  border-top: 1px solid #f0f0f0;
}

.add-data-btn-cancel {
  padding: 7px 18px;
  border-radius: 6px;
  border: 1px solid #d9d9d9;
  background: #fff;
  color: #595959;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.add-data-btn-cancel:hover {
  background: #f5f5f5;
}

.add-data-btn-confirm {
  padding: 7px 18px;
  border-radius: 6px;
  border: none;
  background: #1677ff;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

.add-data-btn-confirm:hover {
  background: #0958d9;
}

/* ── Add Page Modal ──────────────────────────────────────────────────────── */
#add-page-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

#add-page-modal-card {
  background: #fff;
  border-radius: 12px;
  width: 520px;
  max-height: 88vh;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#add-page-modal-body {
  flex: 1;
  overflow-y: auto;
}

#add-page-modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 24px 18px;
  border-top: 1px solid #f0f0f0;
}

.add-page-type-grid {
  display: flex;
  gap: 12px;
  padding: 16px 24px 20px;
}

.add-page-type-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 10px;
  border: 1.5px solid #d9d9d9;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.add-page-type-card:hover {
  border-color: #1677ff;
  background: #e6f4ff;
}

.add-page-type-card.selected {
  border-color: #1677ff;
  background: #e6f4ff;
  transform: scale(0.97);
}

.add-page-type-icon {
  font-size: 28px;
  line-height: 1;
}

.add-page-type-label {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}

.add-page-type-desc {
  font-size: 11px;
  color: #999;
  text-align: center;
  line-height: 1.4;
}

.add-page-redirect-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 32px 24px;
  gap: 10px;
  text-align: center;
}

.add-page-redirect-icon {
  font-size: 40px;
  line-height: 1;
}

.add-page-redirect-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0;
}

.add-page-redirect-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.7;
  margin: 0;
}

.add-page-roles-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.add-page-role-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  padding: 4px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 20px;
  transition: border-color 0.15s, background 0.15s;
}

.add-page-role-checkbox:has(input:checked) {
  border-color: #1677ff;
  background: #e6f4ff;
  color: #1677ff;
}

.add-page-role-checkbox input {
  accent-color: #1677ff;
}

/* ── Edit Data Modal ─────────────────────────────────────────────────────── */
#edit-data-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

#edit-data-modal-card {
  background: #fff;
  border-radius: 12px;
  width: 720px;
  max-height: 88vh;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.edit-data-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

.edit-data-fields-panel {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  background: #fafafa;
}

.edit-data-fields-title {
  padding: 14px 16px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #8c8c8c;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.edit-data-fields-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.edit-data-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 16px;
  gap: 8px;
}

.edit-data-field-row:hover {
  background: #f0f0f0;
}

.edit-data-field-name {
  font-size: 13px;
  color: #262626;
  font-family: 'SFMono-Regular', Consolas, monospace;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-data-field-type {
  font-size: 11px;
  color: #1677ff;
  font-family: 'SFMono-Regular', Consolas, monospace;
  flex-shrink: 0;
  background: #e6f4ff;
  padding: 1px 6px;
  border-radius: 4px;
}

.edit-data-field-type.optional {
  color: #8c8c8c;
  background: #f5f5f5;
}

.edit-data-fields-empty {
  font-size: 12px;
  color: #bfbfbf;
  padding: 16px;
}

.edit-data-input-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  min-width: 0;
  gap: 10px;
}

.edit-data-textarea {
  flex: 1;
  resize: none !important;
  min-height: 0;
}

/* ── Delete Data Confirm ─────────────────────────────────────────────────── */
#delete-data-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

#delete-data-confirm-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  width: 320px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#delete-data-confirm-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
}

#delete-data-confirm-card p {
  margin: 0;
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}

.delete-data-warning {
  color: #cf1322 !important;
  font-weight: 500;
}

.delete-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.delete-data-btn-confirm {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  background: #ff4d4f;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.delete-data-btn-confirm:hover {
  background: #cf1322;
}

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scale(0.95);
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 10000;
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}
