/* ==================== AI动态NPC系统样式 ==================== */

/* 主面板 */
.ai-npc-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-height: 85vh;
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: 2px solid #e94560;
    border-radius: 20px;
    padding: 25px;
    color: #e0e0e0;
    font-family: 'Microsoft YaHei', sans-serif;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(233, 69, 96, 0.3);
    z-index: 10000;
    overflow-y: auto;
}

.ai-npc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(233, 69, 96, 0.3);
}

.ai-npc-header h3 {
    margin: 0;
    font-size: 22px;
    background: linear-gradient(90deg, #e94560, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-npc-header button {
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid rgba(233, 69, 96, 0.5);
    color: #ff6b6b;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
}

.ai-npc-header button:hover {
    background: rgba(233, 69, 96, 0.4);
    transform: rotate(90deg);
}

.ai-npc-subtitle {
    text-align: center;
    color: #888;
    font-size: 14px;
    margin-bottom: 20px;
}

/* 空状态 */
.ai-npc-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.ai-npc-empty p:first-child {
    font-size: 48px;
    margin-bottom: 10px;
}

.ai-npc-empty .hint {
    font-size: 13px;
    color: #4b5563;
}

/* NPC列表 */
.ai-npc-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-npc-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(233, 69, 96, 0.1);
    border: 1px solid rgba(233, 69, 96, 0.2);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.ai-npc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.ai-npc-card:hover::before {
    left: 100%;
}

.ai-npc-card:hover {
    background: rgba(233, 69, 96, 0.2);
    border-color: rgba(233, 69, 96, 0.5);
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.3);
}

.ai-npc-card.following {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.5);
}

.ai-npc-card.following:hover {
    background: rgba(16, 185, 129, 0.25);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.3);
}

.ai-npc-avatar {
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, #e94560, #0f3460);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.ai-npc-info {
    flex: 1;
}

.ai-npc-name {
    font-size: 17px;
    font-weight: bold;
    color: #f0f0f0;
    margin-bottom: 4px;
}

.ai-npc-title {
    font-size: 12px;
    color: #e94560;
    margin-bottom: 6px;
}

.ai-npc-level {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 8px;
}

.ai-npc-affection-bar {
    width: 100%;
    height: 5px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.ai-npc-affection-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #ff6b6b, #feca57);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* 详情弹窗 */
.ai-npc-detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-npc-detail-content {
    width: 480px;
    max-height: 90vh;
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #e94560;
    border-radius: 25px;
    padding: 35px;
    color: #e0e0e0;
    overflow-y: auto;
    position: relative;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.ai-npc-detail-content .close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid rgba(233, 69, 96, 0.5);
    color: #ff6b6b;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.ai-npc-detail-content .close-btn:hover {
    background: rgba(233, 69, 96, 0.4);
    transform: rotate(90deg);
}

.ai-npc-portrait {
    text-align: center;
    margin-bottom: 20px;
}

.ai-npc-avatar-large {
    width: 100px;
    height: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    background: linear-gradient(135deg, #e94560, #0f3460);
    border-radius: 50%;
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
}

.ai-npc-detail-content h2 {
    text-align: center;
    margin: 0 0 5px;
    font-size: 28px;
    color: #f0f0f0;
}

.ai-npc-detail-content .ai-npc-title {
    text-align: center;
    color: #e94560;
    font-size: 15px;
    margin-bottom: 10px;
}

.ai-npc-desc {
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.ai-npc-affection-section {
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(233, 69, 96, 0.1);
    border-radius: 15px;
}

.ai-npc-affection-bar-large {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    overflow: hidden;
    margin: 10px 0;
}

.ai-npc-affection-bar-large .ai-npc-affection-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #ff6b6b, #feca57);
}

.ai-npc-interactions {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 5px;
}

.ai-npc-info-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.ai-npc-info-section h4 {
    margin: 0 0 10px;
    font-size: 15px;
    color: #e94560;
}

.ai-npc-info-section p {
    margin: 0;
    line-height: 1.7;
    color: #d1d5db;
    font-size: 14px;
}

.ai-npc-secret-section {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.15), rgba(15, 52, 96, 0.15));
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: 12px;
}

.ai-npc-secret-section h4 {
    margin: 0 0 10px;
    font-size: 15px;
    color: #feca57;
}

.ai-npc-secret-section p {
    margin: 0;
    line-height: 1.7;
    color: #fde68a;
    font-size: 14px;
}

.ai-npc-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.ai-npc-actions button {
    padding: 12px 25px;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 15px rgba(233, 69, 96, 0.3);
}

.ai-npc-actions button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.5);
}

.ai-npc-actions button:disabled {
    background: #4b5563;
    cursor: not-allowed;
    opacity: 0.6;
}

.ai-npc-memories {
    margin-top: 20px;
    padding: 15px;
    background: rgba(15, 52, 96, 0.3);
    border-radius: 12px;
}

.ai-npc-memories h4 {
    margin: 0 0 15px;
    font-size: 15px;
    color: #60a5fa;
}

.ai-npc-memory {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #9ca3af;
}

.ai-npc-memory-action {
    color: #d1d5db;
}

/* 互动反馈动画 */
@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, 20px); }
    20% { opacity: 1; transform: translate(-50%, 0); }
    80% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -20px); }
}

.npc-interaction-feedback {
    pointer-events: none;
}

.npc-interaction-feedback.positive {
    background: rgba(16, 185, 129, 0.95) !important;
}

.npc-interaction-feedback.negative {
    background: rgba(239, 68, 68, 0.95) !important;
}

/* NPC在场景中的显示 */
.ai-npc-in-scene {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(233, 69, 96, 0.2);
    border: 1px solid rgba(233, 69, 96, 0.4);
    border-radius: 20px;
    margin: 0 5px;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.ai-npc-in-scene .npc-avatar {
    font-size: 20px;
}

.ai-npc-in-scene .npc-name {
    font-size: 14px;
    color: #f0f0f0;
}

.ai-npc-in-scene .npc-reaction {
    font-size: 13px;
    color: #feca57;
    font-style: italic;
}

/* 浮动按钮 */
.ai-npc-fab {
    position: fixed;
    bottom: 150px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 5px 25px rgba(233, 69, 96, 0.5);
    z-index: 9998;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-npc-fab:hover {
    transform: scale(1.15) rotate(10deg);
    box-shadow: 0 8px 35px rgba(233, 69, 96, 0.6);
}

.ai-npc-fab:active {
    transform: scale(1.05);
}

/* 滚动条 */
.ai-npc-panel::-webkit-scrollbar,
.ai-npc-detail-content::-webkit-scrollbar {
    width: 8px;
}

.ai-npc-panel::-webkit-scrollbar-track,
.ai-npc-detail-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.ai-npc-panel::-webkit-scrollbar-thumb,
.ai-npc-detail-content::-webkit-scrollbar-thumb {
    background: rgba(233, 69, 96, 0.5);
    border-radius: 4px;
}

.ai-npc-panel::-webkit-scrollbar-thumb:hover,
.ai-npc-detail-content::-webkit-scrollbar-thumb:hover {
    background: rgba(233, 69, 96, 0.7);
}

/* 响应式 */
@media (max-width: 480px) {
    .ai-npc-panel,
    .ai-npc-detail-content {
        width: 90vw;
        max-width: none;
    }

    .ai-npc-detail-content {
        padding: 20px;
    }

    .ai-npc-fab {
        bottom: 100px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
}
