/**
 * RolePilot 角色灵动岛 - 演示样式
 */

/* ========== 演示区域 ========== */
.di-demo-area {
  position: relative;
  height: calc(100vh - 180px);
  min-height: 600px;
  background: var(--doc-panel-bg);
  border: 1px solid var(--doc-border);
  border-radius: 8px;
  overflow: hidden;
}

/* 模拟编辑器背景 */
.di-editor-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 120px;
  padding: 40px;
  opacity: 0.3;
}

.di-editor-line {
  height: 12px;
  background: var(--doc-border);
  border-radius: 2px;
  margin-bottom: 16px;
  width: 100%;
}

.di-editor-line.short {
  width: 40%;
}

.di-editor-line.medium {
  width: 70%;
}

/* ========== 灵动岛主体 ========== */
.di-island {
  position: absolute;
  bottom: 180px;
  left: 50%;
  transform: translateX(-50%);
  cursor: pointer;
  z-index: 50;
}

/* 静默态 */
.di-idle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1c1c1e;
  border: 2px solid #3a3a3c;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.di-island.expanded .di-idle {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

/* 眼睛 */
.di-eyes {
  display: flex;
  gap: 12px;
  z-index: 2;
}

.di-eye {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.3s ease;
}

/* 表情动画 */
.di-island[data-expression="happy"] .di-eye {
  height: 4px;
  border-radius: 4px 4px 0 0;
  transform: translateY(2px);
}

.di-island[data-expression="focused"] .di-eye {
  width: 6px;
  height: 6px;
}

.di-island[data-expression="sleepy"] .di-eye {
  height: 2px;
  border-radius: 2px;
}

.di-island[data-expression="thinking"] .di-eye.left {
  transform: translateX(-2px) translateY(-2px);
}

.di-island[data-expression="thinking"] .di-eye.right {
  transform: translateX(2px) translateY(-2px);
}

/* 流体动画背景 */
.di-fluid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.1) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(255,255,255,0.08) 0%, transparent 40%);
  animation: fluidMove 4s ease-in-out infinite;
}

@keyframes fluidMove {
  0%, 100% { 
    background-position: 0% 0%, 100% 100%;
    opacity: 0.6;
  }
  50% { 
    background-position: 100% 100%, 0% 0%;
    opacity: 1;
  }
}

/* 内容标识 */
.di-content-indicator {
  position: absolute;
  font-size: 14px;
  font-weight: 600;
  color: var(--doc-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
}

.di-island.has-content .di-content-indicator {
  opacity: 1;
}

.di-island.has-content .di-eyes {
  opacity: 0.3;
}

/* 通知态 */
.di-island.alert .di-idle {
  border-color: #ff6b6b;
  animation: alertPulse 3s ease-in-out infinite;
}

@keyframes alertPulse {
  0%, 100% { 
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    border-color: #ff6b6b;
  }
  50% { 
    box-shadow: 0 0 20px 5px rgba(255, 107, 107, 0.2);
    border-color: #ff8a8a;
  }
}

/* 展开态 */
.di-expanded {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 56px;
  border-radius: 28px;
  background: #1c1c1e;
  border: 2px solid #3a3a3c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 0 20px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.di-island.expanded .di-expanded {
  opacity: 1;
  pointer-events: auto;
}

.di-island.expanded.alert .di-expanded {
  border-color: #ff6b6b;
}

.di-role-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.di-actions {
  display: flex;
  gap: 8px;
}

.di-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2c2c2e;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.di-action-btn:hover {
  background: #3a3a3c;
  transform: scale(1.1);
}

.di-btn-icon {
  font-size: 18px;
}

/* ========== 气泡通知 ========== */
.di-bubble {
  position: absolute;
  bottom: 250px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #2c2c2e;
  border: 1px solid #3a3a3c;
  border-radius: 12px;
  padding: 12px 20px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 60;
  max-width: 300px;
}

.di-bubble.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.di-bubble.success {
  border-color: #4ade80;
}

.di-bubble.warning {
  border-color: #fbbf24;
}

.di-bubble-text {
  font-size: 14px;
  color: #fff;
  line-height: 1.5;
}

/* 气泡箭头 */
.di-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #2c2c2e;
}

/* ========== 内容卡片面板 ========== */
.di-content-panel {
  position: absolute;
  bottom: 250px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1c1c1e;
  border: 1px solid #3a3a3c;
  border-radius: 12px;
  padding: 12px;
  width: 320px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 55;
}

.di-content-panel.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.di-content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #3a3a3c;
  font-size: 12px;
  color: var(--doc-text-dim);
}

.di-content-count {
  color: var(--doc-primary);
}

.di-content-card {
  background: #2c2c2e;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.di-content-card:last-child {
  margin-bottom: 0;
}

.di-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.di-card-icon {
  font-size: 14px;
}

.di-card-source {
  flex: 1;
  font-size: 13px;
  color: #fff;
}

.di-card-size {
  font-size: 11px;
  color: var(--doc-text-dim);
}

.di-card-close {
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  color: var(--doc-text-dim);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.di-card-close:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ========== AI 结果弹窗 ========== */
.di-result-modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: #1c1c1e;
  border: 1px solid var(--doc-primary);
  border-radius: 12px;
  width: 400px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
}

.di-result-modal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.di-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #3a3a3c;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.di-result-close {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--doc-text-dim);
  cursor: pointer;
  border-radius: 4px;
  font-size: 18px;
  transition: all 0.2s;
}

.di-result-close:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.di-result-content {
  padding: 20px;
  font-size: 14px;
  color: var(--doc-text);
  line-height: 1.8;
}

.di-result-content p {
  margin-bottom: 8px;
}

.di-result-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid #3a3a3c;
}

.di-result-btn {
  flex: 1;
  padding: 10px;
  background: #2c2c2e;
  border: 1px solid #3a3a3c;
  border-radius: 6px;
  color: var(--doc-text);
  font-family: var(--doc-font);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.di-result-btn:hover {
  background: #3a3a3c;
}

.di-result-btn.primary {
  background: var(--doc-primary);
  border-color: var(--doc-primary);
  color: #000;
}

.di-result-btn.primary:hover {
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

/* ========== 拖拽区域 ========== */
.di-drop-zone {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 243, 255, 0.05);
  border: 2px dashed transparent;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 40;
}

.di-drop-zone.active {
  opacity: 1;
  pointer-events: auto;
  border-color: var(--doc-primary);
}

.di-drop-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.di-drop-icon {
  font-size: 48px;
}

.di-drop-text {
  font-size: 16px;
  color: var(--doc-primary);
}

/* ========== 控制面板 ========== */
.di-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--doc-sidebar-bg);
  border-top: 1px solid var(--doc-border);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.di-control-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.di-control-label {
  font-size: 12px;
  color: var(--doc-text-dim);
  min-width: 70px;
}

.di-control-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.di-ctrl-btn {
  padding: 6px 12px;
  background: var(--doc-panel-bg);
  border: 1px solid var(--doc-border);
  border-radius: 4px;
  color: var(--doc-text-dim);
  font-family: var(--doc-font);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.di-ctrl-btn:hover {
  border-color: var(--doc-primary);
  color: var(--doc-text);
}

.di-ctrl-btn.active {
  background: var(--doc-primary);
  border-color: var(--doc-primary);
  color: #000;
}

/* ========== 说明面板扩展 ========== */
.guide-states {
  margin-bottom: 20px;
}

.guide-states h4 {
  font-size: 14px;
  color: var(--doc-text);
  margin-bottom: 12px;
}

.state-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--doc-sidebar-bg);
  border-radius: 6px;
  margin-bottom: 8px;
}

.state-icon {
  font-size: 20px;
  width: 30px;
  text-align: center;
}

.state-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.state-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--doc-text);
}

.state-desc {
  font-size: 12px;
  color: var(--doc-text-dim);
}

.guide-expressions h4 {
  font-size: 14px;
  color: var(--doc-text);
  margin-bottom: 12px;
}

.expression-list {
  display: flex;
  gap: 12px;
}

.expression-item {
  font-size: 24px;
  cursor: help;
}

.feature-icon {
  font-size: 14px;
  margin-right: 8px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .di-demo-area {
    height: auto;
    min-height: 500px;
  }
  
  .di-controls {
    position: relative;
  }
  
  .di-control-group {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .di-expanded {
    width: 240px;
  }
  
  .di-result-modal {
    width: 90%;
    max-width: 400px;
  }
}
