/* ============================================================ */
/*   HTML 互动卡片舱温和科技感风格样式 (Slate & Indigo Theme)     */
/* ============================================================ */

.html-panel {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%) !important;
  color: #f1f5f9 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  border-left: 1px solid #334155;
  border-right: 1px solid #334155;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.3) inset;
}

.html-panel .win-header {
  background: #0f172a !important;
  border-bottom: 1px solid #334155 !important;
}

.html-panel .win-header h3 {
  color: #f1f5f9 !important;
  font-size: 15px !important;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* 组件卡片排布 */
.html-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 14px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  transition: all 0.25s ease-in-out;
}

.html-card:hover {
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
}

.html-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  border-bottom: 1px dashed #334155;
  padding-bottom: 6px;
}

.html-card-title {
  font-size: 11px;
  font-weight: 600;
  color: #818cf8;
}

/* 时间条下移至底部 Footer */
.html-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
}

.html-card-time {
  font-size: 10px;
  color: #475569;
}

.html-card-prompt {
  font-size: 11px;
  color: #cbd5e1;
  margin-bottom: 10px;
  background: #0f172a;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid #6366f1;
  word-break: break-all;
}

/* 沙盒 iframe 容器 */
.html-card-iframe-container {
  width: 100%;
  height: 250px;
  background: #ffffff; /* 保持白色底方便完美渲染网页 */
  border: 1px solid #334155;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  position: relative;
}

.html-card-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}

/* 沙盒右下角悬浮"大卡片预览"按钮 */
.html-card-preview-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(15, 23, 42, 0.78);
  color: #34d399;
  border: 1px solid #34d399;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.2s ease, transform 0.15s ease;
  backdrop-filter: blur(4px);
  z-index: 5;
}
.html-card-preview-btn:hover {
  opacity: 1;
  transform: scale(1.05);
}

/* 超长指令折叠态样式 */
.html-card-prompt-collapsible {
  cursor: pointer;
  transition: background 0.15s ease;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.html-card-prompt-collapsible[data-collapsed="0"] {
  -webkit-line-clamp: unset;
  white-space: normal;
  word-break: break-all;
}
.html-card-prompt-collapsible:hover {
  background: #1a2540;
}
.html-card-prompt-toggle {
  color: #34d399;
  font-weight: 700;
  margin-left: 4px;
  flex-shrink: 0;
}

/* 大卡片全屏预览淡入动画 */
@keyframes htmlPreviewFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 按钮 hover 微调 */
.html-panel .btn-icon {
  transition: color 0.2s ease;
}
.html-panel .btn-icon:hover {
  opacity: 0.8;
}

/* 构建弹窗科幻美化 */
.cyber-modal {
  background: #1e293b !important;
  border: 1px solid #475569 !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5) !important;
  color: #f1f5f9 !important;
}

.cyber-modal .modal-header h4 {
  color: #f1f5f9 !important;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
}

.cyber-input {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  color: #f1f5f9 !important;
  font-family: 'Courier New', Courier, monospace;
  padding: 10px !important;
  border-radius: 8px !important;
}

.cyber-input:focus {
  border-color: #6366f1 !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2) !important;
  outline: none;
}

.btn-cyber {
  background: #6366f1 !important;
  color: #ffffff !important;
  border: none !important;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-cyber:hover {
  background: #4f46e5 !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* ============================================================ */
/*   代码维修舱独立二级空间界面 (Repair Workspace)               */
/* ============================================================ */

.repair-workspace-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0f172a;
  z-index: 1100; /* 高于 html-panel 覆盖整屏进行精细调试 */
  display: flex;
  flex-direction: column;
  animation: slideInUp 0.25s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes slideInUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.repair-workspace-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

.repair-editor-title {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.repair-textarea {
  width: 100%;
  height: 180px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #cbd5e1;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  padding: 12px;
  resize: none;
  box-sizing: border-box;
}

.repair-textarea:focus {
  border-color: #6366f1;
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.repair-preview-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.repair-preview-status {
  font-size: 10px;
  color: #10b981; 
  background: rgba(16, 185, 129, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}